Como converter arquivo .seom para .mpg (resolvido)

Iniciado por julianodorneles, 21 de Dezembro de 2006, 16:00

tópico anterior - próximo tópico

julianodorneles

Pessoal, preciso converter alguns vídeos que estão no formato .seom para o formato .mpg.
Testei o procedimento abaixo mas não funcionou ... tem alguma maneira mais fácil?

seom-filter file:///tmp/video.seom | mencoder -oac lavc -ovc lavc -lavcopts vcodec=mpeg4:acodec=mp3:abitrate=64 -oac mp3lame -o beryl_vidcap.mpg -

Ou meu comando está errado?

P.S.: Já instalei todo o suporte ao seom ... consigo rodar os vídeos sem problemas com o comando seom-player ... mas gostaria que os arquivos fossem abertos pelo totem por padrão ... será que é possível?

Falou!
[color=gray]AMD Athlon64 3000+, Abit AX8, 1Gb RAM (2x512Mb Dual Channel), GF 6800XTreme Edition 256Mb, HD SATA 80Gb Samsung, LG 1752TX LCD.[/color]

julianodorneles

Descobri ... mais fácil impossível ;)

Salve o seguinte código como seom-converter e torne-o executável.

#!/bin/bash
#
# Utility for converting seom files produced by beryl-vidcap plugin
# Author : reggaemanu <reggaemanu@beryl-project.org>
#
# Dependencies...
#
# Needed :
#       - seom-filter
#       - mencoder
# Optionals :
#       - notify-send - for notifications (provided by libnotify-bin)
#       - zenity - for gui dialogs
#

NAME=seom-converter
VERSION=0.8

FILE=/tmp/beryl-capture.seom
CODEC=x264
BITRATE=1200
DELETE=false
NOTIFY=false
PLAY=false
TRASH=false
INC=false
GUI=false


_help () {
    echo "Usage: $NAME [options]"
    echo ""
    echo "Options:"
    echo "          -f    --file FILENAME|DIRNAME"
    echo "                  strict path to input file (default: /tmp/beryl-capture.seom)"
    echo ""
    echo "          -o    --output FILENAME|DIRNAME"
    echo "                  output dir or file path (default: same dir as input file)"
    echo ""
    echo "          -c    --codec CODECNAME"
    echo "                  codec used for convertion (default: x264)"
    echo ""
    echo "          -b    --bitrate BITRATE"
    echo "                  useful only for xvid codec (default: 1200)"
    echo ""
    echo "          -i    --increment"
    echo "                  increment file number if already exist (default: false)"
    echo ""
    echo "          -g    --gui"
    echo "                  use zenity dialogs while converting process (need zenity)"
    echo ""
    echo "          -n    --notify"
    echo "                  send a notification when encoding is done (need notify-send)"
    echo ""
    echo "          -d    --delete"
    echo "                  delete input .seom file after encoding"
    echo ""
    echo "          -p    --play"
    echo "                  play resulting file after encoding"
    echo ""
    echo "          -t    --trash"
    echo "                  put input .seom file in trash after encoding"
    echo ""
    echo "          -v    --version"
    echo "                  show version information"
    echo ""
    exit
}


_version () {
    echo "$NAME $VERSION"
}


while [ $# -gt 0 ]; do
    case "$1" in
        -f|--file|--filename)
            FILE="$2"
            ;;
        -o|--output)
            OUTPUT="$2"
            ;;
        -c|--codec)
            CODEC="$2"
            ;;
        -b|--bitrate)
            BITRATE="$2"
            ;;
        -g|--gui)
            GUI=true
            ;;
        -n|--notify)
            NOTIFY=true
            ;;
        -i|--increment)
            INC=true
            ;;
        -d|--delete)
            DELETE=true
            ;;
        -p|--play)
            PLAY=true
            ;;
        -t|--trash)
            TRASH=true
            ;;
        -v|--version)
            _version
            exit
            ;;
        -h|--help)
            _help
            ;;
    esac
    shift
