Web Projects Freelancer

Fixing Wrong or Different Frame Rate of a Video File and Container

WARNING!
This article is deprecated.
A newer article either has been already published or is going to be published within the nearest days.

The problem is seen well when you get video file information with ffmpeg:

It will show something like:

[sourcecode lang="plain"]
Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 25.00 (25/1)
Input #0, avi, from ‘[bad_file].avi':
Duration: 01:06:42.20, start: 0.000000, bitrate: 1466 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 608×320 [PAR 1:1 DAR 19:10], 25.00 tb(r)
Stream #0.1: Audio: mp3, 44100 Hz, stereo, s16, 160 kb/s
[/sourcecode]

The files like the above do not play at my WDTV device and re-encoding them in a normal way with Avidemux or HandBrake leads to some funny results.

To salvage files like these I take the following steps (though there is a zillion ways if doing that better than me).

1. Rip audio

2. Encode audio (I prefer AAC encoder from Nero):

3. Rip and encode video with ffmpeg (I prefer x264 codec):

Hint: choose a 15-20% lower bitrate than original (in our case above: -b 1400000).

4. Mux together into a nice matroska file

5. Cleanup

Enjoy. And please do not use packed bitstream any more, it’s ugly.

One thought on “Fixing Wrong or Different Frame Rate of a Video File and Container

  1. JohnF

    I have a slightly simpler process, though I wish/hope there is a way to do it without using two tools.

    Remux with mplayer:

    mencoder -oac copy -ovc copy source.file -o source.avi

    Then remux with ffmpeg:

    ffmpeg -vcodec copy -acodec copy -o source.avi source.mp4

    Interestingly, it still reports the same error message, though it does remux into a proper mp4 container.

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">