Open main menu

Changes

2,671 bytes added ,  10:48, 27 March 2009
paste from gnhlug discuss
; [http://www.mplayerhq.hu/design7/info.html MPlayer] [[wp:MPlayer]] : is one of the most essential players in the Free Software world. The project works in tandem with FFmpeg. MPlayer software includes the '''Mencoder''' commandline tool
; VLC : vlc is cross-platform and wonderful
 
 
== Mencoder and ffmpeg examples ==
 
If you only want a 5-minute clip, the first thing to do would probably
be to throw away the other 55 minutes of video. That should make all
your files load much faster. :)
 
You can extract the part you want with mplayer like this:
<source lang="bash">
$ mencoder -ovc copy -oac copy infile -ss 00:10:09.5 -endpos 00:05:00 -o outfile
</source>
"-ovc" means "output video codec", "-oac" means "output audio codec",
the "-ss" argument skips ahead to 10 minutes 9.5 seconds into the
video, and "-endpos" tells mencoder to transcode exactly 5 minutes.
"copy" is a special codec name that tells mplayer to just streamcopy
the audio and video streams to output... essentially cutting out the
5-minute segment that you want.
 
This can also be done with ffmpeg:
<source lang="bash">
$ ffmpeg -acodec copy -vcodec copy -itsoffset -00:10:09.5 -i infile -ss 00:10:09.5 -t 00:05:00 outfile
</source>
Note that the "-itsoffset" option must be specified to make sure that
A/V timestamps synchronize, and that its value must be the negative of
the "-ss" argument.
 
Note that, for BOTH mencoder and ffmpeg, the order of command-line
options and arguments is not just significant, it's HIGHLY significant.
 
To transcode the video, specify the output codecs as the "-vcodec" and
"-acodec" arguments:
<source lang="bash">
$ mencoder -ovc lavc -oac lavc -lavcopts vcodec=mpeg4:acodec=ac3 infile -o outfile
</source>
Here, "lavc" means to use one of the libavcodec codecs, specified by
the "vcodec" and "acodec" suboptions to the "-lavcopts" option (which
specifies options for libavcodec). mencoder has about a bazillion^2
command line options, sub options, sub sub options, and can get quite
confusing. ffmpeg can also transcode audio and video streams from one
codec to another.
 
If you want to change the framerate of the video, you can use
something like this:
<source lang="bash">
$ mencoder -ofps 25 -oac copy -ovc copy -o outfile infile
</source>
Note that, whenever you use "copy" as the codec, mplayer will copy the
corresponding stream to the output unmodified. That means it will ignore
any filters set up to modify the copied stream. This is a BIG gotcha.
 
For example:
<source lang="bash">
$ mencoder -oac copy -ovc copy -af volume=10 -o outfile infile
</source>
WILL NOT DO what you probably want, because with "-oac copy" the
"volume" audio filters (specified with "-af") will be ignored, and the
audio in outfile will be at the SAME volume as the audio in infile.
 
When capturing video in the US, you may also run into problems with
video interlacing. Fortunately, mencoder has deinterlacing video
filters, for example "-vf pp=lb".
4,558

edits