add/extract Audio to/from Video
24 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Mike Dachui
le 28 Avr 2020
Commenté : Mike Dachui
le 30 Avr 2020
How can I extract an audio document(*.wav) from a video document(*.avi)???
How can I add an audio document(*.wav) to a video document(*.avi)???
THX!!!THX!!!THX!!!
0 commentaires
Réponse acceptée
Mehmed Saad
le 28 Avr 2020
Modifié(e) : Mehmed Saad
le 28 Avr 2020
VideoFrameRate = 24;
TempImage = imread('cameraman.tif');
load handel.mat
y = y(1:4 * Fs, :); % select the first 4s
AudioStep = Fs / VideoFrameRate;
videoFWriter = vision.VideoFileWriter('Temp.avi', 'FileFormat', 'AVI',...
'FrameRate', VideoFrameRate, 'AudioInputPort', true);
for i = 1:(VideoFrameRate * length(y) / Fs)
TempIndexBeginning = floor((i - 1) * AudioStep) + 1;
TempIndexEnding = ceil(TempIndexBeginning + AudioStep - 1);
step(videoFWriter, TempImage, y(TempIndexBeginning:TempIndexEnding));
end
release(videoFWriter);
Read Sound from Video directly usind audioread
[y1,Fs1] = audioread('Temp.avi');
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!