Log in

View Full Version : Help! Can't dump y4m at 25fps!


DeathTheSheep
27th March 2008, 22:23
I'm on Linux. I want to take any video file (like an AVI), and dump it to y4m at 25fps, so that when it's fed to x264 (--fps 25), x264 will produce an MP4 of proper duration at 25fps. The input files can be at any framerate (23.976, 29.97, etc), but I want to convert fps, or add/delete frames, such that the fps when dumped is 25. Here's what doesn't work:


mplayer -benchmark -fps 25 -nosound -noframedrop -noautosub -vo yuv4mpeg:file=$1.y4m $1.avi
x264 [...] -o $1.mp4 $1.y4m --fps 25


The result (using a regular DivX 23.976 AVI as input file) plays too fast at 25fps, meaning the framerate wasn't converted properly. Needless to say, when the audio is muxed in, it's horribly out of sync. :( What do I do?

nm
28th March 2008, 05:05
By default, MPlayer/Mencoder doesn't add or delete frames when you specify a different framerate. To do that, you'll probably need to preprocess with MEncoder (-ofps 25 -vf harddup):
mencoder -ofps 25 -vf harddup -nosound -noautosub -ovc lavc -lavcopts vcodec=ffvhuff "$1.tmp.avi" "$1.avi"
Then use mplayer to write yuv4mpeg and pipe that to x264. Or just use MEncoder's x264 support.

Personally, I'd rather speed up audio (see MPlayer's -af scaletempo) than add duplicate frames when converting film to PAL.