crazjo
crazjo

Reputation: 555

FFMPEG reads fps of input h264 file wrong, resulting in wrong duration of output file

I am trying to convert an .h264 file created with python from an incoming stream to xvid format with ffmpeg.

The file is 30min long and 12fps. However, the converted file automatically creates a file that is 25fps and thus 14.4min long. If I set fps like ffmpeg -i test.h264 -r 12 test.avi it creates a video of 14.4min long with a fps of 12.

How can I set it to see the incoming video as 12fps? I tried recording immediately in xvid coded in python using FOURCC but on mac OS X the only codec that seems to work is mp4v. I also tried using MP4Box, which creates the right video duration and fps but for which I cannot set it to the xvid coded (which I need).

Upvotes: 0

Views: 1460

Answers (1)

biskitt
biskitt

Reputation: 1431

The options are the same for input and output. If they are set before the -i, they are applied to input file. After -i, they are applied to output. Everything is explained in the doc

ffmpeg -r 12 -i inuputAt12fps.h264 -r 25 outputAt25Fps.avi

Upvotes: 1

Related Questions