INDEX  F.A.Q.  SEARCH  LATEST POSTS     Rules  Register  Profile  Private messages  Login


Search all forums or this forum: Advanced search
How to convert MKV to AVI or OGM to AVI using mencoder

Forum Index -> How to's -> User guides Printer-friendly version
Goto page 1, 2, 3  Next
Reply to topic
Author Message
Baldrick
Administrator


Joined: 09 Aug 2000
Location: Sweden

Post Posted: May 17, 2005 07:15 Posts Comp View users profile Send private message Reply with quote

mencoder is very useful for converting between different container formats. It is a command line tool so it is not super easy to use for us lazy newbies. smile.gif

How to convert from OGM to AVI or MKV to AVI with mp3 audio and leave the video source intact.
If the OGM or MKV already has a video that can be stored in AVI like DivX or XviD you only need to copy it. Use gspot to identify the video codec in the ogm,mkv.

How to convert from OGM to AVI or MKV to AVI with mp3 audio and xvid video.
If you want to convert the audio to mp3 and the video to xvid in an avi.


How to convert from OGM to AVI or MKV to AVI with mp3 audio and leave the video source intact.
Download mencoder for windows, http://www1.mplayerhq.hu/MPlayer/releases/win32-beta/MPlayer-mingw32-1.0pre7.zip
Extract all files to a folder on your hd.
Open a Command prompt from Start->Accessories->Command prompt
Type
"C:\Program Files\mplayer\mencoder.exe" "c:\video\video.ogm" -oac mp3lame -ovc copy -o "c:\video\videooutput.avi"


Explanation:

"C:\Program Files\mplayer\mencoder"
The location to the mencoder.exe

"c:\video\video.ogm"
The video ogm or mkv video source

-oac mp3lame
Convert the audio to mp3

-ovc copy
Copy the video, no reconverting

-o "c:\video\videooutput.avi"
Where to output the file and the new video name

Hit enter to start converting


Done!



How to convert from OGM to AVI or MKV to AVI with mp3 audio and xvid video .
Same as above but change the
-ovc copy
to
-ovc xvid -xvidencopts pass=1

so it will be
"C:\Program Files\mplayer\mencoder.exe" "c:\video\video.ogm" -oac mp3lame -ovc xvid -xvidencopts pass=1 -o "c:\video\videooutput.avi"


Explanation:
-ovc xvid -xvidencopts pass=1
Xvid video codec and one pass encoding
You can also add video bitrate if you like,
-ovc xvid -xvidencopts pass=1 bitrate=1000


Soopafresh
Craptastic


Joined: 01 Jan 2004
Location: United States

Post Posted: May 17, 2005 20:25 Posts Comp View users profile Send private message Reply with quote

Nice one ! I love command line utilities. Thanks.

OutlawSpark
Member


Joined: 22 May 2005
Location: USA

Post Posted: May 25, 2005 01:00 Posts Comp View users profile Send private message Reply with quote

Here are a few questions with this:

How do I use it for a file with multiple audio tracks?

And just how big can the file you are converting can be?

What are the commands that would allow me to launch or save it to a different drive?

Thanks. I always come here for my conversion needs.


Baldrick
Administrator


Joined: 09 Aug 2000
Location: Sweden

Post Posted: Jun 15, 2005 10:37 Posts Comp View users profile Send private message Reply with quote

Quote:
How do I use it for a file with multiple audio tracks?

No idea, it is probably possible but I haven't done that much mencoding.

Quote:
And just how big can the file you are converting can be?

Adjust the bitrate, use a bitrate calculator to calculate.

Quote:
What are the commands that would allow me to launch or save it to a different drive?

Change the drive letter, like d:\video.avi


celtic_druid
Member


Joined: 07 Dec 2004
Location: Australia

Post Posted: Jun 15, 2005 20:30 Posts Comp View users profile Send private message Reply with quote

Use -aid # or -alang eng if it is tagged properly to specify which track to convert. The second track you would have to process seperatly like say.
mplayer -ao:pcm:file=track2.wav -vo null -vc dummy -aid 2 input.mkv
To extract the 2nd stream, then use mencoder with -aid 1.

Also use -lameencopts to change lame settings. -oac help for a list of audio compressors (pcm, ac3, etc.). -ovc help for a list of video codecs, including lossless ones.

Check the docs over at mplayerhq for full details.


rwmol
Member


Joined: 08 Feb 2005
Location: United States

Post Posted: Jun 24, 2005 22:55 Posts Comp View users profile Send private message Reply with quote

SimpleDivX uses mencoder for conversion. Only problem it converts 6 channel input to stereo. Is it possible to add a config file to the mplayer directory? If so. what would the command line be?

