Videoconverterscript: Unterschied zwischen den Versionen

Aus Linupedia.org
Wechseln zu: Navigation, Suche
K
K (Zweiten Rückwärts-Schrägstrich ergänzt und Formalfehler-Meldungen umschifft (im Konsolfenster "PSP-Thumb Converting" sind ffmpeg-Fehler vorhanden).)
 
(7 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
 
Hier ein kleines Script zum automatischen konvertieren bekannter Videoformate in DVD, VCD, SVCD und PSP konforme Mpeg-Dateien:
 
Hier ein kleines Script zum automatischen konvertieren bekannter Videoformate in DVD, VCD, SVCD und PSP konforme Mpeg-Dateien:
 +
=Allgemeine Version=
 +
Voraussetzung: ffmpeg und mencoder(im mplayer Paket enthalten) müssen installiert sein, für die Ausgangsdaten eventuell weitere benötigte Codecs sollten ebenso installiert sein.
  
Voraussetzung: ffmpeg und mencoder(im mplayer Paket enthalten) müssen instaliert sein, für die Ausgangsdaten eventuell weitere benötigte Codecs sollten ebenso installiert sein.
+
Benötigter Parameter: Der Name der zu konvertierenden Datei bzw. des Ausgangsmediums.
 +
Beispiel:
 +
converterscript.sh ./meinfilm.avi
  
Benötigter Parameter: Der Name der zu konvertierenden Datei bzw. des Ausgangsmediums.
 
 
----
 
----
  
Zeile 9: Zeile 12:
  
 
* Overrideoption für die Settings über die Kommandozeile einbauen
 
* Overrideoption für die Settings über die Kommandozeile einbauen
* Parsingfunktion für Leerzeichenbehandlung im Dateinamen einbauen (geht bisher nur mit Dateinamen ohne Leerzeichen)
 
 
* Ncurses oder grafische Oberfläche dazu passend erstellen oder einbauen
 
* Ncurses oder grafische Oberfläche dazu passend erstellen oder einbauen
 
* Weitere Formate einbauen
 
* Weitere Formate einbauen
Zeile 19: Zeile 21:
 
|'''Changelog:'''
 
|'''Changelog:'''
 
|-
 
|-
|''v0.0.2''
+
|''[http://www.linux-club.de/wiki/index.php?title=Videoconverterscript&oldid=12609 v0.0.2-ccj1]''
 +
|Leerzeichen in Dateinamen akzeptieren, if[]-Tests und Struktur vereinfachen
 +
|-
 +
|''[http://www.linux-club.de/wiki/index.php?title=Videoconverterscript&direction=prev&oldid=12606 v0.0.2]''
 
|Zielformateauswahl verbessert und Prüfung auf Existenz der Zielverzeichnise eingebaut, von parallel laufender Multi-Konsolenversion auf lineare Version mit nur einem weiteren Konsolenfenster umgebaut
 
|Zielformateauswahl verbessert und Prüfung auf Existenz der Zielverzeichnise eingebaut, von parallel laufender Multi-Konsolenversion auf lineare Version mit nur einem weiteren Konsolenfenster umgebaut
 
|-
 
|-
Zeile 34: Zeile 39:
 
#!/bin/sh
 
#!/bin/sh
 
# Conversionscript for converting Videofiles to Widescreen+Fullscreen/ PAL+NTSC DVD, PAL+NTSC VCD/SVCD/XVCD, PSP Fileformat with Help of mencoder and ffmpeg
 
# Conversionscript for converting Videofiles to Widescreen+Fullscreen/ PAL+NTSC DVD, PAL+NTSC VCD/SVCD/XVCD, PSP Fileformat with Help of mencoder and ffmpeg
# V. 0.0.2
+
# V. 0.0.2-ccj1
 
#
 
#
# (c) by Tom Meierjürgen tomcatmj@web.de
+
# ccj-Fork by LC-User jengelh with permission of Mainline Creator
 +
# Mainline (c) by Tom Meierjürgen tomcatmj@web.de
 
# Licence: Creative Commons - attribution - non-commercial - sharealike
 
# Licence: Creative Commons - attribution - non-commercial - sharealike
 
#
 
#
Zeile 44: Zeile 50:
 
# Mediatype ALL, DVD, VCD or PSP
 
# Mediatype ALL, DVD, VCD or PSP
 
#
 
#
export MEDIA=ALL
+
MEDIA=ALL
 
#
 
#
 
# TV-Standards
 
# TV-Standards
 
# Choose PAL, NTSC or ALL
 
# Choose PAL, NTSC or ALL
export STANDARD=ALL
+
STANDARD=ALL
 
#
 
#
 
# Fullscreen or Widescreen or both (DVD only) (FULL, WIDE, BOTH)
 
# Fullscreen or Widescreen or both (DVD only) (FULL, WIDE, BOTH)
export VIEW=BOTH
+
VIEW=BOTH
 
#
 
#
 +
# Choose VCD, SVCD, XVCD or ALL
 
#
 
#
export CDTYPE=ALL
+
CDTYPE=ALL
 
#
 
#
 
# Targetdirectories, change values to your needs
 
# Targetdirectories, change values to your needs
export BASE=~/converted
+
BASE="~/converted";
export PSP=$BASE/PSP
+
PSP="$BASE/PSP";
export FULLDVD=$BASE/DVD/FULLSCREEN
+
FULLDVD="$BASE/DVD/FULLSCREEN";
export WIDEDVD=$BASE/DVD/WIDESCREEN
+
WIDEDVD="$BASE/DVD/WIDESCREEN";
export VCD=$BASE/VCD
+
VCD="$BASE/VCD";
export XVCD=$BASE/XVCD
+
XVCD="$BASE/XVCD";
export SVCD=$BASE/SVCD
+
SVCD="$BASE/SVCD";
 
#
 
#
 
# Initializing and conversions
 
# Initializing and conversions
Zeile 69: Zeile 76:
 
# Check if basic targetdirectory exists
 
# Check if basic targetdirectory exists
 
#
 
#
test -d $BASE || { mkdir -p $BASE ; }
+
mkdir -p "$BASE";
 +
 
 +
basename1="${1##*/}";
 
#
 
#
 
# DVD initial targetdirectory existencecheck
 
# DVD initial targetdirectory existencecheck
Zeile 77: Zeile 86:
 
# FFMpeg Fullscreen DVD
 
# FFMpeg Fullscreen DVD
 
#
 
#
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $VIEW="FULL" ] || [ $VIEW="BOTH" ] ) ) )
+
if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$VIEW" == FULL -o "$VIEW" == BOTH \) ]; then
then test -d $FULLDVD/ffmpeg/PAL || mkdir -p $FULLDVD/ffmpeg/PAL ; echo "Starting Fullscreen PAL-DVD conversion with ffmpeg..."\n && time konsole --caption "Converterscript v.0.0.2 - FFMPEG Fullscreen PAL-DVD Converting..." -e ffmpeg -i $1 -target pal-dvd -aspect 4:3 $FULLDVD/ffmpeg/PAL/$(basename $1).mpg && echo "Fullscreen PAL-DVD conversion with ffmpeg finished."\n
+
    mkdir -p "$FULLDVD/ffmpeg/PAL";
