How to create video from frames and audio file?

2 Ansichten (letzte 30 Tage)
Radwa Hamdi
Radwa Hamdi am 8 Jun. 2014
Beantwortet: mako am 9 Jun. 2014
I used this code but the output video has a faster rate than the original video
hmfr=video.MultimediaFileReader('video.avi','AudioOutputPort',true,'VideoOutputPort',true);
writer=video.MultimediaFileWriter('out.avi','AudioInputPort',true,'VideoInputPort',true);
for i=1:300
videoFrame=step(hmfr);
[i,audio]=step(hmfr);
step(writer,videoFrame,audio);
end
close(hmfr);
close(writer);
Need help please! Thanks in advance.

Antworten (1)

mako
mako am 9 Jun. 2014
Hi, I've been using vision.VideoFileReader and vision.VideoFileWriter in order to create the video with audio and there I can pass a parameter named 'FrameRate' to the writer function, and it is like this:
videoFWriter = vision.VideoFileWriter('video.avi','FrameRate',videoFReader.info.VideoFrameRate);
Maybe you can change to these two functions or maybe the one you are using also has the 'FrameRate' parameter.
I hope this helps.
By the way, please, if you have a minute, take a look at the question I asked yesterday and help me out there, it is related to this matter, just a doubt with the audio. This is the link: http://www.mathworks.com/matlabcentral/answers/133137-problem-adding-audio-to-video-file
Thanks in advance.

Kategorien

Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by