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

Miroslav Rovis m.rovis at inet.hr
Sat May 29 04:48:29 CEST 2010

Hash: SHA1

>> Von: Grozdan neutrino8 at gmail.com 15. Mai 2010, 14:53:29 Uhr
>> ... They have the same man page because they both share the same
>> demuxers, muxers, filters, etc. Whatever mplayer can play,
>> mencoder can encode it _______________________________
>> But as far as I am informed this is right for encoding, but for
>> muxing?
>> Isn't it still impossible to mux the encoded audio/vidio into
>> other container but avi because -lavf muxing is still broken?
> For muxing, the most reliable container for mencoder are both AVI
> and MPEG PS (-of mpeg). You can get valid files with -of lavf in
> some cases but not always. If you don't use b-frames for encoding
> (or the file you're trying to remux with mencoder doesn't have
> b-frames) you can create valid files with -of lavf. Otherwise, stay
> away from it and use 3rd party tools
This is in view of the earlier discussion on the subject of containers
avi and mp4/mkv, days, and weeks, ago.
Maybe not so much related to the above muxing issue, at least not
directly related anyway.
Basically, I am doing my best to archive my videos in mp4 and/or
Matroska format. Grozdan was right of course. I guess mp4/mkv is the
way to go, as it will remain the format for the longer term future.
But I just still haven't solved the sync problem that by virtue of
evidence pushed me into asking that stupid question in the subject
line: "How to repackage MP4 files to avi container?" on this list.
Doing H264/AAC encoding, mostly the intermediate avi's and the final
mp4/mkv are just well synced and fine altogether. But occasionally I
get fine synced avi's, but the mp4's and/or mkv's that I repackage
from avi's have serious sync issues.
The thing is, the delay even isn't linear!
FILE.avi is the intermediate H264/AAC encoded video with the audio
synced just right.
MP4Box -aviraw..., -add etc. and I get FILE.mp4. mkvmerge and I
repackage it into FILE.mkv (works for most other h264/aac avi's I encode).
mplayer FILE.mkv
And I figured out it was nearly 4 sec late the audio on 5148 sec
overall length. Reading man mkvmerge, I did:

mkvmerge -A FILE.mkv -y 0:0,128600/128683 FILE.aac  -o FILE_TRY01.mkv

Now the problem is FILE_TRY01.mkv is well synced only at beginning and
at end, but towards the middle it reaches still approx. 0.300 to 0.500
sec out of sync.
I remind here that avi itself is synced just right throughout the
Does anyone have any ideas what should by tried in this situation?

Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the MEncoder-users mailing list