[MEncoder-users] I want to mux my x264 file to mkv...

Fredrik Eriksson feffese at yahoo.se
Fri Sep 23 18:26:30 CEST 2005


Fredrik Eriksson wrote:

> Hello.
>
> I made a x264 video file with mencoder using this command (only 
> writing the third and last pass):
>
> ------<<<<CODE START>>>>------
>
> $ mencoder-cvs -dvd-device dvd.iso -oac faac -ovc x264 -vf 
> pullup,softskip,crop=704:480:8:0,hqdn3d=6:4:2 -ofps 24000/1001 
> -channels 5 -faacopts br=192:tns:cutoff=0 -x264encopts 
> subq=6:frameref=6:me=3:4x4mv:bframes=3:b_adapt:b_pyramid:qcomp=0.7:keyint=300:8x8dct:pass=3:bitrate=1300 
> dvd://1 -chapter 1-1 -o file.avi
>
> ------<<<<CODE END>>>>------
>
> the file looks good (although the audio appears to be a bit out of 
> sync). However, I want to mux this into a matroska file (mainly to be 
> able to add subtitles to it), but mkvmerge refuses:
>
> ------<<<<CODE START>>>>------
>
> $ mkvmerge -o file.mkv --atracks 1 --vtracks 0 file.avi
> 'file.avi': Using the AVI demultiplexer. Opening file. This may take 
> some time depending on the file's size.
> At the moment mkvmerge does not support converting from VfW-mode 
> AVC/h.264 tracks to native Matroska-mode AVC/h.264 tracks. You can, 
> however, first import the video track into a MP4 file with e.g. 
> 'MP4Box' (use Google). Then you can use mkvmerge and put the video 
> into a Matroska file.
> If you really know what you are doing then you can force mkvmerge to 
> put this AVC/h.264 track into a Matroska file even in VfW mode if you 
> add '--engage allow_avc_in_vfw_mode' to the command line. You can do 
> that in mmg with the 'Add command line options' menu entry in the 
> 'Muxing' menu.
>
> ------<<<<CODE END>>>>------
>
> using '--engage allow_avc_in_vfw_mode' creates a broken file, so I try 
> MP4Box:
>
> ------<<<<CODE START>>>>------
>
> $ MP4Box -add file.avi file.mp4
> Video format h264 not supported - recompress the file first
> Error: Feature Not SupportedError importing file.avi: Feature Not 
> Supported
>
> ------<<<<CODE END>>>>------
>
> I also tried to get mencoder to put this in a mp4 file with -of lavf 
> and -lavfopts format=mp4, but this creates a broken file as well; 
> mplayer crashes after a few seconds when I play it, and mkvmerge says 
> it doesn't recognize the codec.
> So, am I doing something wrong or is it just impossible to mux x264 
> files created by mencoder to matroska?
>
> Thank you.

OK I got this one worked out, although it's very lengthy. I have to dump 
the videostream, but for some reason -dumpvideo in mplayer didn't work, 
so I had to use -of rawvideo in mencoder. Then the file must be named 
*.h264 or *.264, and then it can be remuxed to a .mp4 file with MP4Box, 
and then I can convert the mp4 file to matroska...

well, if someone has the knowledge and some time to spare; a matroska 
muxer in mencoder would be greatly appreciated. Would like to help 
myself, but unfortunatly I don't think 3 weeks experience in C 
programming is enough... and I doubt that you would be happy with a 
muxer written in java ;)




More information about the MEncoder-users mailing list