natrap
Member


Joined: 20 Jun 2004

Post Posted: Jul 03, 2005 21:44 Posts Comp View users profile Send private message Reply with quote

How do I batch convert a whole lot of files with Mencoder?

Jackler
Member


Joined: 03 Jul 2005
Location: USA

Post Posted: Jul 06, 2005 04:43 Posts Comp View users profile Send private message Reply with quote

Hello, im sorry to bother but Im in a hurry to format my computer and am trying to get everything onto disk. Ive an OGM file thats just a bit too big and wont fit on the disk, and found your thread/guide to converting to AVI. I followed your instructions, but to no avail. It comes up saying Cant open output file "c:\video\videooutput.avi"

Heres the log:

C:\Documents and Settings\Molly>"C:\Program Files\mplayer\mencoder.exe" "C:\Docu
ments and Settings\Molly\Desktop\ah.ogm" -oac mp3lame -ovc xvid -xvidencopts pas
s=1 -o "c:\video\videooutput.avi"
MEncoder 1.0pre7-3.4.2 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon Willamette (Family: 8, Stepping: 2)
Detected cache-line size is 64 bytes
CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled with runtime CPU detection - WARNING - this is not optimal!
To get best performance, recompile MPlayer with --disable-runtime-cpudetection.
File not found: 'frameno.avi'
Failed to open frameno.avi
success: format: 0 data: 0x0 - 0x2bed0c75
[Ogg] stream 0: video (FOURCC XVID), -vid 0
[Ogg] stream 1: audio (format 0x2000), -aid 0
[Ogg] stream 2: subtitles (SRT-like text subtitles), -sid 0
Ogg file format detected.
VIDEO: [XVID] 640x352 24bpp 23.976 fps 0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:18 fourcc:0x44495658 size:640x352 fps:23.98 ftime:=0.0417
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
No accelerated IMDCT transform found
[Ogg] Language for -sid 0 is '-slang "English[eng]"'
AC3: 5.1 (3f+2r+lfe) 48000 Hz 448.0 kbit/s
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, s16le, 448.0 kbit/29.17% (ratio: 56000->192000)
Selected audio codec: [a52] afm:liba52 (AC3-liba52)
==========================================================================
Cannot open output file 'c:\video\videooutput.avi'.
Exiting...


If you have the time, please tell me if you notice any errors or something ive done wrong. I appreciate your time.


Jackler
Member


Joined: 03 Jul 2005
Location: USA

Post Posted: Jul 09, 2005 16:50 Posts Comp View users profile Send private message Reply with quote

*bump*

Baldrick
Administrator


Joined: 09 Aug 2000
Location: Sweden

Post Posted: Jul 10, 2005 04:18 Posts Comp View users profile Send private message Reply with quote

does the c:\video folder exists?? if not create it first or use some other folder.

Jackler
Member


Joined: 03 Jul 2005
Location: USA

Post Posted: Jul 10, 2005 04:50 Posts Comp View users profile Send private message Reply with quote

ya, I set up a c:\video folder, hell I even tried putting the video.ogm and videooutput.avi in there, maybe for something to overwrite, but didnt work at all.

Jackler
Member


Joined: 03 Jul 2005
Location: USA

Post Posted: Jul 14, 2005 06:05 Posts Comp View users profile Send private message Reply with quote

*bump*

vn33
Member


Joined: 14 Aug 2000
Location: MA, USA

Post Posted: Jul 24, 2005 13:49 Posts View users profile Send private message Reply with quote

thankyou
this works a lot better than Video Cleaner


Meaghan
Member


Joined: 07 Aug 2005
Location: Canada

Post Posted: Aug 12, 2005 19:36 Posts Comp View users profile Send private message Reply with quote

Thanks for the help in converting my mkv files into avis.
.
..
...
I just have one little glitch. The subtitles were lost in the conversion. Is there anyway to keep the subtitles during the change over?

Thanks.


celtic_druid
Member


Joined: 07 Dec 2004
Location: Australia

Post Posted: Aug 12, 2005 23:09 Posts Comp View users profile Send private message Reply with quote

mplayer can demux subtitles by using say the -dumpsrtsub if they are textsubs or -dumpsub for vobsubs. See mplayer man for full details/options. Not sure if mencoder can mux subs to avi though and even if it could, external subs are more compatible anyway.

Could also just demux the subs using mkvextract.


Meaghan
Member


Joined: 07 Aug 2005
Location: Canada

Post Posted: Aug 13, 2005 15:31 Posts Comp View users profile Send private message Reply with quote

Fabulous . .. thanks

go_yy
Member


