Converting Videos for the Creative Zen

I have a Creative Zen, its a very nice little mp3/video player, and while it plays xVid/DivX/WMV its a bit picky about what it will play.

So ive created this script to convert videos to a format it will play (320×240, xVid, with auto black bars to maintiain aspect ratio & 128KB ABR MP3 audio).
Its a Bash script using Mplayer / Mencoder.

Files

  • convzen.sh

    !/bin/bash

    usage()
    {
    [ -n "$1" ] && echo -e "Error: $1n"
    echo "Usage: convzen.sh [Input File]"
    exit
    }

    if [ $# != 1 ]
    then
    usage "Input file not specified"
    fi

    OUTPUTDIR="/home/$USER/Videos/Zen/"

    INPUT=$1
    FILENAME=basename "$INPUT" | sed 's/\(.*\)\..*/\1/' #Get file name and remove file extension
    OUTPUT="${OUTPUTDIR}${FILENAME}.avi"

    Ensure input file exists

    [ -f "$INPUT" ] || usage "Input file does not exist"

    Ensure output dir exists

    [ -d "$OUTPUTDIR" ] || mkdir -p "$OUTPUTDIR"

    Pass 1

    mencoder "$INPUT"
    -vf scale=320:-3,expand=320:240
    -ovc xvid -xvidencopts bvhq=1:chroma_opt:quant_type=mpeg:bitrate=400:pass=1:turbo
    -oac mp3lame -lameopts abr:br=128
    -o /dev/null

    Pass 2

    mencoder "$INPUT"
    -vf scale=320:-3,expand=320:240
    -ovc xvid -xvidencopts bvhq=1:chroma_opt:quant_type=mpeg:bitrate=400:pass=2
    -oac mp3lame -lameopts abr:br=128
    -o "$OUTPUT"

Update: 1/5/09

This is giving me A/V Desync issues, not sure what it causing it.

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *