gitch
2nd September 2012, 08:45
Hi all
I'm sure there's a better way to do what I am trying to do, but after spending a lot of time on trial and error, this has gotten me the closest to my end goal.
I have a whole bunch of mp4 videos that are recorded in 14fps, 320x240 and I'm wanting to make a DVD out of them. I have an avisynth script to resize them to 640x480 and double the frame rate, which looks something like this:
DirectShowSource("video.mp4").LanczosResize(640,480)
super = MSuper(pel=2)
backward_vec = MAnalyse(super, overlap=4, isb = true, search=3)
forward_vec = MAnalyse(super, overlap=4, isb = false, search=3)
MFlowFps(super, backward_vec, forward_vec, num=2*FramerateNumerator(last), \
den=FramerateDenominator(last))
The script works great when I play it using MPC, and of course there's audio played as well.
I am using ffmpeg to play the avs file and save the output, except the first thing I noticed was that there was no audio in the doubled frame rate output file. So to work around that, I strip the audio out of the original using vlc. Then, I run ffmpeg to double the frame rate:
ffmpeg -i avs2.avs -acodec libmp3lame -an -vcodec copy vid.avi
And finally, I combine the two (audio and video) together:
ffmpeg -i audio.wav -i vid.avi -acodec wmav2 -vcodec mpeg2video -qscale 3 vid2.avi
This gives me a pretty good match... to begin with. Except as the video goes on, the video creeps further and further ahead of the audio. By the end, on a 30 second video, it will have crept so far ahead that it needs a 4 second pause of the video in order to sync the audio, before playing the last few frames.
I wondered if it was to do with the fact that the source video is variable frame rate, so I added in a changeFPS(14) to fix the whole video at a constant rate. Still same effect - video gets ahead of the audio.
Ideally, I'd like to be able to do the frame rate conversion without having to strip the audio using vlc and merge the two together, but I'd settle for any method that just gives me a finished product that looks as good as something played in MPC.
Thanks
Gitch
I'm sure there's a better way to do what I am trying to do, but after spending a lot of time on trial and error, this has gotten me the closest to my end goal.
I have a whole bunch of mp4 videos that are recorded in 14fps, 320x240 and I'm wanting to make a DVD out of them. I have an avisynth script to resize them to 640x480 and double the frame rate, which looks something like this:
DirectShowSource("video.mp4").LanczosResize(640,480)
super = MSuper(pel=2)
backward_vec = MAnalyse(super, overlap=4, isb = true, search=3)
forward_vec = MAnalyse(super, overlap=4, isb = false, search=3)
MFlowFps(super, backward_vec, forward_vec, num=2*FramerateNumerator(last), \
den=FramerateDenominator(last))
The script works great when I play it using MPC, and of course there's audio played as well.
I am using ffmpeg to play the avs file and save the output, except the first thing I noticed was that there was no audio in the doubled frame rate output file. So to work around that, I strip the audio out of the original using vlc. Then, I run ffmpeg to double the frame rate:
ffmpeg -i avs2.avs -acodec libmp3lame -an -vcodec copy vid.avi
And finally, I combine the two (audio and video) together:
ffmpeg -i audio.wav -i vid.avi -acodec wmav2 -vcodec mpeg2video -qscale 3 vid2.avi
This gives me a pretty good match... to begin with. Except as the video goes on, the video creeps further and further ahead of the audio. By the end, on a 30 second video, it will have crept so far ahead that it needs a 4 second pause of the video in order to sync the audio, before playing the last few frames.
I wondered if it was to do with the fact that the source video is variable frame rate, so I added in a changeFPS(14) to fix the whole video at a constant rate. Still same effect - video gets ahead of the audio.
Ideally, I'd like to be able to do the frame rate conversion without having to strip the audio using vlc and merge the two together, but I'd settle for any method that just gives me a finished product that looks as good as something played in MPC.
Thanks
Gitch