Multimedia

vob2avi

Convert VOB files with Transcode into another video format.

transcode -i myVobFolder -o movie.avi -y xvid -x vob

Scale

Select a different audio channel, don't select a non existing audio channel or your VOB files will only be read once and no content will be generated

Encoder bitrate

-w 1800

Clipping, this cuts the first and last 16 rows of

-j 16,0

Linear interpolation for interlaced videos

Cut the results

avisplit -c -i movie.avi -t 00:00:00.00-00:05:10.00,00:11:59.00-00:22:41.00

Use tcaud

-y xvid,tcaud

Create DivX files

-y ffmpeg -F mpeg4

Use mencoder instead of transcode

cat *.vob | mencoder -oac mp3lame -ovc xvid -xvidencopts pass=1             - -o movie.avi;
cat *.vob | mencoder -oac mp3lame -ovc xvid -xvidencopts pass=2:bitrate=700 - -o movie.avi;

mkv2avi

mencoder -oac pcm -ovc copy  -ofps 30000/1001 -o Movi.avi Movi.mkv

Extract audio from video

nice transcode -i vts_01_6.vob -o soundtrack.wav -y null,wav -x vob -e 44000
mplayer -ao pcm:fast:file=audio.wav -vo null -vc null video.avi

jpg2avi

Mplayer

mencoder 'mf://*.jpg'                      -mf fps=10:type=jpg -xvidencopts bitrate=1600 -ovc xvid -oac copy -o output.avi
mencoder mf:///tmp/foo/*.jpg -vf rotate=1 -mf  fps=5:type=jpg -lavcopts vcodec=mpeg4    -ovc lavc -oac copy -o output.avi

ImageMagick

animate -delay 10 *.jpg
animate -help

convert -delay 10 *.jpg out.gif

Automated picture manipulation

ImageMagick

convert large.jpg -resize 120x120 small.jpg
convert large.jpg -resize 50% small.jpg

Got pictures from different cameras from one event? Use the exif header in the JPEG pictures to extract the date and time and put it into the filename so you can sort the files chronologically. Make a backup and check you don't overwrite files!

for i in *.jpg; do d=`exif -t 0x9003 "$i" | grep Value | sed s/^"  Value: "// | sed s/" "/_/g | sed s/:/-/g`; mv "$i" "$d""_""$i"; done

Android creates for me files like this '2021-06-11 15.07.15.jpg'. To give them the same format:

for i in *.jpg; do n=`echo "$i" | sed s/\ /_/  | sed s/"\."/-/g | sed s/"\."/-/g | sed s/-jpg/.jpg/`; mv "$i" "$n"; done

Change the date from 2005 to 2006

for i in *;
 do
  n=`exif            -t 0x9004                    "$i"  | grep ^"  Value: " | sed s/^"  Value: "// | sed s/2005/2006/`;
  x="exif --ifd=EXIF -t 0x9004 --set-value="$n" $i";
  eval "$x";
done
 

Change exif time and date by a given value

for i in *.jpg *.JPG;
do
    # Value from exif, e.g. "  Value: 2018:09:10 08:22:36"
    exif=`exif -t 0x9003 "$i"`
    if [ $? -gt 0 ]; then
        echo "Error getting exif date from $i"
        continue
    fi;

    # date as found in exif, e.g. 2018:09:10 08:22:36
    date=`echo "$exif" | grep Value | sed s/^"  Value: "//`

    # date as understood by gnu date, e.g. 2018-09-10 08:22:36
    dateFixedFormat=`echo "$date" | sed s/:/-/ | sed s/:/-/`

    # seconds since epoch
    epochSeconds=`date -d "$dateFixedFormat +0000" '+%s'`

    # here add or substract what you want to change (in seconds), e.g. add one hour
    epochNewDate=`expr $epochSeconds + 3600`

    # calculate new date and time after your changes
    newDate=`TZ=UTC date --date="@""$epochNewDate" "+%Y:%m:%d %H:%M:%S"`

    echo \""$i"\" \""$date"\" " -> "  \""$newDate"\"

    tmp=`tempfile` || exit
    exif -o "$tmp" --ifd=EXIF -t 0x9003 --set-value "$newDate" "$i" || continue
    mv "$tmp" "$i"
done