Convertir des vidéos en xvid sous Linux

Je voulais convertir des fichiers vidéo de mon système Linux au codec xvid pour pouvoir les regarder sur ma PS3. La solution que j'ai trouvée passe par le paquet mencoder.

#!/bin/bash

# this script converts videos given to it to the xvid codec, IN PLACE,
# this means it replaces the original files...

for x in "$@"; do
    echo "$x"
    y="$x.tmp"
    mencoder "$x" -ovc xvid -oac copy -xvidencopts fixed_quant=4 -o "$y"
    ret=$?
    if [[ $ret -eq 0 ]]; then
        mv "$y" "$x"
        ret=$?
        if [[ $ret -ne 0 ]]; then
            echo "problem moving file $x"
            break
        fi
    else
        echo "problem converting file $x"
        break
    fi
done