Tips 'n Tricks

This is a list of tricks that I use fairly regularly in research and typesetting.

  • How to get a nice-looking xgterm window:
    alias xgterm='xgterm -bg grey -fg black -geometry 80x25+5+5 -fn -misc-fixed-medium-r-normal--13-100-100-100-c-80-iso8859-1 -sbr'
    
  • How to convert encapsulated postscript (eps) to a high-quality jpeg:
    convert -density 300 image.eps -resize 1024x768 image.jpg
    
  • How to create a movie (with sound) from a set of still images:
    avconv -f image2 -r 15 -i ./frame%03d.jpg -i soundfile.wav -c copy -crf 20 output.avi
    

    Here -r sets the sampling rate, and -c copy retains the no-compression quality of images. If you prefer to use compression for a smaller file size, you can do something like:

    avconv -f image2 -r 15 -i ./frame%03d.jpg -i soundfile.wav -q 5 output.avi
    

    where -q is quality, and it ranges from 1 (best) to 31 (worst).

  • Same thing, but with ffmpeg, and for all images in a given directory?
    ffmpeg -framerate 15 -pattern_type glob -i '*.jpg' -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
    
  • How to convert the RPi-unfriendly mkv format to a friendly ts format:
    avconv -i input.mkv -vcodec copy -bsf h264_mp4toannexb output.ts