How to create video from frames and audio file?
조회 수: 2 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
mako
2014년 6월 9일
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!