done


_error () {
    if [ "$GUI" = "true" -a -x /usr/bin/zenity ]; then
        zenity --error --title="Error" --text="$*"
    else
        echo "Error: $*"
    fi
    exit
}


_checks () {
    if [ ! -x /usr/bin/mencoder -a ! -x /usr/local/bin/mencoder ]; then
        _error "Mencoder binary not found! Please install it."
    fi

    if [ ! -x /usr/bin/seom-filter -a ! -x /usr/local/bin/seom-filter ]; then
        _error "Seom-filter binary not found! Please install it."
    fi

    if [ -d "$FILE" ]; then
        LASTFILE=$(ls -c $FILE/*.seom 2> /dev/null | head -1)
        if [ $LASTFILE ]; then
            FILE=$(ls -c $FILE/*.seom | head -1)
        else
            _error "Supplied dir doesn't contain any .seom files!"
        fi
    elif [ ! -f $FILE ]; then
        _error "Supplied file or dir doesn't exist!"
        exit
    elif [ ${FILE##*.} != "seom" ]; then
        _error "Wrong format, input file must be a .seom file or a dir containing .seom files!"
    fi

    if [ -z "$OUTPUT" ]; then
        OUTPUT=$(echo $FILE | sed s/seom/avi/)
    fi

    if [ ! -d $(dirname $OUTPUT) ]; then
        _error "Output dir doesn't exist!"
    fi

    if [ -d "$OUTPUT" ]; then
        OUTPUT=$(echo $OUTPUT/$(basename $FILE | sed s/seom/avi/))
    fi

    if [ "$CODEC" = "xvid" ]; then
        CODEC=$(echo xvid -xvidencopts bitrate=$BITRATE)
    fi
}


_increment () {
    if [ "$INC" = "true" -a -s "$OUTPUT" ]; then

    n=1
    while [ -s "${OUTPUT%.*}$n.avi" ]
    do
    let "n+=1"
    done
   
        OUTPUT="${OUTPUT%.*}$n.avi"
    fi
}


_convert () {
    if [ "$GUI" == true ]; then
        seom-filter $FILE 2> /dev/null | mencoder - -ovc $CODEC -o $OUTPUT 2>&1 | zenity --progress --pulsate --auto-close --text="Converting $FILE file with $CODEC codec... "
    else
        seom-filter $FILE 2> /dev/null | mencoder - -ovc $CODEC -o $OUTPUT
    fi
}


_delete () {
    if [ "$TRASH" = "true" ]; then
        mv $FILE ~/.Trash
    elif [ "$DELETE" = "true" ]; then
        rm $FILE
    fi
}


_notify () {
    if [ "$NOTIFY" = "true" -a -f /usr/bin/notify-send ]; then
        notify-send --icon emblem-multimedia "Encoding done" "Output file : $OUTPUT"
    elif [ "$NOTIFY" = "true" ]; then
        echo "Error: notify-send binary is missing! You need to install libnotify-bin if you want to use notifications."
    fi
}


_play () {
    if [ "$PLAY" = "true" ]; then
        if [ -f /usr/bin/gnome-open ]; then
            gnome-open $OUTPUT
        elif [ -f /usr/bin/mplayer ]; then
            mplayer $OUTPUT
        elif [ -f /usr/bin/wxvlc ]; then
            wxvlc $OUTPUT
        elif [ -f /usr/bin/totem ]; then
            totem $OUTPUT
        fi
    elif [ "$GUI" = "true" ]; then
        if $(zenity --question --text="Encoding done, would you like to play the resulting video ?"); then
            PLAY="true"
            _play
        fi
    fi
}


_checks
_increment
_convert
_delete
_notify
_play

exit
[color=gray]AMD Athlon64 3000+, Abit AX8, 1Gb RAM (2x512Mb Dual Channel), GF 6800XTreme Edition 256Mb, HD SATA 80Gb Samsung, LG 1752TX LCD.[/color]