Codec transcoding

Dear lazyweb,

Can you point me to some pointers where I can find documentation how I can convert media files between the following codecs/containers :

* dvr-ms
* mpeg2
* xvid
* Divx (msmpeg4 ?)

Only condition is that this must be accomplished by using one (or a combination) of the following command line programs :

* ffmpeg
* mencoder
* transcode

(bonus points for mentioning other GNU CLI programs, which do also the trick).

Thank you.

Wouter Verhelst Thu, 12/25/2008 - 00:49

Cautionary note: though I'm sure you know this, in general, transcoding between lossy compression codecs is a bad idea. By definition, you will lose quality.

Having said that,

'man mencoder' is pretty extensive, but basically you select the audio codec with '-ovc' and the video codec with '-ovc'. E.g.:

mencoder -oac mp3lame -ovc xvid -o transcoded.avi input.mpg

will create a .avi file with the MP3 audio codec (using the "lame" encoder), and the Xvid video codec. There are more options to fine-tune this process (e.g., with '-lameopts' you can decide the bitrate etc of the audio stream), but that's the basic idea.

kristof_ Sun, 12/28/2008 - 22:06

In reply to by Wouter Verhelst

Cautionary note: though I'm sure you know this, in general, transcoding between lossy compression codecs is a bad idea. By definition, you will lose quality.

True; but also : dvr-ms is just a container for mpeg2 movies. I really want to strip this of, bt AFAIK this isn't possible with mencoder.
And mencoder sometimes produces an encoded file which has no audio, or a black screen. I'm pretty sure I'm doing something wrong, but I fail to see what.

glowtube Mon, 12/29/2008 - 21:02

dvr-ms -> mpg
===========
ffmpeg -y
-i
-async 1
-vcodec copy
-acodec copy
-f dvd