Cinelerra, high def MPEG from TiVo, slicing out a clip, creating DVD and portable versions

VirginSnow at vfemail.net VirginSnow at vfemail.net
Fri Mar 27 10:17:16 EDT 2009


> Date: Fri, 27 Mar 2009 08:36:12 -0400
> From: Ben Scott <dragonhawk at gmail.com>

> SCENARIO
> 
>   I have a one hour, high-definition news program, recorded on my TiVo
> Series 3.  It is roughly 8 GB in size.  I want to extract a short
> segment from that file -- maybe 5 minutes.

> I then want to do two things with the clip: (1) Produce a DVD-Video
> disc which will play in most typical DVD players.  (2) Produce a
> "portable version" which is of more suitable file size, and which
> will play "out of the box" on most MS Windows

The tools I generally use for transcoding video are mencoder and
ffmpeg.

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:

$ mencoder -ovc copy -oac copy infile -ss 00:10:09.5 -endpos 00:05:00 -o outfile

"-ovc" means "output video codec", "-oac" means "output video 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:

$ ffmpeg -acodec copy -vcodec copy -i infile -itsoffset -00:10:09.5 -ss 00:10:09.5 -t 00:05:00 outfile

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:

$ mencoder -ovc lavc -oac lavc -lavcopts vcodec=mpeg4:acodec=ac3 infile -o outfile

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:

$ mencoder -ofps 25 -oac copy -ovc copy -o outfile infile

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:

$ mencoder -oac copy -ovc copy -af volume=10 -o outfile infile

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".

IIRC, REA has some experience with downsizing video for playing on
portable devices like the iPAQ.  He'll probably know more about what
specfic resolutions, bitrates, etc. to use for portability.


More information about the gnhlug-discuss mailing list