Me & 3M

My Mundane Musings

Media conversion in Linux: Using mencoder/ffmpeg/transcode and other media related scripts

Fedora doesn’t provide any ready to use media player or converted. But installing mplayer and xmms will fill that gap.
Here I will blog some scripts that eased my Any to XVid conversion and other media related stuff

Mencoder/ffmpeg/transcode other media relared scripts

Capturing images from PTP camera (Canon)
Use gnocam, gtkam or digicam
Use gphoto2 –get-all-files

AVI to Mpeg4
mencoder input.avi -ovc lavc -lavcopts vcodec=mpeg4 -o output.mpg4 -oac lavc -af lavcresample=48000:srate=48000

mencoder -ovc lavc -oac lavc -o

mencoder source.mpg -of avi -oac mp3lame -o file.avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1400:vhq:vpass=1
mencoder source.mpg -of avi -oac mp3lame -o file.avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1400:vhq:vpass=2

mencoder source.mpg -of avi -oac mp3lame -lameopts abr:br=128 -o /dev/null -ovc xvid -xvidencopts vhq=4:pass=1
mencoder source.mpg -of avi -oac mp3lame -lameopts abr:br=128 -o file.avi -ovc xvid -xvidencopts vhq=4:bitrate=1100:pass=2

One pass
mencoder -ovc xvid -oac mp3lame -xvidencopts bitrate=687 -o
mencoder -ovc xvid -oac mp3lame -lameopts abr:br=92 -xvidencopts bitrate=150 -o
mencoder -ovc xvid -oac mp3lame -xvidencopts bitrate=-700000 -o
mencoder -ovc xvid -oac mp3lame -xvidencopts fixed_quant=4 -o

mencoder infile.wmv -ofps 23.976 -ovc lavc -oac copy -o outfile.avi’

Two pass
nice -n 19 mencoder file.wmx -ofps 23.976 -oac mp3lame -lameopts abr:br=92 -ovc xvid -xvidencopts pass=2:bitrate=150 -o audiofix-150bit-xvid.avi

mencoder file.wmx -ofps 23.976 -oac mp3lame -ovc xvid -xvidencopts pass=1 -o /dev/null
mencoder file.wmx -ofps 23.976 -oac mp3lame -ovc xvid -xvidencopts pass=2:bitrate=250 -o 250bit-xvid.avi

To get an idea of bitrate # mencoder -ovc frameno -o frameno.avi -oac mp3lame -lameopts abr:br=128 vts_19_1.vob
single file # mencoder -oac mp3lame -o 6in1.avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vqmin=2:vqmax=31 vts_19_1.vob
Multiple VOB files
# nice -+19 cat /media/cdrom/*vob | nice-+19 mencoder -ovc frameno -o $1 -oac mp3lame -lameopts abr:br=128 -
# cat /space/*vob | nice -+19 mencoder -oac copy -o /dev/null -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vpass=1:vqmin=2:vqmax=31 -npp lb -
# cat /space/*vob | nice -+19 mencoder -oac copy -o $1 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vpass=2:vqmin=2:vqmax=31 -npp lb -
FFMPEG on the command line:
Values for -target “vcd”, “svcd”, “dvd”, “dv”, “pal-vcd”, “ntsc-svcd”
ffmpeg -i “$movie” -f avi -vcodec xvid -b 800 -g 300 -bf 2 -acodec mp3 -ab 128 -y “$xvid_file”

Following is working fine for me (all encompassed in dat2divx script)
Use cdxa2mpeg (from GNUVcdImager) to convert DAT to mpg
$ cdxa2mpeg -v AVSEQ01.DAT AVSEQ01.mpg
A sample XVid conf file was copied from /usr/lib/transcode/xvid4.cfg to ~/.transcode/, modifiy it to taste
$ transcode -i AVSEQ01.mpg -o AVSEQ01.avi -y xvid -R1
$ transcode -i AVSEQ01.mpg -o AVSEQ01.avi -y xvid -R2

About these ads

September 25, 2006 - Posted by | Tech Babble


  1. Very useful snippets here. Although I believe your ffmpeg command uses the bitrate as defined “-b 800″ which is actually 800 BITS and not 800KBits, Unless thats what you wanted to do.
    my 2 cents.

    Comment by vangel | May 15, 2007 | Reply

  2. sorry for the typo above , I meant bits and kbits. Not to be confused with the B and KB which translates to bytes.

    Comment by vangel | May 15, 2007 | Reply

  3. hmmmm…very interesting!
    Thanks google

    Comment by endeapono | January 17, 2008 | Reply

  4. good afternoon,,,
    my name’s rerey..
    i want to ask you, Sir…
    how do we can convert .DAT to .MPEG with ffmpeg in Slackware 12.0???

    I need your reply as soon as possible..
    i hope, you’ll send a reply to my e-mail

    thank you so mch for your attention..

    Comment by rereynanda | May 28, 2008 | Reply

  5. Is this where I should post my intro?. Hi I am Leon. My Hobbies are make money on the internet read more about it here diet program online. I’m going to reading more about this website

    Comment by tutbrotte | January 16, 2011 | Reply

  6. I am curious to find out what blog system you have
    been using? I’m experiencing some small security issues with my latest website and I’d
    like to find something more secure. Do you have any recommendations?

    Comment by Haytham Ahluwalia | February 28, 2013 | Reply

  7. Way cool! Some very valid points! I appreciate you penning this post plus the rest of the site is really good.

    Comment by Kristine | May 8, 2013 | Reply

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: