[FFmpeg-user] MJPEG/avi encoding to H.264/mp4 and retaining original frame times

Carl Eugen Hoyos ceffmpeg at gmail.com
Thu Oct 26 00:40:46 EEST 2017

2017-10-25 22:59 GMT+02:00 Aviv Hurvitz <aviv.hurvitz at gmail.com>:
> I have an USB3 camera module that outputs an MJPEG stream.
> I recorded it with “-v:c copy” argument  to an avi file.

This records a variable frame rate file because your camera -
most likely - is unable to keep constant frame rate.

> Now I want to reencode it to a more compact file in h264/mp4
> format.  If I do that with default arguments, I get a file with more
> frames than the original!

FFmpeg is unable to write - valid - variable frame rate mp4 files, I
suggest you output to mkv.

> Also the FPS – as reported by VLC – is 40 fps whereas I know I
> was recording at about 15 fps (approximately, it varies based on
> lighting in this camera)

Yes, it varies indicating variable frame rate.

Carl Eugen

(Yes, of course: avi does record timestamps, if it would not, you
would not see duplicated frames)

More information about the ffmpeg-user mailing list