Table of Contents

Multimedia encoding

Images

convert

size operations

Annotate an image with text

Simple text:

convert in.png \
  -pointsize 20 -fill red -draw 'text 10,30 "My text" ' \
  out.png

Text with shadow:

convert in.png \
  -gravity SouthEast \
  -stroke '#000C' -strokewidth 2 -annotate 0 "My text" \
  -stroke none    -fill white    -annotate 0 "My text" \
  out.png

Append images

convert in1.png in2.png +append out.png # horizontally
convert in1.png in2.png -append out.png # vertically

More complex:

convert im1.png -resize 640x480 ppm:- \
	| convert im2.png - +append ppm:- \
		| convert im3.png - -append final.png

Create animated GIF

convert -delay 50 -loop 0 *.jpg out.gif

Formats

Exif

exiftool

Video

mencoder

(comes with mplayer).

http://gentoo-wiki.com/HOWTO_Mencoder_Introduction_Guide

General syntax:

mencoder \
  <input data> \
  <input options> \
  <output options> \
  <output data>

Input data and options

Output data and options

Specify the video codec with -ovc option, and audio codec with -oac option. copy is possible with both.

Other operations

ffmpeg

AviDemux

A GUI easier to use, like VirtualDub for Windows.

PhotoFilmStrip

Kdenlive

Tried Openshot and Cinelerra but seem crappy, Kdenlive seems to have better design.

Audio

mp3

⇒ lame

To encode from wav to mp3 in “speech” quality :

lame -V2 --vbr-new -q0 --lowpass 10 -s 22.05 -b32 file.wav file.mp3

⇒ mp3cut

To cut an mp3 file (warning: ID3 tags are not copied):

mp3cut -o output.mp3 -t 00:00:05+700-00:00:07+800 input.mp3

To concatenate mp3 files:

mp3cut -o output.mp3 input1.mp3 input2.mp3 input3.mp3

⇒ id3cp

To copy ID3 tags from a file to another one.

⇒ id3v2

To view and edit ID3 tags in command line.

⇒ kid3

To view and edit ID3 tags in GUI.

ogg

(using vorbis-tools package)

⇒ oggenc

To encode from wav to ogg in “speech” quality :

oggenc -b 32 --downmix --resample 22050 file.wav -o file.ogg

Converting from ogg to ogg in “speech” quality :

oggdec -b 16 -R file.ogg -o - | oggenc -r -B 16 -C 1 -b 32 --resample 22050 - -o file_recomp.ogg

sox

play, record, process

ffmpeg