#!/bin/sh
# if remove_sound leads to broken video use this
if [ $# != 1 ] ; then
    echo "Usage: $0 <videofile>"
    exit 1
fi
if [ ! -e "$1" ] ; then
    echo "$0: No such file $1"
    exit 1
fi

output=`echo $1 | sed 's/^\(.\+\)\.\([^.]\+\)/\1_nosound.\2/'`
mencoder "$1" -nosound -ovc copy -o "$output"
touch -r "$1" "$output"

exit

if file "$1" | grep -q "Macromedia Flash Video" ; then
    ext=flv
    output=`echo $1 | sed "s/^\(.\+\)\.\([^.]\+\)/\1_nosound.$ext/"`
    ffmpeg -i "$1" -an -vcodec copy "$output" 
else
    output=`echo $1 | sed 's/^\(.\+\)\.\([^.]\+\)/\1_nosound.\2/'`
    mplayer -dumpvideo -dumpfile "$output" "$1"
fi
