MEncoder

From LinuxTVWiki
Revision as of 13:42, 21 April 2007 by JGXenite (talk | contribs) (Added examples of recording and transcoding, and tidying up in general)
Jump to navigation Jump to search

MEncoder is a very powerful tool which is part of the MPlayer software package. It is made from the same code base as MPlayer, and so can read every file format supported by MPlayer.

MEncoder can:

  • Re-encode video streams and files
  • Demux streams
  • Clean streams from errors that occured in the transmission

Recording DVB streams

While it is possible to encode on-the-fly DVB streams, this requires a very fast computer and is processor intensive. It is generally better to dump the DVB stream to disk in MPEG-TS format, and then clean up the stream afterwards.

To dump a DVB stream to disk, type:

 $ mencoder -ovc copy -oac copy -o stream.ts dvb://"STREAM NAME"

This will copy the video (-ovc) and audio (-oac) streams to the file stream.ts.

Transcoding to XviD

An MPEG-TS dump of a DVB stream is extremely large (~1GB for 30 minutes). MEncoder will also allow you to transcode the stream dump into something more useful, like XviD.

Example: To transcode a dump to XviD 800kbps video and MP3 128kbps audio, type:

 $ mencoder -forceidx -vf scale=640:-2 -ovc xvid -xvidencopts bitrate=800 -oac mp3lame -lameopts cbr:br=128 stream.ts -o output.avi

This command also forces an index to be created (-forceidx) and scales (-vf scale=640:-2) the image to a width of 640 (the height is calculated using the pre-scaled aspect ratio).