else echo "No Fullscreen PAL-DVD conversion with encodertype ffmpeg selected"
+
    echo "Starting Fullscreen PAL-DVD conversion with ffmpeg...";
 +
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG Fullscreen PAL-DVD Converting..." -e ffmpeg -i "$1" -target pal-dvd -aspect 4:3 "$FULLDVD/ffmpeg/PAL/$basename1.mpg";
 +
    echo "Fullscreen PAL-DVD conversion with ffmpeg finished.";
 +
else
 +
    echo "No Fullscreen PAL-DVD conversion with encodertype ffmpeg selected";
 
fi
 
fi
  
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD=="ALL" ] || [ $STANDARD=="NTSC" ] ) && ( [ $VIEW=="FULL" ] || [ $VIEW=="BOTH" ] ) ) )
+
if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$VIEW" == FULL -o "$VIEW" == BOTH \) ]; then
then test -d $FULLDVD/ffmpeg/NTSC || mkdir -p $FULLDVD/ffmpeg/NTSC ; echo "Starting Fullscreen NTSC-DVD conversion with ffmpeg ..."\n && time konsole --caption "Converterscript v.0.0.2 - FFMPEG Fullscreen NTSC-DVD Converting..." -e ffmpeg -i $1 -target ntsc-dvd -aspect 4:3 $FULLDVD/ffmpeg/NTSC/$(basename $1).mpg && echo "Fullscreen NTSC-DVD conversion with ffmpeg finished."\n
+
    mkdir -p "$FULLDVD/ffmpeg/NTSC";
else echo "No Fullscreen NTSC-DVD conversion with encodertype ffmpeg selected."\n
+
    echo "Starting Fullscreen NTSC-DVD conversion with ffmpeg...";
 +
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG Fullscreen NTSC-DVD Converting..." -e ffmpeg -i "$1" -target ntsc-dvd -aspect 4:3 "$FULLDVD/ffmpeg/NTSC/$basename1.mpg";
 +
    echo "Fullscreen NTSC-DVD conversion with ffmpeg finished.";
 +
else
 +
    echo "No Fullscreen NTSC-DVD conversion with encodertype ffmpeg selected.";
 
fi
 
fi
  
Zeile 90: Zeile 107:
 
# FFMpeg Widescreen DVD
 
# FFMpeg Widescreen DVD
 
#
 
#
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] ||  [ $STANDARD="PAL" ] ) && ( [ $VIEW="WIDE" ] || [ $VIEW="BOTH" ] ) ) )
+
if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$VIEW" == WIDE -o "$VIEW" == BOTH \) ]; then
then  test -d $WIDEDVD/ffmpeg/PAL || mkdir -p $WIDEDVD/ffmpeg/PAL ; echo "Starting Fullscreen NTSC-DVD conversion with ffmpeg ..."\n && time konsole  --caption "Converterscript v.0.0.2 - FFMPEG Widescreen PAL-DVD Converting..." -e ffmpeg -i $1 -target pal-dvd -aspect 16:9 $WIDEDVD/ffmpeg/PAL/$(basename $1).mpg && echo "Widescreen PAL-DVD with ffmpeg finished."\n
+
    mkdir -p "$WIDEDVD/ffmpeg/PAL";
else echo "No Widescreen PAL-DVD conversion with encodertype ffmpeg selected."\n  
+
    echo "Starting Fullscreen NTSC-DVD conversion with ffmpeg...";
 +
    time konsole  --caption "Converterscript v.0.0.2 - FFMPEG Widescreen PAL-DVD Converting..." -e ffmpeg -i "$1" -target pal-dvd -aspect 16:9 "$WIDEDVD/ffmpeg/PAL/$basename1.mpg";
 +
    echo "Widescreen PAL-DVD with ffmpeg finished.";
 +
else
 +
    echo "No Widescreen PAL-DVD conversion with encodertype ffmpeg selected.\n";
 
fi
 
fi
 
   
 
   
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) && ( [ $VIEW="WIDE" ] || [ $VIEW="BOTH" ] ) ) )
+
if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$VIEW" == WIDE -o "$VIEW" == BOTH \) ]; then
then test -d $WIDEDVD/ffmpeg/NTSC || mkdir -p $WIDEDVD/ffmpeg/NTSC ; echo "Starting Widescreen NTSC-DVD conversion with ffmpeg ..."\n && time konsole --caption "Converterscript v.0.0.2 - FFMPEG Widescreen NTSC-DVD Converting..." -e ffmpeg -i $1 -target ntsc-dvd -aspect 16:9 $WIDEDVD/ffmpeg/NTSC/$(basename $1).mpg && echo "Widescreen NTSC-DVD conversion with ffmpeg finished."\n ;
+
    mkdir -p "$WIDEDVD/ffmpeg/NTSC";
else echo "No Widescreen NTSC-DVD conversion with encodertype ffmpeg selected."\n
+
    echo "Starting Widescreen NTSC-DVD conversion with ffmpeg...";
 +
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG Widescreen NTSC-DVD Converting..." -e ffmpeg -i "$1" -target ntsc-dvd -aspect 16:9 "$WIDEDVD/ffmpeg/NTSC/$basename1.mpg";
 +
    echo "Widescreen NTSC-DVD conversion with ffmpeg finished.";
 +
else
 +
    echo "No Widescreen NTSC-DVD conversion with encodertype ffmpeg selected.";
 
fi
 
fi
  
Zeile 104: Zeile 129:
 
#  
 
