[MEncoder-users] How to repackage MP4 files to avi container?

Grozdan neutrino8 at gmail.com
Sat May 15 04:16:43 CEST 2010

On Sat, May 15, 2010 at 3:58 AM, Miroslav Rovis <m.rovis at inet.hr> wrote:
> Hash: SHA1
>> > Hi!
>> > And it is true that sync can often best be gotten back with the use of
>> > MP4Box, as Grozdan explained.
>> > ...
>> > mencoder  -audiofile file.aac  -oac copy  -ovc copy file_fromMP4.avi
>> > - -o file.avi
>> > errors out. Like this:
>> I would surely NOT recommend going from mp4 -> avi, especially if
>> you're putting h264 video in it. ...
> I see. I really missed a little understanding here. But not all the
> way though. Here's why:
>> Avi is only good for intermediate container when dealing with h264
>> video...
> As intermediate container. Right! Not permanent (although it wouldn't
> rot away nor rust would it :-) .... )

Yes, intermediate, which means you mux it to another container right
away and don't let it rot somewhere in a folder for many months, or
even years.

> And that is what I thought I needed it for... MPlayer, as the authors
> say (or maybe said, well, at least used to say), does wonders with
> exactly avi files.
> As intermediate, not final every-program-plays-it container...

The fact that mplayer deals well with avi files is no excuse or
argument to store h264 videos in them. As I said earlier, avi has many
shortcomings when it comes to storing modern video codecs in it. It is
just a bad container for that and everyone will tell you the same. But
if you want to go against the stream and ignore warnings, hey who am I
to argue? :)

mplayer doesn't only deal well with avi files, it deals well with mp4,
mkv, ts, ogm, you name it.

>> You said mp4 is not the best of formats. Do you think avi is one (or
>> better than mp4)? If so, you surely need to educate yourself on that
>> topic.
> Sure. You're right. The problem, Grozdan, that I often have with mp4,
> is bad sync, and when I store h264/aac into avi files, the sync is
> just right, or not too bad...

That's not related to the mp4 container itself, but to crappy muxing
and/or encoding. Remuxing it to avi won't magically fix the sync,
unless you manually adjust it

> So that is what made me think about using avi. For another thing, here:
>> Avi is a very basic container and it doesn't even support some
>> important parts of modern video codecs. This combined with some ugly
>> hacks added to support modern stuff, makes it even more shitty. Not to
>> mention its overhead compared to more modern containers like mkv & mp4
> I know now more or less that it is so. The problem is, I am not at all
> yet familiar with so many other issues in the encoding business, and I
> haven't learned how to use Matroska properly....

It's no different than mp4. If you want to remux your mp4s to mkvs, just do

mkvmerge file.mp4 -o output.mkv

Again, if the original has sync issues, remuxing to another container
won't magically fix it unless you manually adjust the sync, which
mkvmerge and mp4box allow to do that

> I have kind of authored one, completely rudimentally, totally
> basic-skills-only, DVD using the profuse ways MPlayer can treat avi
> files, and at the moment, that is the utmost I have been able to
> achieve in this business technically and artistically.... After all
> I'm over 50, not much hope for me ;-) E.g.: I haven't even yet been
> able to understand how to manipulate subtitles... So be easy on me!
> And thank you for your insight! I would certainly like to understand
> these three points:
> 1) Can MPlayer manipulate/reencode/whater mkv files as potently as it
> does with avi files?

No, mplayer is a video player. It has no encoding capabilities. Use
mencoder or ffmpeg for that

> and
> 2) Can it do as well with MP4 files? And can the sync problems grow
> with these (upon further manipulating), more than with the avi files?
> I think you are right... But that's a handful right now, for me, to
> plain learn this Matroska business...

Yes and yes. Sync can grow is the file is somehow badly encoded and
mencoder isn't able to compensate. It depends on the file and its

> So:
> 3) If I keep just the intermediate avi container format, can AAC and
> H264 still be put just back into avi file, as they were produced in an
> avi file container when mplayer encoded them, like I tried to put them
> "back in" in my previous post, or is it really a crap idea and nothing
> else...

Yes it can, but I wouldn't recommend it. Still, if you want to do
that, try avidemux

> I just don't know.... Bear with me.
> Argh, that's it....
> Thanks.
> Miro
> Version: GnuPG v2.0.14 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> iEYEARECAAYFAkvt/9MACgkQ5NaGZVDan0owHwCdEwieBXec5M0/FregfwGjvSD6
> =GgNf
> _______________________________________________
> MEncoder-users mailing list
> MEncoder-users at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users

More information about the MEncoder-users mailing list