To ensure you have a "bad-style" MPEG-4 AVI file, you can check it with a media analyzer utility like MediaInfo (in this case, it'll show you something like "Muxing mode : Packed bitstream").
Fortunately, that wrong thing is easy to "unpack" with an up-to date version of FFmpeg (v2.7+):
$ ffmpeg -i in_bad.avi -codec copy -bsf:v mpeg4_unpack_bframes out_good.avi
BTW, after "bitstream unpacking", the MPEG-4 video stream becomes standards-compliant, so you can put it directly into the popular MP4 container without transcoding (but it requires the audio stream to be MP4-compatible too, e. g. MP3 is OK);
e. g., here are
$ ffmpeg -i in10_good.avi -codec copy out10_good.mp4
$ ffmpeg -i in20_bad.avi -codec copy -bsf:v mpeg4_unpack_bframes out20_better.mp4
$ ffmpeg -i in20_bad.avi -codec copy -bsf:v mpeg4_unpack_bframes -movflags faststart out25_best.mp4
You can download the source code and binary builds of the current FFmpeg (for MS Windows, Apple Mac OS X and Linux) freely from the official site.
Usually, you will find a compatible version in the repositories of your favorite Linux distribution;
however, in Debian, it's available only starting from the release 9 "Stretch" (and fortunately, it's currently in the backports for 8 "Jessie" too; and for use in Ubuntu, you need release 15.10 "Wily Werewolf", at least):
# sudo apt-get install ffmpeg
References:
- FFmpeg
- MediaInfo
- Debian Package Tracker - ffmpeg
- ffmpeg package : Ubuntu
- Wikipedia
---
Last updated: 2017-12-28
Last updated: 2017-12-28