(Modified 2014 Jan 06)
Movie players/editors
Video players
totem -- a nice program. It was the default player in my distro, and it works fine. When it can't play a file format, it looks for the appropriate codec and asks to install it. If the codec resides in a legal gray area, it warns you. This is precisely how it should work, in my opinion.
I needed to install the GStreamer "ugly" plugins for some video formats.
mplayer -- A userful feature for me is single-frame advance, accomplished with a '.'
Also, I got an error that I didn't try too hard to track down: AVC: nal size 0
The fix I found at Ubuntu forums.
In ~/.mplayer/config, add a line:
really-quiet=yes
Video editors
ffmpeg -- It also comes with a simple player called ffplay. More below.
pitivi -- Output formats are limited, but what's there is good.
openmovieeditor -- I couldn't get it to read an MP4 file.
avidemux -- Apparently full-featured, but it didn't recognize my audio hardware.
ffmpeg
The console commands have the basic syntax:
ffmpeg -i input.mp4 [options] output.mpg
I'll write the new parameters in bold. To convert to EGA (320x240), the command would be:
ffmpeg -i input.mp4 -s ega output.mpg
A trick I adapted from the MPlayer forum is to capture a video as a series of screencaps:
ffmpeg -i movie.mpg movie_%5d.jpg
The '5' specifies the number of digits in the filenumber.
Here are some formats that I noted. I believe either the name or the dimensions can be understood.
320x240 -- qvga (or ntsc)
352x288 -- cif (or pal) -- 600k is a reasonable bit rate
640x350 -- ega
640x480 -- vga
704x576 -- 4cif
800x600 -- svga
852x480 -- hd480
1280x720 -- hd720 -- 4000k is a reasonable bit rate
My camcorder has a wide-angle aspect ratio, and the ratio may be explicitly required:
ffmpeg -i input.mp4 -s ega -aspect 16:9 output.mpg
The default bitrates (especially for video) are low, particularly bad for large video formats, meaning the videos will look very blocky using default settings. The flag for video bitrate is -b and for audio, -ab:
ffmpeg -i input.mp4 -s ega -aspect 16:9 -b 1400k -ab 128k output.mpg
The default video bitrate was 200k, much different than what I would prefer. The default audio bitrate is 64k, not so different than what I specified.
Next, I tried MPEG-2 output. The default is MPEG-1. I needed to install the following software:
libavcodec-unstripped-51
libavformat-unstripped-52
libpostproc-unstripped-51
The syntax is:
ffmpeg -i input.mp4 -s ega -aspect 16:9 -b 1400k -ab 128k -vcodec mpeg2video output.mpg
MPEG-2 looked better to my eye, and supposedly it is better then MPEG-1 at high bitrate. However, most typical installations cannot read MPEG-2.
One last trick that I didn't find very useful was two-pass recording. Still, it was hard to find simple directions, so I'll show how here. The keys are the -pass {1,2} flag and the -passlogfile flag. The passlogfile must be the same from the first pass to the second.
ffmpeg -i input.mp4 -s ega -aspect 16:9 -b 1400k -ab 128k -pass 1 -passlogfile logfile output1.mpg ffmpeg -i input.mp4 -s ega -aspect 16:9 -b 1400k -ab 128k -pass 2 -passlogfile logfile output2.mpg
It was unclear before I tried that each pass is done separately, and that you need to know before the first pass that you'll do a second.
To trim a video, the -ss flag marks the beginning of the clip, and the -t flag marks the duration. For both flags, either hh:mm:ss notation or just plain seconds works, e.g.:
ffmpeg -i input.mp4 -ss 00:01:42 -t 62 -s ega -aspect 16:9 -b 1400k -ab 128k output.mpg
However, when I use a non-zero start time, the audio and video are no longer synchronized. I found an inelegant solution between KKoncepts and howto-pages.org, using the -itsoffset flag. First, the magnitude of the delay must be determined empirically, such as using mplayer, using the +/- keys. Second, we must give ffmpeg separate inputs for the video and audio streams. The -itsoffset flag will precede the delayed stream. The -map flag will tell ffmpeg from which input which stream is derived, e.g.:
ffmpeg -ss 00:01:42 -i input.mp4 -itsoffset 1.5 -ss 00:01:42 -i HDV_0135.MP4 -map 1:0 -map 0:1 -t 62 -s ega -aspect 16:9 -b 1400k -ab 128k output.mpg
To understand the -map flag, note that ffmpeg numbers things starting from zero.
The first -map 1:0 flag takes from the second input file ("1"), the first stream ("0") as the video source.
The second -map 0:1 flag takes from the first input file ("0"), the second stream ("1") as the audio source.
Note that we had to repeat the delay using the -ss flag for the second stream.
It is possible to rotate a video by an arbitrary number of degrees:
ffmpeg -i GOPR5286.MP4 -vf "rotate=4.5*PI/180" GOPR5286_rot.MP4
The "PI/180" is to convert from degrees to radians. Positive is clockwise.
This page is Lynx-enhanced