#  
  
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $VIEW="FULL" ] || [ $VIEW="BOTH" ] ) ) )
+
if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$VIEW" == FULL -o "$VIEW" == BOTH \) ]; then
then test -d $FULLDVD/mencoder/PAL || mkdir -p $FULLDVD/mencoder/PAL ; echo "Starting Fullscreen PAL-DVD conversion with mencoder ..."\n && time konsole --caption "Converterscript v.0.0.2 - MENCODER Fullscreen PAL-DVD Converting..." -e time mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=352:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:acodec=ac3:abitrate=192:aspect=4/3 -ofps 25 -o $FULLDVD/mencoder/PAL/$(basename $1).mpg $1 && echo "Fullscreen PAL-DVD conversion with mencoder finished."\n ;
+
    mkdir -p "$FULLDVD/mencoder/PAL";
else echo "No Fullscreen PAL-DVD conversion with encodertype mencoder selected."\n
+
    echo "Starting Fullscreen PAL-DVD conversion with mencoder...";
 +
    time konsole --caption "Converterscript v.0.0.2 - MENCODER Fullscreen PAL-DVD Converting..." -e time mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=352:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:acodec=ac3:abitrate=192:aspect=4/3 -ofps 25 -o "$FULLDVD/mencoder/PAL/$basename1.mpg" "$1";
 +
    echo "Fullscreen PAL-DVD conversion with mencoder finished.";
 +
else
 +
    echo "No Fullscreen PAL-DVD conversion with encodertype mencoder selected.";
 
fi  
 
fi  
  
if ( ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) && ( [ $VIEW="FULL" ] || [ $VIEW="BOTH" ] ) )
+
if [ \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$VIEW" == FULL -o "$VIEW" == BOTH \) ]; then
then test -d $FULLDVD/mencoder/NTSC || mkdir -p $FULLDVD/mencoder/NTSC ; echo "Starting Fullscreen NTSC-DVD conversion with mencoder ..."\n && time konsole --caption "Converterscript v.0.0.2 - MENCODER Fullscreen NTSC-DVD Converting..." -e time mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=352:480,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:acodec=ac3:abitrate=192:aspect=4/3 -ofps 30000/1001 -o $FULLDVD/mencoder/NTSC/$(basename $1).mpg $1 && echo "Fullscreen NTSC-DVD conversion with mencoder finished."\n ;
+
    mkdir -p "$FULLDVD/mencoder/NTSC";
else echo "No Fullscreen NTSC-DVD conversion with encodertype mencoder selected."\n
+
    echo "Starting Fullscreen NTSC-DVD conversion with mencoder...";
 +
    time konsole --caption "Converterscript v.0.0.2 - MENCODER Fullscreen NTSC-DVD Converting..." -e time mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=352:480,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:acodec=ac3:abitrate=192:aspect=4/3 -ofps 30000/1001 -o "$FULLDVD/mencoder/NTSC/$basename1.mpg" "$1";
 +
    echo "Fullscreen NTSC-DVD conversion with mencoder finished.";
 +
else
 +
    echo "No Fullscreen NTSC-DVD conversion with encodertype mencoder selected.";
 
fi
 
fi
  
Zeile 118: Zeile 151:
 
#
 
#
  
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $VIEW="WIDE" ] || [ $VIEW="BOTH" ] ) ) )
+
if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$VIEW" == WIDE -o "$VIEW" == BOTH \) ]; then
then test -d $WIDEDVD/mencoder/PAL ||  mkdir -p $WIDEDVD/mencoder/PAL ; echo "Starting Widescreen PAL-DVD conversion with mencoder ..."\n && time konsole  --caption "Converterscript v.0.0.2 - MENCODER Widescreen PAL-DVD  Converting..." -e mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:acodec=ac3:abitrate=192:aspect=16/9 -ofps 25 -o $WIDEDVD/mencoder/PAL/$(basename $1).mpg $1 && echo "Widescreen PAL-DVD conversion finished."\n ;
+
    mkdir -p "$WIDEDVD/mencoder/PAL";
else echo "No Widescreen PAL-DVD conversion with encodertype mencoder selected."\n
+
    echo "Starting Widescreen PAL-DVD conversion with mencoder...";
 +
    time konsole  --caption "Converterscript v.0.0.2 - MENCODER Widescreen PAL-DVD  Converting..." -e mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:acodec=ac3:abitrate=192:aspect=16/9 -ofps 25 -o "$WIDEDVD/mencoder/PAL/$basename1.mpg" "$1";
 +
    echo "Widescreen PAL-DVD conversion finished.";
 +
else
 +
    echo "No Widescreen PAL-DVD conversion with encodertype mencoder selected.";
 
fi
 
fi
  
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) && ( [ $VIEW="WIDE" ] || [ $VIEW="BOTH" ] ) ) )
+
if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$VIEW" == WIDE -o "$VIEW" == BOTH \) ]; then
then test -d $WIDEDVD/mencoder/NTSC || mkdir -p $WIDEDVD/mencoder/NTSC ; echo "Starting Fullscreen NTSC-DVD conversion with ffmpeg ..."\n && time konsole --caption "Converterscript v.0.0.2 - MENCODER Widescreen NTSC-DVD Converting..." -e mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:acodec=ac3:abitrate=192:aspect=16/9 -ofps 30000/1001 -o $WIDEDVD/mencoder/NTSC/$(basename $1).mpg $1 && echo "Widescreen NTSC-DVD conversion finished."\n ;
+
    mkdir -p "$WIDEDVD/mencoder/NTSC";
else echo "No Widescreen NTSC-DVD conversion with encodertype mencoder selected."\n
+
    echo "Starting Fullscreen NTSC-DVD conversion with ffmpeg...";
 +
    time konsole --caption "Converterscript v.0.0.2 - MENCODER Widescreen NTSC-DVD Converting..." -e mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:acodec=ac3:abitrate=192:aspect=16/9 -ofps 30000/1001 -o "$WIDEDVD/mencoder/NTSC/$basename1.mpg" "$1";
 +
    echo "Widescreen NTSC-DVD conversion finished.";
 +
else
 +
    echo "No Widescreen NTSC-DVD conversion with encodertype mencoder selected.";
 
fi
 
fi
  
Zeile 132: Zeile 173:
 
#
 
