[MEncoder-users] How to convert mkv to mkv?

Carlo Wood carlo at alinoe.com
Thu Jun 28 02:58:51 CEST 2007


Hi, I am trying to decrease a large mkv file
to something smaller.

After putting many hours into reading documentation
and howto's and searching the web, reading even more
webpages... I came up with the following commandline:

$ mencoder the.matrix.1999.dvd9.720p.hddvd.x264-hv.mkv -vf crop=1254:528:13:0,scale=608:256,hqdn3d=2:1:2 -mc 0 -noskip -ofps 24000/1001 -oac copy -ovc x264 -x264encopts subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b:bitrate=3697:pass=1 -o /dev/null
MEncoder dev-SVN-rUNKNOWN-4.1.2 (C) 2000-2006 MPlayer Team
CPU: Intel(R) Core(TM)2 Quad CPU           @ 2.66GHz (Family: 6, Model: 15, Stepping: 7)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE SSE2

success: format: 0  data: 0x0 - 0xfc7a32fa
[mkv] Track ID 1: video (V_MPEG4/ISO/AVC) "The Matrix", -vid 0
[mkv] Track ID 2: audio (A_AC3) "AC3 5.1", -aid 0, -alang eng
[mkv] Will play video track 1.
Matroska file format detected.
VIDEO:  [avc1]  1280x528  24bpp  23.976 fps    0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:31  fourcc:0x31637661  size:1280x528  fps:23.98  ftime:=0.0417
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [hqdn3d=2:1:2]
Opening video filter: [scale w=608 h=256]
Opening video filter: [crop w=1254 h=528 x=13 y=0]
Crop: 1254 x 528, 13 ; 0
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
audiocodec: framecopy (format=2000 chans=6 rate=48000 bits=16 B/s=16000 sample-1536)
VDec: vo config request - 1280 x 528 (preferred colorspace: Planar YV12)
VDec: using Planar I420 as output csp (no 1)
Movie-Aspect is undefined - no prescaling applied.
SwScaler: reducing / aligning filtersize 10 -> 12
SwScaler: reducing / aligning filtersize 10 -> 12
SwScaler: reducing / aligning filtersize 10 -> 9
SwScaler: reducing / aligning filtersize 10 -> 9
[swscaler @ 0x7f8360]SwScaler: BICUBIC scaler, from yuv420p to yuv420p using MMX2
[swscaler @ 0x7f8360]SwScaler: using n-tap MMX scaler for horizontal luminance scaling
[swscaler @ 0x7f8360]SwScaler: using n-tap MMX scaler for horizontal chrominance scaling
[swscaler @ 0x7f8360]SwScaler: using n-tap MMX scaler for vertical scaling (YV12 like)
[swscaler @ 0x7f8360]SwScaler: 1254x528 -> 608x256
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities MMX MMXEXT SSE SSE2
New_Face failed. Maybe the font path is wrong.
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
Writing header...5f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
ODML: vprp aspect is 16384:6898.
Setting audio delay to 0.096s.
Writing header...
ODML: vprp aspect is 16384:6898.
Setting audio delay to 0.096s.
Pos:   5.3s    131f ( 0%) 11.65fps Trem:   0min   0mb  A-V:0.000 [4741:128]

This seems to work, but it stops after processing about 1%.
When I run it again (with pass=2), only the first minute of
the movie is processed (looks fine), and only the first part
has sound: there is sound during ... heh, sorry, I am not
native English... in the beginning you see those logo's of
the movie makers, then there is sound. As soon as the movie
starts, there is no sound anymore.

Also, I get a warning somewhere (it is not printed above -
I think I get it with pass=2) that it is encoding to AVI.
How can I get it to use the same enconding that is in
the original mkv? I thought avi doesn't have variable bitrate
and stuff - only the new x264 supports that.

Hmm, I now note that it prints some kind of error. It stops
with this message:

Pos: 130.7s   3138f ( 1%) 13.09fps Trem: 220min 3074mb  A-V:0.000 [3377:127]
Too many audio packets in the buffer: (3277 in 8389120 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.

Flushing video frames.
Writing index...
Writing header...
ODML: vprp aspect is 16384:6898.
Setting audio delay to 0.096s.

Video stream: 3375.564 kbit/s  (421945 B/s)  size: 55189345 bytes  130.797 secs  3138 frames

Audio stream:  128.000 kbit/s  (15999 B/s)  size: 2104320 bytes  131.520 secs
x264 [info]: slice I:23    Avg QP:10.61  size: 25541
x264 [info]: slice P:1613  Avg QP:11.56  size: 22815
x264 [info]: slice B:1500  Avg QP:12.50  size: 11867
x264 [info]: mb I  I16..4: 38.9% 30.5% 30.7%
x264 [info]: mb P  I16..4:  6.7%  8.7%  6.1%  P16..4: 33.1% 17.0%  9.7%  4.3%  3.5%    skip:11.0%
x264 [info]: mb B  I16..4:  1.4%  1.0%  1.0%  B16..8: 23.3%  5.4% 19.3%  direct:17.0%  skip:31.5%
x264 [info]: final ratefactor: 7.70
x264 [info]: 8x8 transform  intra:38.7%  inter:26.3%
x264 [info]: ref P  73.3% 12.6%  6.5%  4.1%  3.4%
x264 [info]: ref B  76.2% 12.9%  5.2%  3.2%  2.5%
x264 [info]: kb/s:3375.5

If this is an avi thing - then the main question is thus:
How can I get it to encode to the same mkv format as the original?

The original has:

[mkv] Found the head...
[mkv] + a segment...
[mkv] /---- [ parsing seek head ] ---------
[mkv] /---- [ parsing seek head ] ---------
[mkv] \---- [ parsing seek head ] ---------
[mkv] /---- [ parsing cues ] -----------
[mkv] \---- [ parsing cues ] -----------
[mkv] \---- [ parsing seek head ] ---------
[mkv] |+ segment information...
[mkv] | + timecode scale: 1000000
[mkv] | + duration: 8177.824s
[mkv] |+ segment tracks...
[mkv] | + a track...
[mkv] |  + Track number: 1
[mkv] |  + Track type: Video
[mkv] |  + Default flag: 1
[mkv] |  + Codec ID: V_MPEG4/ISO/AVC
[mkv] |  + CodecPrivate, length 167
[mkv] |  + Default duration: 41.708ms ( = 23.976 fps)
[mkv] |  + Language: eng
[mkv] |  + Name: The Matrix
[mkv] |  + Video track
[mkv] |   + Pixel width: 1280
[mkv] |   + Pixel height: 528
[mkv] |   + Display width: 1280
[mkv] |   + Display height: 532
[mkv] | + a track...
[mkv] |  + Track number: 2
[mkv] |  + Track type: Audio
[mkv] |  + Default flag: 1
[mkv] |  + Codec ID: A_AC3
[mkv] |  + Default duration: 32.000ms ( = 31.250 fps)
[mkv] |  + Language: eng
[mkv] |  + Name: AC3 5.1
[mkv] |  + Audio track
[mkv] |   + Sampling frequency: 48000.000000
[mkv] |   + Channels: 6
[mkv] |+ found cluster, headers are parsed completely :)

Regards,
-- 
Carlo Wood <carlo at alinoe.com>



More information about the MEncoder-users mailing list