mencoder / ffmpeg encoding conversion commands

Join Movie:
mencoder -oac copy -ovc copy -o “joined.avi” “1.avi” “2.avi”
mencoder -oac copy -ovc copy -noodml -o “joined.avi” “1.avi” “2.avi”
mencoder -forceidx -oac copy -ovc copy -o “joined.avi” “1.avi” “2.avi”
mencoder -forceidx -oac copy -ovc copy -noodml -o “joined.avi” “1.avi” “2.avi”
mencoder -oac copy -ovc copy -idx -o output.avi video1.avi video2.avi video3.avi

The -oac copy option tells mencoder to just copy the audio stream (no reencoding). -ovc copy does the same with the video stream.
The -idx option asks mencoder to build the index if none was found. This makes searching inside the video easier.
-o stands for “output” and specifies the output file.
The last few parameters are the input video files.

You can join as many files as you like. This will work for videos of the same resolution, and using the same codec, but any video format that mencoder recognizes is fine.

Convert .mp4 to xvid .avi
mencoder “%%i” -quiet -ovc lavc -lavcopts vcodec=mpeg4:v4mv:mbd=2:trell -vf expand=:::::4/3,scale=320:-11,harddup -oac mp3lame -lameopts fast:preset=medium -ffourcc DX50 -o “%%~dpi%TodayDate%%%~ni.avi”

Repair Damaged avi
mencoder -oac copy -ovc copy infile.avi -o outfile.avi
ffmpeg -i infile.avi -acodec copy -vcodec copy outfile.avi

Convert .TS to .MPG
mencoder -of mpeg -ovc copy -oac copy -o <output file> <input file>

Convert to XviD (Single Pass)
* Video Bitrate = 1000
* Copy the audio date (does not re-encode)
mencoder -ovc xvid -xvidencopts bitrate=1000 -oac copy -o <output file> <input file>
mencoder -ovc xvid -xvidencopts bitrate=1000 -oac mp3lame -lameopts preset=medium -o <output file> <input file>

Convert to XviD (2 Pass)
* Video Bitrate = 1000
* Re-encode audio to MP3 using LAME
mencoder -ovc xvid -xvidencopts pass=1 -nosound -o <output file> <input file>
mencoder -ovc xvid -xvidencopts bitrate=1000:pass=2 -oac mp3lame -lameopts preset=medium -o <output file> <input file>

Convert to H.264 (Main Profile, 2 pass)
mencoder -ovc x264 -x264encopts pass=1 -nosound -o <output file> <input file>
mencoder -ovc x264 -x264encopts bitrate=1000:pass=2 -oac copy -o <output file> <input file>

Convert to H.264 (High Profile, 2 pass)
mencoder -ovc x264 -x264encopts pass=1:8x8dct:i8x8 -nosound  -o <output file> <input file>
mencoder -ovc x264 -x264encopts bitrate=1000:pass=2:8x8dct:i8x8 -oac copy -o <output file> <input file>

Convert mpg/avi to raw format
mencoder <file> -o <raw_file> -ovc raw -oac pcm

Convert rmvb to avi
* where the scale, fps were from the info message window of real player.
mencoder -oac mp3lame -lameopts cbr:br=64:vol=2 -srate 22050 -ovc xvid -sws 1 -xvidencopts bitrate=500:max_key_interval=120:vhq=4 -ofps 30 -vop scale=640:360 infile.rmvb -o outfile.avi
mencoder -oac mp3lame -lameopts preset=128 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1200 -ofps 25 -of avi -o OUT.avi  IN.rmvb

Convert wmv to mpeg
mencoder movie.wmv -o movie.mpg -ovc lavc -oac mp3lame -of mpeg

Convert dv to mpeg4 and mp3 audio
mencoder foo.dv -mf fps=25 -o output.avi -ovc lavc -lavcopts vcodec=mpeg4 -oac mp3lame

Merge a video file with an audio file
mencoder -audiofile newaudio.wav -oac mp3lame -ovc copy videofile.avi -o new-videofile.avi

Convert from OGM to AVI or MKV to AVI with mp3 audio and leave the video source intact.
mencoder “c:\video\video.ogm” -oac mp3lame -ovc copy -o “c:\video\videooutput.avi”
mencoder copy -oac mp3lame input.mkv -o output.avi
mencoder $input -ffourcc XVID -ovc lavc -lavcopts vcodec=mpeg4:threads=8:vbitrate=$vbitrate:cmp=2:subcmp=2:trell=yes:v4mv=yes:mbd=2 -oac lavc -lavcopts acodec=ac3:abitrate=384 -channels 6 -o $output
ffmpeg -i test.mkv -vcodec mpeg4 -vtag XVID -acodec copy test.avi
ffmpeg -i test.mkv -vcodec mpeg4 -vtag XVID -acodec libmp3lame -ac 2 -ab 192k test.avi

Convert from OGM to AVI or MKV to AVI with mp3 audio and xvid video.
mencoder “c:\video\video.ogm” -oac mp3lame -ovc xvid -xvidencopts pass=1 -o “c:\video\videooutput.avi”

Get Video info:
mencoder 1.mov -o info.avi
mplayer -identify 1.mov -ao null -vo null -frames 0

Options:

-ovc
Available codecs:
copy     – frame copy, without re-encoding. Doesn’t work with filters.
frameno  – special audio-only file for 3-pass encoding, see DOCS.
raw      – uncompressed video. Use fourcc option to set format explicitly.
nuv      – nuppel video
lavc     – libavcodec codecs – best quality!
vfw      – VfW DLLs, read DOCS/HTML/en/encoding-guide.html.
qtvideo  – QuickTime DLLs, currently only SVQ1/3 are supported.
xvid     – XviD encoding
x264     – H.264 encoding

-oac
Available codecs:
copy     – frame copy, without re-encoding (useful for AC3)
pcm      – uncompressed PCM audio
mp3lame  – cbr/abr/vbr MP3 using libmp3lame
lavc     – FFmpeg audio encoder (MP2, AC3, …)
faac     – FAAC AAC audio encoder

Deinterlacers for mencoder.
-vf lavcdeint
-vf kerndeint
-vf filmdint
-vf pp=lb
-vf pp=li
-vf pp=ci
-vf pp=md
-vf pp=fd

Use if file larger then 1gb.
-noodml

Fix Index Record
-forceidx

Adding -ss and -endpos and timeframe makes it cut out nicely: -ss 00:00:00 -endpost 00:10:15

Please post a reply if you have other useful commands. Thanks

, , , , , , , ,

No comments yet.

Leave a Reply

*

Powered by recycled bites and bytes.