Converting mkv from MakeMKV to avi with mencoder
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Forum, I know this question has been asked 41,200,000 times because when I Google "mencoder convert mkv to avi" I get 41,2000,000 hits. However none of the answers I've seen are working for me. I have ripped a movie (Underworld Evolution) with MakeMKV because mplayer was giving me errors probably due to the encryption Sony used on the disc. I now have a beautiful quality 720x480 which is just over 4GB in size. I now want to convert that video and English audio stream to AVI so I can watch on my Android tablet. However I've been completely unsuccessful finding the right mencoder commandline combinations. I either get audio that is off from the video (when I rip the audio to a separate wav file) or the conversion stops with messages like "too many audio packets in buffer (4096 in 7340032 bytes)". I've tried this now on two different Linux machines - a 32- bit and a 64-bit system. Here is some info on the MKV from mplayer that may help to solve this: [lavf] stream 0: video (mpeg2video), -vid 0 [lavf] stream 1: audio (ac3), -aid 0, -alang eng, 3/2+1 [lavf] stream 2: audio (ac3), -aid 1, -alang fre, 3/2+1 [lavf] stream 3: subtitle (dvdsub), -sid 0, -slang eng [lavf] stream 4: subtitle (dvdsub), -sid 1, -slang fre VIDEO: [MPG2] 720x480 0bpp 29.970 fps 9800.0 kbps (1196.3 kbyte/s) [root@localhost /root]# mplayer -identify Underworld_Evolution.mkv MPlayer 1.1-4.3.0 (C) 2000-2012 MPlayer Team Playing Underworld_Evolution.mkv. libavformat version 54.6.101 (internal) libavformat file format detected. ID_CHAPTER_ID=0 ID_CHAPTER_0_START=0 ID_CHAPTER_0_END=585552 ID_CHAPTER_0_NAME=Chapter 00 ID_CHAPTER_ID=1 ID_CHAPTER_1_START=585552 ID_CHAPTER_1_END=740406 ID_CHAPTER_1_NAME=Chapter 01 ID_CHAPTER_ID=2 ID_CHAPTER_2_START=740406 ID_CHAPTER_2_END=937937 ID_CHAPTER_2_NAME=Chapter 02 ID_CHAPTER_ID=3 ID_CHAPTER_3_START=937937 ID_CHAPTER_3_END=1037403 ID_CHAPTER_3_NAME=Chapter 03 ID_CHAPTER_ID=4 ID_CHAPTER_4_START=1037403 ID_CHAPTER_4_END=1391357 ID_CHAPTER_4_NAME=Chapter 04 ID_CHAPTER_ID=5 ID_CHAPTER_5_START=1391357 ID_CHAPTER_5_END=1770602 ID_CHAPTER_5_NAME=Chapter 05 ID_CHAPTER_ID=6 ID_CHAPTER_6_START=1770602 ID_CHAPTER_6_END=2027526 ID_CHAPTER_6_NAME=Chapter 06 ID_CHAPTER_ID=7 ID_CHAPTER_7_START=2027526 ID_CHAPTER_7_END=2337502 ID_CHAPTER_7_NAME=Chapter 07 ID_CHAPTER_ID=8 ID_CHAPTER_8_START=2337502 ID_CHAPTER_8_END=2477809 ID_CHAPTER_8_NAME=Chapter 08 ID_CHAPTER_ID=9 ID_CHAPTER_9_START=2477809 ID_CHAPTER_9_END=2611275 ID_CHAPTER_9_NAME=Chapter 09 ID_CHAPTER_ID=10 ID_CHAPTER_10_START=2611275 ID_CHAPTER_10_END=2840538 ID_CHAPTER_10_NAME=Chapter 10 ID_CHAPTER_ID=11 ID_CHAPTER_11_START=2840538 ID_CHAPTER_11_END=2951315 ID_CHAPTER_11_NAME=Chapter 11 ID_CHAPTER_ID=12 ID_CHAPTER_12_START=2951315 ID_CHAPTER_12_END=3403433 ID_CHAPTER_12_NAME=Chapter 12 ID_CHAPTER_ID=13 ID_CHAPTER_13_START=3403433 ID_CHAPTER_13_END=3599796 ID_CHAPTER_13_NAME=Chapter 13 ID_CHAPTER_ID=14 ID_CHAPTER_14_START=3599796 ID_CHAPTER_14_END=3788318 ID_CHAPTER_14_NAME=Chapter 14 ID_CHAPTER_ID=15 ID_CHAPTER_15_START=3788318 ID_CHAPTER_15_END=3948445 ID_CHAPTER_15_NAME=Chapter 15 ID_CHAPTER_ID=16 ID_CHAPTER_16_START=3948445 ID_CHAPTER_16_END=4034197 ID_CHAPTER_16_NAME=Chapter 16 ID_CHAPTER_ID=17 ID_CHAPTER_17_START=4034197 ID_CHAPTER_17_END=4231594 ID_CHAPTER_17_NAME=Chapter 17 ID_CHAPTER_ID=18 ID_CHAPTER_18_START=4231594 ID_CHAPTER_18_END=4422618 ID_CHAPTER_18_NAME=Chapter 18 ID_CHAPTER_ID=19 ID_CHAPTER_19_START=4422618 ID_CHAPTER_19_END=4557520 ID_CHAPTER_19_NAME=Chapter 19 ID_CHAPTER_ID=20 ID_CHAPTER_20_START=4557520 ID_CHAPTER_20_END=4636632 ID_CHAPTER_20_NAME=Chapter 20 ID_CHAPTER_ID=21 ID_CHAPTER_21_START=4636632 ID_CHAPTER_21_END=4817479 ID_CHAPTER_21_NAME=Chapter 21 ID_CHAPTER_ID=22 ID_CHAPTER_22_START=4817479 ID_CHAPTER_22_END=4885881 ID_CHAPTER_22_NAME=Chapter 22 ID_CHAPTER_ID=23 ID_CHAPTER_23_START=4885881 ID_CHAPTER_23_END=5129491 ID_CHAPTER_23_NAME=Chapter 23 ID_CHAPTER_ID=24 ID_CHAPTER_24_START=5129491 ID_CHAPTER_24_END=5322818 ID_CHAPTER_24_NAME=Chapter 24 ID_CHAPTER_ID=25 ID_CHAPTER_25_START=5322818 ID_CHAPTER_25_END=5530692 ID_CHAPTER_25_NAME=Chapter 25 ID_CHAPTER_ID=26 ID_CHAPTER_26_START=5530692 ID_CHAPTER_26_END=5753514 ID_CHAPTER_26_NAME=Chapter 26 ID_CHAPTER_ID=27 ID_CHAPTER_27_START=5753514 ID_CHAPTER_27_END=6382960 ID_CHAPTER_27_NAME=Chapter 27 ID_VIDEO_ID=0 [lavf] stream 0: video (mpeg2video), -vid 0 ID_AUDIO_ID=0 ID_AID_0_LANG=eng ID_AID_0_NAME=3/2+1 [lavf] stream 1: audio (ac3), -aid 0, -alang eng, 3/2+1 ID_AUDIO_ID=1 ID_AID_1_LANG=fre ID_AID_1_NAME=3/2+1 [lavf] stream 2: audio (ac3), -aid 1, -alang fre, 3/2+1 ID_SUBTITLE_ID=0 ID_SID_0_LANG=eng [lavf] stream 3: subtitle (dvdsub), -sid 0, -slang eng ID_SUBTITLE_ID=1 ID_SID_1_LANG=fre [lavf] stream 4: subtitle (dvdsub), -sid 1, -slang fre VIDEO: [MPG2] 720x480 0bpp 29.970 fps 9800.0 kbps (1196.3 kbyte/s) Clip info: creation_time: 2013-03-13 16:11:22 ID_CLIP_INFO_NAME0=creation_time ID_CLIP_INFO_VALUE0=2013-03-13 16:11:22 ID_CLIP_INFO_N=1 Load subtitles in ./ ID_FILENAME=Underworld_Evolution.mkv ID_DEMUXER=lavfpref ID_VIDEO_FORMAT=MPG2 ID_VIDEO_BITRATE=9800000 ID_VIDEO_WIDTH=720 ID_VIDEO_HEIGHT=480 ID_VIDEO_FPS=29.970 ID_VIDEO_ASPECT=1.7771 ID_AUDIO_FORMAT=8192 ID_AUDIO_BITRATE=448000 ID_AUDIO_RATE=48000 ID_AUDIO_NCH=6 ID_START_TIME=0.01 ID_LENGTH=6382.96 ID_SEEKABLE=1 ID_CHAPTERS=28 ==================================================================== ====== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family libavcodec version 54.23.100 (internal) Selected video codec: [ffmpeg2] vfm: ffmpeg (FFmpeg MPEG-2) ==================================================================== ====== ID_VIDEO_CODEC=ffmpeg2 ==================================================================== ====== Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders AUDIO: 48000 Hz, 2 ch, s16le, 448.0 kbit/29.17% (ratio: 56000-
192000) ID_AUDIO_BITRATE=448000 ID_AUDIO_RATE=48000 ID_AUDIO_NCH=2 Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3) ==================================================================== ====== AO: [oss] 48000Hz 2ch s16le (2 bytes per sample) ID_AUDIO_CODEC=ffac3 Starting playback... Movie-Aspect is 1.78:1 - prescaling to correct movie aspect. ID_VIDEO_ASPECT=1.7771 VO: [xv] 720x480 => 852x480 Planar YV12
And here are some of my unsuccessful attempts to convert it: # mencoder Underworld_Evolution.mkv -oac mp3lame -ovc copy -o Underworld_Evolution.avi # mencoder -ffourcc divx -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=6000 -audiofile audio.wav -oac mp3lame - vf crop=720:352:0:62,yadif -nosub -lameopts vbr=3 -o Underworld_Evolution.avi Underworld_Evolution.mkv # mencoder -ovc copy -oac mp3lame -lameopts br=192:cbr:mode=0 -aid 0 -alang eng -vf crop=720:352:0:62,yadif -lameopts vol=3 -nosub -o Underworld_Evolution.avi Underworld_Evolution.mkv -----BEGIN PGP SIGNATURE----- Charset: UTF8 Version: Hush 3.0 Note: This signature can be verified at https://www.hushtools.com/verify wkYEARECAAYFAlFA2tUACgkQRBFe1uc9INo8EQCguXoUq71g/8eQp/tGBiyVXKcFjtMA nR93/Aww94gI3eTDpmhefaGfO6Zk =o4Os -----END PGP SIGNATURE-----
On Wed, Mar 13, 2013 at 04:00:21PM -0400, securehell@hushmail.com wrote:
combinations. I either get audio that is off from the video (when I rip the audio to a separate wav file) or the conversion stops with messages like "too many audio packets in buffer (4096 in 7340032 bytes)".
A almost hard rule: always use -noskip -mc 0 if you use -ovc copy.
# mencoder -ffourcc divx -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=6000 -audiofile audio.wav -oac mp3lame - vf crop=720:352:0:62,yadif -nosub -lameopts vbr=3 -o Underworld_Evolution.avi Underworld_Evolution.mkv
Hm, did you try that variant without splitting the audio out first? Though you should probably add ",softskip" right after "yadif" to ensure the yadif filter will see all frames.
On 3/13/13 3:00 PM, "securehell@hushmail.com" <securehell@hushmail.com> wrote:
# mencoder Underworld_Evolution.mkv -oac mp3lame -ovc copy -o Underworld_Evolution.avi
# mencoder -ffourcc divx -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=6000 -audiofile audio.wav -oac mp3lame - vf crop=720:352:0:62,yadif -nosub -lameopts vbr=3 -o Underworld_Evolution.avi Underworld_Evolution.mkv
# mencoder -ovc copy -oac mp3lame -lameopts br=192:cbr:mode=0 -aid 0 -alang eng -vf crop=720:352:0:62,yadif -lameopts vol=3 -nosub -o Underworld_Evolution.avi Underworld_Evolution.mkv
I don't think any robust conversion of any commercial title can be accomplished without some method of pullup. I would prefer to work on the full-size MakeMKV rip if it's Blu-ray. Anyway, what happens if you use Reimar's suggestion along with removing yadif and including the following at the beginning of the filter chain along with "-fps 30000/1001 -ofps 24000/1001" for i/o? filmdint=fast=0,softskip If you see a bunch of bottom frame warnings you can add this before the first comma: /sad_thres=512 Also, before giving up, I would make one more attempt substituting "-mc 0.1" for "-mc 0". I haven't been able to precisely predict which of the two of those will work, but often if 0 won't work, 0.1 will. You may also want to try the above variations both with and without -noskip. If you get smooth 24 fps but the audio is still off, try to determine whether the audio sync problem is progressive or whether it's simply a result of incorrect offset. If it's just early or late, you can fix it quickly with ffmpeg. If it's progressive within the range of a second or so, you'll have to stretch or compress the duration of the audio, which can be done with a sox and ffmpeg pipe that has been explained on this list before. Laine Lee
participants (3)
-
L. Lee -
Reimar Döffinger -
securehell@hushmail.com