Listed here are some techniques and command-lines for performing certain tasks related to video encoding or disc authoring. Add short tips below; if you have a more lengthy tip (such as a HOWTO for a more involved task), please create a separate article and link it here.
Video frame dump Edit
It's often hard to compare the quality of two videos simply by watching them. The human eye is very forgiving when it comes to video, and it's useful to do a frame-by-frame comparison. To get a dump of every frame in VIDEO, use the following command:
$ mplayer -nosound -vo png VIDEO
Compare two images Edit
If you want to see the difference between two images (IMAGE_1 and IMAGE_2), use one of these commands:
$ convert IMAGE_1 IMAGE_2 -compose difference -composite x: & $ convert IMAGE_1 IMAGE_2 -compose difference -composite -normalize x: &
These commands use ImageMagick to display a grayscale representation of the difference between IMAGE_1 and IMAGE_2, with lighter areas indicating greater difference. The '-normalize' option is useful for images that are very similar. Use this to get a quick visualization of image quality, in particular the degredation and artifacts that are often introduced during conversion to another image format.
ImageMagick also includes the 'compare' utility. Try:
$ compare IMAGE_1 IMAGE_2 x: &
If you like numbers, you might enjoy:
$ compare -metric MAE IMAGE_1 IMAGE_2 null:
Try the metrics MSE, PSE, PSNR, and RMSE for different comparison types. For more on comparing images, see Anthony Thyssen's notes on the subject.
Integrated subtitles Edit
Some video formats (.mkv, for one) may contain subtitles; to make these appear when encoding with tovid, you can use the '-slang en' option to mplayer. There are additional options for controlling the size and placement of subtitles. Here's a command that may work (tweak to meet your needs):
$ tovid mpg -mplayeropts "-slang en -subpos 80 -subfont-text-scale 20" \ -in ... -out ...
Run tovid in the background Edit
To run a tovid encoding session in the background, use a command like this:
$ tovid mpg -in ... -out ... >/dev/null 2>/dev/null </dev/null &
Cropping letterbox bars Edit
If you have letterbox bars in your source video, you can crop them out while encoding with tovid. The easiest way to find the cropping dimensions is to use mplayer's 'cropdetect' filter:
$ mplayer -vf cropdetect LetterboxedVideo.avi ... [CROP] Crop area: X: 48..675 Y: 0..479 (-vf crop=624:480:50:0).1 0
Wait until the cropping dimensions stabilize, then close mplayer. Now run 'tovid mpg', passing those crop values in a -vf-pre filter:
$ tovid mpg -mplayeropts "-vf-pre crop=624:480:50:0" -in ... -out ...
You may also need to include the -aspect option, since cropping will throw off tovid's auto-aspect calculation.