#
  
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) &&  ( ( [  $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $CDTYPE="VCD" ] || [ $CDTYPE="ALL" ] ) ) )
+
if [ \( "$MEDIA" == ALL -o "$MEDIA" == VCD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$CDTYPE" == VCD -o "$CDTYPE" == ALL \) ]; then
then test -d $VCD/ffmpeg/PAL ||  mkdir -p $VCD/ffmpeg/PAL ; echo "Starting PAL-VCD conversion ..."\n && time konsole --caption "Converterscript v.0.0.2 - FFMPEG PAL-VCD Converting..." -e ffmpeg -i $1 -target pal-vcd $VCD/ffmpeg/PAL/$(basename $1).mpg && echo "PAL-VCD conversion finished."\n ;
+
    mkdir -p "$VCD/ffmpeg/PAL";
else echo "No PAL-VCD conversion selected."\n
+
    echo "Starting PAL-VCD conversion...";
 +
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG PAL-VCD Converting..." -e ffmpeg -i "$1" -target pal-vcd "$VCD/ffmpeg/PAL/$basename1.mpg";
 +
    echo "PAL-VCD conversion finished.";
 +
else
 +
    echo "No PAL-VCD conversion selected.";
 
fi  
 
fi  
  
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD==NTSC ] ) && ( [ $CDTYPE="VCD" ] || [ $CDTYPE="ALL" ] ) ) )
+
if [ \( "$MEDIA" == ALL -o "$MEDIA" == VCD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$CDTYPE" == VCD -o "$CDTYPE" == ALL \) ]; then
then test -d $VCD/ffmpeg/NTSC || mkdir -p $VCD/ffmpeg/NTSC ; echo "Starting NTSC-VCD conversion ..."\n && time konsole --caption "Converterscript v.0.0.2 - FFMPEG NTSC-VCD Converting..." -e time ffmpeg -i $1 -target ntsc-vcd $VCD/ffmpeg/NTSC/$(basename $1).mpg && echo "NTSC-VCD conversion finished."\n ;
+
    mkdir -p "$VCD/ffmpeg/NTSC";
else echo "No NTSC-VCD conversion selected."\n
+
    echo "Starting NTSC-VCD conversion...";
 +
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG NTSC-VCD Converting..." -e time ffmpeg -i "$1" -target ntsc-vcd "$VCD/ffmpeg/NTSC/$basename1.mpg";
 +
    echo "NTSC-VCD conversion finished.";
 +
else
 +
    echo "No NTSC-VCD conversion selected.";
 
fi
 
fi
  
Zeile 146: Zeile 195:
 
#
 
#
  
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $CDTYPE="SVCD" ] || [ $CDTYPE="ALL" ] ) ) )
+
if [ \( "$MEDIA" == ALL -o "$MEDIA" == VCD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$CDTYPE" == SVCD -o "$CDTYPE" == ALL \) ]; then
then test -d $SVCD/ffmpeg/PAL || mkdir -p $SVCD/ffmpeg/PAL ; echo "Starting PAL-SVCD conversion ..."\n && time konsole --caption "Converterscript v.0.0.2 - FFMPEG PAL-SVCD Converting..." -e ffmpeg -i $1 -target pal-svcd $SVCD/ffmpeg/PAL/$(basename $1).mpg && echo "PAL-SVCD conversion finished."\n ;
+
    mkdir -p "$SVCD/ffmpeg/PAL";
else echo "No PAL-SVCD conversion selected."\n
+
    echo "Starting PAL-SVCD conversion...";
 +
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG PAL-SVCD Converting..." -e ffmpeg -i "$1" -target pal-svcd "$SVCD/ffmpeg/PAL/$basename1.mpg";
 +
    echo "PAL-SVCD conversion finished.";
 +
else
 +
    echo "No PAL-SVCD conversion selected.";
 
fi  
 
fi  
  
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD==NTSC ] ) && ( [ $CDTYPE="SVCD" ] || [ $CDTYPE="ALL" ] ) ) )
+
if [ \( "$MEDIA" == ALL -o "$MEDIA" == VCD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$CDTYPE" == SVCD -o "$CDTYPE" == ALL \) ]; then
then test -d $SVCD/ffmpeg/NTSC || mkdir -p $SVCD/ffmpeg/NTSC ; echo "Starting NTSC-SVCD conversion ..."\n &&  time konsole --caption "Converterscript v.0.0.2 - FFMPEG NTSC-SVCD Converting..." -e ffmpeg -i $1 -target ntsc-svcd $SVCD/ffmpeg/NTSC/$(basename $1).mpg && echo "NTSC-SVCD conversion finished."\n ;
+
    mkdir -p "$SVCD/ffmpeg/NTSC";
else echo "No NTSC-SVCD conversion selected."\n
+
    echo "Starting NTSC-SVCD conversion...";
 +
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG NTSC-SVCD Converting..." -e ffmpeg -i "$1" -target ntsc-svcd "$SVCD/ffmpeg/NTSC/$basename1.mpg";
 +
    echo "NTSC-SVCD conversion finished.";
 +
else
 +
    echo "No NTSC-SVCD conversion selected.";
 
fi
 
fi
  
Zeile 160: Zeile 217:
 
#
 
#
  
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $CDTYPE="XVCD" ] || [ $CDTYPE="ALL" ] ) ) )
+
if [ \( "$MEDIA" == ALL -o "$MEDIA" == VCD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$CDTYPE" == XVCD -o "$CDTYPE" == ALL \) ]; then
then test -d $XVCD/mencoder/PAL || mkdir -p $XVCD/mencoder/PAL ; echo "Starting PAL-XVCD conversion ..."\n && time konsole --caption "Converterscript v.0.0.2 - MENCODER PAL XVCD Converting..." -e mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf scale=352:288,harddup -srate 44100 -af lavcresample=44100 -lavcopts vcodec=mpeg1video:keyint=15:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 25 -o $XVCD/mencoder/PAL/$(basename $1).mpg $1 && echo "PAL-XVCD conversion finished."\n ;
+
    mkdir -p "$XVCD/mencoder/PAL";
else echo "No PAL-XVCD conversion selected."\n
+
    echo "Starting PAL-XVCD conversion...";
 +
    time konsole --caption "Converterscript v.0.0.2 - MENCODER PAL XVCD Converting..." -e mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf scale=352:288,harddup -srate 44100 -af lavcresample=44100 -lavcopts vcodec=mpeg1video:keyint=15:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 25 -o "$XVCD/mencoder/PAL/$basename1.mpg" "$1";
 +
    echo "PAL-XVCD conversion finished.";
 +
else
 +
    echo "No PAL-XVCD conversion selected.";
 
fi
 
fi
  
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) && ( [ $CDTYPE="XVCD" ] || [ $CDTYPE="ALL" ] ) ) )
+
if [ \( "$MEDIA" == ALL -o "$MEDIA" == VCD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$CDTYPE" == XVCD -o "$CDTYPE" == ALL \) ]; then
then test -d $XVCD/mencoder/NTSC || mkdir -p $XVCD/mencoder/NTSC ; echo "Starting NTSC-XVCD conversion ..."\n && time konsole  --caption "Converterscript v.0.0.2 - MENCODER NTSC XVCD Converting..." -e mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf scale=352:240,harddup -srate 44100 -af lavcresample=44100 -lavcopts vcodec=mpeg1video:keyint=18:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 30000/1001 -o $XVCD/mencoder/NTSC/$(basename $1).mpg $1 && echo "NTSC-XVCD conversion finished."\n ;
+
    mkdir -p "$XVCD/mencoder/NTSC";
else echo "No NTSC-XVCD conversion selected."\n
+
    echo "Starting NTSC-XVCD conversion...";
 +
    time konsole  --caption "Converterscript v.0.0.2 - MENCODER NTSC XVCD Converting..." -e mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf scale=352:240,harddup -srate 44100 -af lavcresample=44100 -lavcopts vcodec=mpeg1video:keyint=18:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 30000/1001 -o "$XVCD/mencoder/NTSC/$basename1.mpg" "$1";
 +
    echo "NTSC-XVCD conversion finished.";
 +
else
 +
    echo "No NTSC-XVCD conversion selected.";
 
fi
 
fi
  
Zeile 174: Zeile 239:
 
#
 
#
  
if ( [ $MEDIA="ALL" ] || [ $MEDIA="PSP" ] )
+
if [[ "$MEDIA" == ALL || "$MEDIA" == PSP ]]; then
then test -d $PSP || mkdir -p $PSP ; echo "PSP conversion started..."\n && time konsole --caption "Converterscript v.0.0.2 - Converting for Sony PlayStationPortable..." -e ffmpeg -i $1 -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 $PSP/$(basename $1).MP4 && echo "Creating Thumbnailgraphics..."\n && time konsole --noclose --caption "Converterscript v.0.0.2 - PSP-Thumb Converting..." -e ffmpeg -y -i $1 -f ljpeg -ss 5 -vframes 1 -s 160x120 -an $PSP/$(basename $1).THM && echo "PSP Conversion finished."\n;
+
    mkdir -p "$PSP";
else echo "PSP-Conversion not selected."\n
+
    echo "PSP conversion started...";
 +
    time konsole --caption "Converterscript v.0.0.2 - Converting for Sony PlayStationPortable..." -e ffmpeg -i "$1" -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 "$PSP/$basename1.MP4";
 +
    echo "Creating thumbnail graphics...";
 +
    time konsole --noclose --caption "Converterscript v.0.0.2 - PSP-Thumb Converting..." -e ffmpeg -y -i "$1" -f ljpeg -ss 5 -vframes 1 -s 160x120 -an "$PSP/$basename1.THM";
 +
    echo "PSP Conversion finished.";
 +
else
 +
    echo "PSP-Conversion not selected.";
 
fi
 
fi
  
Zeile 183: Zeile 254:
 
#
 
#
 
 
if ( [ $MEDIA="ALL" ] || [ $MEDIA="Special" ] )
+
if [ "$MEDIA" == ALL -o "$MEDIA" == "Special" ]; then
then test -d $PSP || mkdir -p $PSP ; echo "For future special devices..not avaiable for now, so PSP conversion started..."\n && time konsole --caption "Converterscript v.0.0.2 - Converting for Sony PlayStationPortable..." -e ffmpeg -i $1 -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 $PSP/$(basename $1).MP4 && echo "Creating Thumbnailgraphics..."\n && time konsole --noclose --caption "PSP-Thumb Converting..." -e ffmpeg -y -i $1 -f ljpeg -ss 5 -vframes 1 -s 160x120 -an $PSP/$(basename $1).THM && echo "PSP Conversion finished."\n ;
+
    mkdir -p "$PSP";
else echo "PSP-Conversion not selected."\n
+
    echo "For future special devices... not available for now, so PSP conversion started...";
 +
    time konsole --caption "Converterscript v.0.0.2 - Converting for Sony PlayStationPortable..." -e ffmpeg -i "$1" -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 "$PSP/$basename1.MP4";
 +
    echo "Creating thumbnail graphics...";
 +
    time konsole --noclose --caption "PSP-Thumb Converting..." -e ffmpeg -y -i "$1" -f ljpeg -ss 5 -vframes 1 -s 160x120 -an "$PSP/$basename1.THM";
 +
    echo "PSP Conversion finished.";
 +
else
 +
    echo "PSP-Conversion not selected.";
 
fi
 
fi
  
echo "Conversions finished."\n
+
echo "Conversions finished.";
 
</pre>
 
</pre>
  
  
 
--[[Benutzer:TomcatMJ|TomcatMJ]] 10:27, 14. Mär 2007 (CET)
 
--[[Benutzer:TomcatMJ|TomcatMJ]] 10:27, 14. Mär 2007 (CET)
 +
 +
=GP2X Version=
 +
{{:Videoconverterscript/GP2X}}
 
----
 
----
 
[[Multimedia | Zurück zur Multimediaübersicht]]<br />
 
[[Multimedia | Zurück zur Multimediaübersicht]]<br />

Aktuelle Version vom 14. Juni 2012, 10:07 Uhr

Hier ein kleines Script zum automatischen konvertieren bekannter Videoformate in DVD, VCD, SVCD und PSP konforme Mpeg-Dateien:

Allgemeine Version

Voraussetzung: ffmpeg und mencoder(im mplayer Paket enthalten) müssen installiert sein, für die Ausgangsdaten eventuell weitere benötigte Codecs sollten ebenso installiert sein.

Benötigter Parameter: Der Name der zu konvertierenden Datei bzw. des Ausgangsmediums. Beispiel:

converterscript.sh ./meinfilm.avi

To-Do Liste:

  • Overrideoption für die Settings über die Kommandozeile einbauen
  • Ncurses oder grafische Oberfläche dazu passend erstellen oder einbauen
  • Weitere Formate einbauen
  • Optionale Einstellung für den Konsolentyp/Terminaltyp einbauen (bisher nur mit der KDE-Konsole laufend)

Changelog:
v0.0.2-ccj1 Leerzeichen in Dateinamen akzeptieren, if[]-Tests und Struktur vereinfachen
v0.0.2 Zielformateauswahl verbessert und Prüfung auf Existenz der Zielverzeichnise eingebaut, von parallel laufender Multi-Konsolenversion auf lineare Version mit nur einem weiteren Konsolenfenster umgebaut
v.0.0.1b Grundlegende Pfadstruktur der Zielpfade verbessert
v.0.0.1 Anfangsversion des Converterscripts

converterscript.sh

#!/bin/sh
# Conversionscript for converting Videofiles to Widescreen+Fullscreen/ PAL+NTSC DVD, PAL+NTSC VCD/SVCD/XVCD, PSP Fileformat with Help of mencoder and ffmpeg
# V. 0.0.2-ccj1
#
# ccj-Fork by LC-User jengelh with permission of Mainline Creator
# Mainline (c) by Tom Meierjürgen tomcatmj@web.de
# Licence: Creative Commons - attribution - non-commercial - sharealike
#
# Basic settings
#
#
# Mediatype ALL, DVD, VCD or PSP
#
MEDIA=ALL
#
# TV-Standards
# Choose PAL, NTSC or ALL
STANDARD=ALL
#
# Fullscreen or Widescreen or both (DVD only) (FULL, WIDE, BOTH)
VIEW=BOTH
#
# Choose VCD, SVCD, XVCD or ALL
#
CDTYPE=ALL
#
# Targetdirectories, change values to your needs
BASE="~/converted";
PSP="$BASE/PSP";
FULLDVD="$BASE/DVD/FULLSCREEN";
WIDEDVD="$BASE/DVD/WIDESCREEN";
VCD="$BASE/VCD";
XVCD="$BASE/XVCD";
SVCD="$BASE/SVCD";
#
# Initializing and conversions
#
# Check if basic targetdirectory exists
#
mkdir -p "$BASE";

basename1="${1##*/}";
#
# DVD initial targetdirectory existencecheck
#
# Check if DVD-Targetdirectories exist
#
# FFMpeg Fullscreen DVD
#
if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$VIEW" == FULL -o "$VIEW" == BOTH \) ]; then
    mkdir -p "$FULLDVD/ffmpeg/PAL";
    echo "Starting Fullscreen PAL-DVD conversion with ffmpeg...";
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG Fullscreen PAL-DVD Converting..." -e ffmpeg -i "$1" -target pal-dvd -aspect 4:3 "$FULLDVD/ffmpeg/PAL/$basename1.mpg";
    echo "Fullscreen PAL-DVD conversion with ffmpeg finished.";
else
    echo "No Fullscreen PAL-DVD conversion with encodertype ffmpeg selected";
fi

if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$VIEW" == FULL -o "$VIEW" == BOTH \) ]; then
    mkdir -p "$FULLDVD/ffmpeg/NTSC";
    echo "Starting Fullscreen NTSC-DVD conversion with ffmpeg...";
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG Fullscreen NTSC-DVD Converting..." -e ffmpeg -i "$1" -target ntsc-dvd -aspect 4:3 "$FULLDVD/ffmpeg/NTSC/$basename1.mpg";
    echo "Fullscreen NTSC-DVD conversion with ffmpeg finished.";
else
    echo "No Fullscreen NTSC-DVD conversion with encodertype ffmpeg selected.";
fi

#
# FFMpeg Widescreen DVD
#
if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$VIEW" == WIDE -o "$VIEW" == BOTH \) ]; then
    mkdir -p "$WIDEDVD/ffmpeg/PAL";
    echo "Starting Fullscreen NTSC-DVD conversion with ffmpeg...";
    time konsole  --caption "Converterscript v.0.0.2 - FFMPEG Widescreen PAL-DVD Converting..." -e ffmpeg -i "$1" -target pal-dvd -aspect 16:9 "$WIDEDVD/ffmpeg/PAL/$basename1.mpg";
    echo "Widescreen PAL-DVD with ffmpeg finished.";
else
    echo "No Widescreen PAL-DVD conversion with encodertype ffmpeg selected.\n";
fi
 
if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$VIEW" == WIDE -o "$VIEW" == BOTH \) ]; then
    mkdir -p "$WIDEDVD/ffmpeg/NTSC";
    echo "Starting Widescreen NTSC-DVD conversion with ffmpeg...";
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG Widescreen NTSC-DVD Converting..." -e ffmpeg -i "$1" -target ntsc-dvd -aspect 16:9 "$WIDEDVD/ffmpeg/NTSC/$basename1.mpg";
    echo "Widescreen NTSC-DVD conversion with ffmpeg finished.";
else
    echo "No Widescreen NTSC-DVD conversion with encodertype ffmpeg selected.";
fi

#
# Mencoder Fullscreen DVD
# 

if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$VIEW" == FULL -o "$VIEW" == BOTH \) ]; then
    mkdir -p "$FULLDVD/mencoder/PAL";
    echo "Starting Fullscreen PAL-DVD conversion with mencoder...";
    time konsole --caption "Converterscript v.0.0.2 - MENCODER Fullscreen PAL-DVD Converting..." -e time mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=352:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:acodec=ac3:abitrate=192:aspect=4/3 -ofps 25 -o "$FULLDVD/mencoder/PAL/$basename1.mpg" "$1";
    echo "Fullscreen PAL-DVD conversion with mencoder finished.";
else
    echo "No Fullscreen PAL-DVD conversion with encodertype mencoder selected.";
fi 

if [ \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$VIEW" == FULL -o "$VIEW" == BOTH \) ]; then
    mkdir -p "$FULLDVD/mencoder/NTSC";
    echo "Starting Fullscreen NTSC-DVD conversion with mencoder...";
    time konsole --caption "Converterscript v.0.0.2 - MENCODER Fullscreen NTSC-DVD Converting..." -e time mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=352:480,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:acodec=ac3:abitrate=192:aspect=4/3 -ofps 30000/1001 -o "$FULLDVD/mencoder/NTSC/$basename1.mpg" "$1";
    echo "Fullscreen NTSC-DVD conversion with mencoder finished.";
else
    echo "No Fullscreen NTSC-DVD conversion with encodertype mencoder selected.";
fi

#
# Mencoder Widescreen DVD
#

if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$VIEW" == WIDE -o "$VIEW" == BOTH \) ]; then
    mkdir -p "$WIDEDVD/mencoder/PAL";
    echo "Starting Widescreen PAL-DVD conversion with mencoder...";
    time konsole  --caption "Converterscript v.0.0.2 - MENCODER Widescreen PAL-DVD  Converting..." -e mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:acodec=ac3:abitrate=192:aspect=16/9 -ofps 25 -o "$WIDEDVD/mencoder/PAL/$basename1.mpg" "$1";
    echo "Widescreen PAL-DVD conversion finished.";
else
    echo "No Widescreen PAL-DVD conversion with encodertype mencoder selected.";
fi

if [ \( "$MEDIA" == ALL -o "$MEDIA" == DVD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$VIEW" == WIDE -o "$VIEW" == BOTH \) ]; then
    mkdir -p "$WIDEDVD/mencoder/NTSC";
    echo "Starting Fullscreen NTSC-DVD conversion with ffmpeg...";
    time konsole --caption "Converterscript v.0.0.2 - MENCODER Widescreen NTSC-DVD Converting..." -e mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:acodec=ac3:abitrate=192:aspect=16/9 -ofps 30000/1001 -o "$WIDEDVD/mencoder/NTSC/$basename1.mpg" "$1";
    echo "Widescreen NTSC-DVD conversion finished.";
else
    echo "No Widescreen NTSC-DVD conversion with encodertype mencoder selected.";
fi

#
# VCD
#

if [ \( "$MEDIA" == ALL -o "$MEDIA" == VCD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$CDTYPE" == VCD -o "$CDTYPE" == ALL \) ]; then
    mkdir -p "$VCD/ffmpeg/PAL";
    echo "Starting PAL-VCD conversion...";
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG PAL-VCD Converting..." -e ffmpeg -i "$1" -target pal-vcd "$VCD/ffmpeg/PAL/$basename1.mpg";
    echo "PAL-VCD conversion finished.";
else
    echo "No PAL-VCD conversion selected.";
fi 

if [ \( "$MEDIA" == ALL -o "$MEDIA" == VCD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$CDTYPE" == VCD -o "$CDTYPE" == ALL \) ]; then
    mkdir -p "$VCD/ffmpeg/NTSC";
    echo "Starting NTSC-VCD conversion...";
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG NTSC-VCD Converting..." -e time ffmpeg -i "$1" -target ntsc-vcd "$VCD/ffmpeg/NTSC/$basename1.mpg";
    echo "NTSC-VCD conversion finished.";
else
    echo "No NTSC-VCD conversion selected.";
fi

#
# SVCD
#

if [ \( "$MEDIA" == ALL -o "$MEDIA" == VCD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$CDTYPE" == SVCD -o "$CDTYPE" == ALL \) ]; then
    mkdir -p "$SVCD/ffmpeg/PAL";
    echo "Starting PAL-SVCD conversion...";
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG PAL-SVCD Converting..." -e ffmpeg -i "$1" -target pal-svcd "$SVCD/ffmpeg/PAL/$basename1.mpg";
    echo "PAL-SVCD conversion finished.";
else
    echo "No PAL-SVCD conversion selected.";
fi 

if [ \( "$MEDIA" == ALL -o "$MEDIA" == VCD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$CDTYPE" == SVCD -o "$CDTYPE" == ALL \) ]; then
    mkdir -p "$SVCD/ffmpeg/NTSC";
    echo "Starting NTSC-SVCD conversion...";
    time konsole --caption "Converterscript v.0.0.2 - FFMPEG NTSC-SVCD Converting..." -e ffmpeg -i "$1" -target ntsc-svcd "$SVCD/ffmpeg/NTSC/$basename1.mpg";
    echo "NTSC-SVCD conversion finished.";
else
    echo "No NTSC-SVCD conversion selected.";
fi

#
# XVCD
#

if [ \( "$MEDIA" == ALL -o "$MEDIA" == VCD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == PAL \) -a \( "$CDTYPE" == XVCD -o "$CDTYPE" == ALL \) ]; then
    mkdir -p "$XVCD/mencoder/PAL";
    echo "Starting PAL-XVCD conversion...";
    time konsole --caption "Converterscript v.0.0.2 - MENCODER PAL XVCD Converting..." -e mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf scale=352:288,harddup -srate 44100 -af lavcresample=44100 -lavcopts vcodec=mpeg1video:keyint=15:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 25 -o "$XVCD/mencoder/PAL/$basename1.mpg" "$1";
    echo "PAL-XVCD conversion finished.";
else
    echo "No PAL-XVCD conversion selected.";
fi

if [ \( "$MEDIA" == ALL -o "$MEDIA" == VCD \) -a \( "$STANDARD" == ALL -o "$STANDARD" == NTSC \) -a \( "$CDTYPE" == XVCD -o "$CDTYPE" == ALL \) ]; then
    mkdir -p "$XVCD/mencoder/NTSC";
    echo "Starting NTSC-XVCD conversion...";
    time konsole  --caption "Converterscript v.0.0.2 - MENCODER NTSC XVCD Converting..." -e mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf scale=352:240,harddup -srate 44100 -af lavcresample=44100 -lavcopts vcodec=mpeg1video:keyint=18:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 30000/1001 -o "$XVCD/mencoder/NTSC/$basename1.mpg" "$1";
    echo "NTSC-XVCD conversion finished.";
else
    echo "No NTSC-XVCD conversion selected.";
fi

#
# PSP
#

if [[ "$MEDIA" == ALL || "$MEDIA" == PSP ]]; then
    mkdir -p "$PSP";
    echo "PSP conversion started...";
    time konsole --caption "Converterscript v.0.0.2 - Converting for Sony PlayStationPortable..." -e ffmpeg -i "$1" -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 "$PSP/$basename1.MP4";
    echo "Creating thumbnail graphics...";
    time konsole --noclose --caption "Converterscript v.0.0.2 - PSP-Thumb Converting..." -e ffmpeg -y -i "$1" -f ljpeg -ss 5 -vframes 1 -s 160x120 -an "$PSP/$basename1.THM";
    echo "PSP Conversion finished.";
else
    echo "PSP-Conversion not selected.";
fi

#
# Special
#
	
if [ "$MEDIA" == ALL -o "$MEDIA" == "Special" ]; then
    mkdir -p "$PSP";
    echo "For future special devices... not available for now, so PSP conversion started...";
    time konsole --caption "Converterscript v.0.0.2 - Converting for Sony PlayStationPortable..." -e ffmpeg -i "$1" -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 "$PSP/$basename1.MP4";
    echo "Creating thumbnail graphics...";
    time konsole --noclose --caption "PSP-Thumb Converting..." -e ffmpeg -y -i "$1" -f ljpeg -ss 5 -vframes 1 -s 160x120 -an "$PSP/$basename1.THM";
    echo "PSP Conversion finished.";
else
    echo "PSP-Conversion not selected.";
fi

echo "Conversions finished.";


--TomcatMJ 10:27, 14. Mär 2007 (CET)

GP2X Version

Dies ist die GP2X-Only Version des Videoconverterscript zur Konvertierung von Videodateien in das Format der GP2X Handheld-Spielekonsole, die auf Linux basiert und XviD oder OGG-Theora Dateien abspielen kann.

Benötigt werden mencoder, ffmpeg, ffmpeg2theora sowie die Codecs, die normalerweise auch zum Abspielen des jeweiligen Videomaterials benötigt würden (nur sofern dazu überhaupt Zusatzcodecs nötig sind, abhängig vom jeweiligen Videomaterial).

converterscript-0.2.pre-c-gp2x-only.sh

#!/bin/sh
# Conversionscript for converting Videofiles to GP2X  Fileformat with Help of mencoder, ffmpeg and ffmpeg2theora
# V. 0.0.2
#
# (c) by Tom Meierjürgen tomcatmj@web.de
# Licence: Creative Commons - attribution - non-commercial - sharealike
#
# Basic settings
#
#
# Mediatype ALL, XVID-GP2X or OGM-GP2X
#
export MEDIA=ALL
#
# TV-Standards
# Choose PAL, NTSC or ALL
export STANDARD=ALL

# Targetdirectories, change values to your needs
export BASE=~/converted
export GP2X=$BASE/GP2X
export DIVXGP2X=$GP2X/DivX
export XVIDGP2X=$GP2X/XviD
export OGMGP2X=$GP2X/OGM
export FILE=$1

test -d $BASE || { mkdir -p $BASE ; }

#
# GP2X XviD PAL
#

if  ( ( [ $MEDIA="ALL" ] || [ $MEDIA="XVID-GP2X" ] ) &&  ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) )
 then test -d $XVIDGP2X/PAL || mkdir -p $XVIDGP2X/PAL ; echo "GP2X XviD PAL conversion started..."\n && time konsole --caption "Converterscript v.0.0.2 - Converting XviD PAL for GP2X Console..." -e ffmpeg -i $FILE -vcodec xvid -r 25 -s 720x576 -b 2500K -ar 48000 -ac 2 -ab 384 $XVIDGP2X/PAL/$(basename $FILE).avi ;
 # && echo "Creating Thumbnailgraphics..."\n && time konsole --noclose --caption "Converterscript v.0.0.2 - GP2X-Thumb Converting..." -e ffmpeg -y -i $FILE -f jpegls -ss 5 -vframes 1 -s 160x120 -an $XVIDGP2X/PAL/$(basename $FILE).THM &&
 echo "GP2X XviD PAL Conversion finished."\n;
else echo "GP2X XviD PAL Conversion not selected."\n
fi

#
# GP2X Ogg-Theora PAL
#

if  ( ( [ $MEDIA="ALL" ] || [ $MEDIA="OGM-GP2X" ] )  &&  ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) )
 then test -d $OGMGP2X/PAL || mkdir -p $OGMGP2X/PAL ; echo "GP2X Ogg-Theora PAL conversion started..."\n && time konsole --caption "Converterscript v.0.0.2 - Converting Ogg-Theora PAL for GP2X Console..." -e ffmpeg2theora   -x 720 -y 576 -V 2500  -H 48000 -A 384 -c 2 -F 25 -o  $OGMGP2X/PAL/$(basename $FILE).ogm $FILE ;
 # && echo "Creating Thumbnailgraphics..."\n && time konsole --noclose --caption "Converterscript v.0.0.2 - GP2X-Thumb Converting..." -e ffmpeg -y -i $FILE -f jpegls -ss 5 -vframes 1 -s 160x120 -an $OGMGP2X/PAL/$(basename $FILE).THM &&
 echo "GP2X Ogg-Theora Conversion finished."\n;
else echo "GP2X Ogg-Theora PAL Conversion not selected."\n
fi

#
# GP2X XviD NTSC
#

if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="XVID-GP2X" ] ) &&  ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) )
 then test -d $XVIDGP2X/NTSC || mkdir -p $XVIDGP2X/NTSC ; echo "GP2X XviD NTSC conversion started..."\n && time konsole --caption "Converterscript v.0.0.2 - Converting XviD NTSC for GP2X Console..." -e ffmpeg -i $FILE -vcodec xvid -r 30 -s 720x480 -b 2500K -ar 48000 -ac 2 -ab 384 $XVIDGP2X/NTSC/$(basename $FILE).avi ;
 # && echo "Creating Thumbnailgraphics..."\n && time konsole --noclose --caption "Converterscript v.0.0.2 - GP2X-Thumb Converting..." -e ffmpeg -y -i $FILE -f jpegls -ss 5 -vframes 1 -s 160x120 -an $XVIDGP2X/NTSC/$(basename $FILE).THM &&
 echo "GP2X XviD Conversion finished."\n;
else echo "GP2X XviD NTSC Conversion not selected."\n
fi

#
# GP2X Ogg-Theora NTSC
#

if  ( ( [ $MEDIA="ALL" ] || [ $MEDIA="OGM-GP2X" ] )  &&  ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) )
 then test -d $OGMGP2X/NTSC || mkdir -p $OGMGP2X/NTSC ; echo "GP2X Ogg-Theora NTSC conversion started..."\n && time konsole --caption "Converterscript v.0.0.2 - Converting Ogg-Theora NTSC for GP2X Console..." -e ffmpeg2theora   -x 720 -y 480 -V 2500  -H 48000 -A 384 -c 2 -F 30 -o  $OGMGP2X/NTSC/$(basename $FILE).ogm $FILE ;
 # && echo "Creating Thumbnailgraphics..."\n && time konsole --noclose --caption "Converterscript v.0.0.2 - GP2X-Thumb Converting..." -e ffmpeg -y -i $FILE -f jpegls -ss 5 -vframes 1 -s 160x120 -an $OGMGP2X/NTSC/$(basename $FILE).THM &&
 echo "GP2X Ogg-Theora Conversion finished."\n;
else echo "GP2X Ogg-Theora NTSC Conversion not selected."\n
fi

echo "Conversions finished."\n

Zurück zur Multimediaübersicht
Zurück zur Shellscripteübersicht
Zurück zu "Videokonvertierung und DVD oder SVCD erstellen"