Joined: 27 Sep 2005
Location: singapore

Post Posted: Sep 30, 2005 11:09 Posts Comp View users profile Send private message Reply with quote

hi... i got prob wit mencoder.... i try to follow ur instruction to copy subtitles and i had this prob as shown below..

C:\Documents and Settings\Used>"Desktop\mplayer\mencoder.exe" "c:\Program Files\
BitComet\Downloads\school rumble1-2\[WF-KAA]_School_Rumble_02.DVD(XviD.AAC)[55F0
8DB6].mkv" -oac mp3lame -ovc xvid -xvidencopts pass=1 -dumpsub -o "c:\Documents
and Settings\Used\Desktop\test.avi"
MEncoder 1.0pre7-3.4.2 (C) 2000-2005 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Foster (Family: 8, Stepping: 7)
Detected cache-line size is 64 bytes
CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled with runtime CPU detection - WARNING - this is not optimal!
To get best performance, recompile MPlayer with --disable-runtime-cpudetection.
File not found: 'frameno.avi'
Failed to open frameno.avi
dumpsub is not an MEncoder option


can any1 help me???[/b]


chaos_maiden
Member


Joined: 01 Sep 2005
Location: US

Post Posted: Oct 10, 2005 19:21 Posts Comp View users profile Send private message Reply with quote

i am trying to use this method to convert an mkv to avi. the source uses the h264 video codec, and the audio is aac (i have both codecs installed). when i combine the video and audio streams into the avi, there is an error in the output file (frame 568). this glitch is not present in the source files, they play perfectly, while the output file crashes what ever player i use, as well as virtual dub when i attempt to put subtitles in it. does anyone know what might be causing this?

celtic_druid
Member


Joined: 07 Dec 2004
Location: Australia

Post Posted: Oct 10, 2005 22:32 Posts Comp View users profile Send private message Reply with quote

Copying native AVC to an avi could be the problem. Not really a good idea at any rate. Does the mkv use native AVC or VfW compatibility mode? Also how are you testing playback? With mplayer or something else?

chaos_maiden
Member


Joined: 01 Sep 2005
Location: US

Post Posted: Oct 10, 2005 22:41 Posts Comp View users profile Send private message Reply with quote

the mkv is vfw mode. i'm copying the video stream and converting the audio to lame mp3 (i normally use virtual dub mod, but it doesn't support aac audio). i've tried playing the file in both real player and windows media player, as well as loading the file in virtual dub, all 3 result in a program crash when it gets to that particular frame. in media player, i get an error message saying that there is an assertion error in the C++ runtime library and gives the file path for the h264 codec in ffdshow. is it possibly a problem with ffdshow?

celtic_druid
Member


Joined: 07 Dec 2004
Location: Australia

Post Posted: Oct 10, 2005 23:52 Posts Comp View users profile Send private message Reply with quote

Try playing it with mplayer.
If the mkv uses VfW for the video (not recommended or spec compliant for AVC) then remuxing to avi should be fine.

What build of ffdshow?


chaos_maiden
Member


Joined: 01 Sep 2005
Location: US

Post Posted: Oct 11, 2005 00:59 Posts Comp View users profile Send private message Reply with quote

it doesn't play in mplayer either. i tried another mkv with the same encoding on the streams and it behaves the same way. i'm using the 9/20/05 build of ffdshow.

chaos_maiden
Member


Joined: 01 Sep 2005
Location: US

Post Posted: Oct 11, 2005 19:47 Posts Comp View users profile Send private message Reply with quote

mencoder also crashes if i try to re-encode the video to xvid during the initial pass, however both the source mkv and the extracted avi stream (i used mkvextractgui for the extraction), which also use the h264 codec, playback with no problems in any player

celtic_druid
Member


Joined: 07 Dec 2004
Location: Australia

Post Posted: Oct 11, 2005 21:47 Posts Comp View users profile Send private message Reply with quote

nguyenluthuy
Member


Joined: 19 Oct 2005
Location: Vietnam

Post Posted: Oct 21, 2005 04:53 Posts Comp View users profile Send private message Reply with quote

how to add subtitles if i convert a dual file?I have problem with the subfont, please guide me.
thanks in advanced


sakuya_su
Member


Joined: 13 Jan 2006
Location: New Zealand

Post Posted: Jan 16, 2006 00:32 Posts Comp View users profile Send private message Reply with quote

try using a new mencoder GUI, which is alltoavi:

http://alltoavi.sourceforge.net

it converts ogm/mkv to avi using subtitle, has batch mode and subtitle/audio selection


KIJIN
Member


Joined: 12 Feb 2006
Location: Philippines

Post