View Full Version : ChangeFps with ffmpeg/mencoder
Selur
1st April 2009, 09:14
Is there a way to convert the output of mencoder/ffmpeg to a specific framerate while keeping the playback length?
(like Avisynth -> changefps does, through duplicating or dropping frames)
Sometimes I have 60i/50p/30p/... material that I want to convert to 25fps or 15fps (or the othermay around convert 15fps material to 25fps material) and I'm looking for a way to do this via mencoder/ffmpeg.
Using mencoder I hoped:
(from 25p to 50p)
-fps 25 -speed 0.5 -ofps 50
(from 50p to 25p)
-fps 50 -speed 2 -ofps 25
would to the job (fps->Input framerate, ofps->outputframerate, speed->slowdown-/speedup-factor)
Is doing this possible with ffmpeg/mencoder, if so how?
Cu Selur
fangorn
1st April 2009, 09:50
the filter chain you have as example might work if you exchange 25 and 50 values.
In general this is not an easy conversion. In most cases video will be jumpy, choppy, ... and you most definately will lose audio sync.
What is possible (even if it is not so easy also) is to get a 23.976 fps movie out of a NTSC 29.96 fps dvd. Or produce a 25fps PAL movie out of a 23.976 fps Movie (while shortening the runtime of course). And even this might or might not work.
Selur
1st April 2009, 10:01
mixed up, tried to convert 25p to 50p material using the line above ;)
But frame count does not change at all. :(
In general this is not an easy conversion.
I'm aware of the 'crappyness' of just duplicating/dropping frames, but I can't get mencoder to duplicating/dropping frames. ;)
Have you tried without -speed? I don't have any problems with only using -ofps <target_fps> and nothing else. Frames are dropped or duplicated when necessary and A/V sync is kept.
If that doesn't work, post your full command-line.
Selur
1st April 2009, 10:51
here what I used:
trying to convert 25p->50p:
mencoder -lavdopts threads=4 "PATH TO INPUT" -ovc raw -nosound -vf scale,format=i420 -fps 25 -speed 0.5 -of rawvideo -o - | x264 --crf 18 --partitions none --me dia --merange 4 --mvrange 64 --subme 0 --no-chroma-me --aq-mode 0 --threads auto --no-cabac --no-deblock --no-psnr --no-ssim --progress --fps 50 --output "PATH TO OUPUT" - 640x352 I also tried -ofps 50 widh and without -speed but everytime input and output both have the same framecount. :(
50p->25p works with: -vf framestep=2
mencoder -lavdopts threads=4 "PATH TO INPUT" -ovc raw -nosound -vf framestep=2,scale,format=i420 -fps 50 -of rawvideo -o - | x264 --crf 18 --partitions none --me dia --merange 4 --mvrange 64 --subme 0 --no-chroma-me --aq-mode 0 --threads auto --no-cabac --no-deblock --no-psnr --no-ssim --progress --fps 25 --output "PATH TO OUTPUT" - 640x352
-ofps 12.5 also halves the framerate,
so seems like scaling the framerate down seems to work, but how to upscale the framerate.
Cu Selur
Add harddup to the end of the filter chain and specify the desired framerate with -ofps. Looks like harddup is required when using raw output.
Selur
1st April 2009, 13:36
Nice! Thanks! Framerate looks fine now, but it seems to break the colorspace. :(
used: mencoder -lavdopts threads=4 "test.avi" -ovc raw -nosound -vf scale,format=i420,harddup -ofps 50 -of rawvideo -o - | x264 --crf 18 --partitions none --me dia --merange 4 --mvrange 64 --subme 0 --no-chroma-me --aq-mode 0 --threads auto --no-cabac --no-deblock --no-psnr --no-ssim --progress --fps 50 --output "test.mp4" - 640x352(Input (http://www.megaupload.com/?d=56IRTE3Z), Output (http://www.megaupload.com/?d=QACW7ZTE))
Cu Selur
Looks like the output gets corrupted by messages that MEncoder writes to standard output. Use -really-quiet.
Actually I'm not sure why that corruption doesn't happen normally for you when using that command-line. I had to add -really-quiet to be able to encode a test video even when not changing the framerate.
Selur
1st April 2009, 14:04
LOL, seems like it works, funny think is normally I always use '-really-quiet' just didn't add it to get some infos what could go wrong. :)
Thanks a lot for the help. :)
Cu Selur
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.