This is an old revision of the document!


Multimedia encoding

Windows

VirtualDub

Linux

Images

convert

size operations
  • resize: scale image
    convert in.png -resize 640x480 out.png
  • crop: crop image
    convert in.png -crop 640x480+10+10 out.png
  • extent: add margins or crops
    convert in.png -gravity center -extent 1420x1420       out.png
    convert in.png                 -extent 1420x1420-10-10 out.png
Annotate an image with text
convert in.png \
  -gravity SouthEast \
  -stroke '#000C' -strokewidth 2 -annotate 0 'TeST' \
  -stroke none     -fill white   -annotate 0 'TeST' \
  out.png
Append images
convert in1.png in2.png +append out.png # horizontally
convert in1.png in2.png -append out.png # vertically

Exif

exiftool
  • restore exif Orientation tag: if you have photos captured with a device that sets the orientation tag, but you used a viewer that doesn't use this tag, and rotated the image with a software that doesn't update this tag, then the image is inconsistent and is not well displayed in exif-aware viewers. To reset the orientation tag, you can use the following command:
    exiftool -overwrite_original -Orientation="Horizontal (normal)" <file>

Video

mencoder

From another video file

Example with xvid codec :

mencoder \
  -ovc xvid -xvidencopts bitrate=800:quant_type=mpeg:gmc:chroma_opt:vhq=4:bvhq=1:trellis \
  -oac mp3lame -lameopts abr:br=128 \
  -vf yadif=0 \
  K7-1-DV-1.avi K7-1-DV-2.avi -o rush1.avi

Options :

  • ovc = video codec
    • trellis : speeds up encoding
  • oac = audio codec
  • vf = video filters
    • pp = post processing subfilters
    • yadif : deinterlace
From multiple images
mencoder \
  -ovc x264 -x264encopts bitrate=800 \
  -vf scale=640:480 \
  "mf://img.o.*.PNG" -mf fps=25 -o img.o.avi

x264encopts:

  • bitrate=<value>: constant bitrate, in kbs
  • crf=<1.0-50.0>: constant quality, lower is better

AviDemux

A GUI easier to use, like VirtualDub for Windows.

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

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

software/video.1295323702.txt.gz · Last modified: 2013/09/19 16:43 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0