Videoconverterscript: Unterschied zwischen den Versionen

Aus Linupedia.org
Wechseln zu: Navigation, Suche
K (Scriptaktualisierung und Navigationslinks eingefügt)
(Videoconverterscript aktualisiert)
Zeile 4: Zeile 4:
  
 
Benötigter Parameter: Der Name der zu konvertierenden Datei bzw. des Ausgangsmediums.  
 
Benötigter Parameter: Der Name der zu konvertierenden Datei bzw. des Ausgangsmediums.  
 +
----
  
 +
'''To-Do Liste:'''
 +
 +
* 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
 +
* Weitere Formate einbauen
 +
* Optionale Einstellung für den Konsolentyp/Terminaltyp einbauen (bisher nur mit der DE-Konsole laufend)
 +
 +
----
 +
 
{|-
 
{|-
 
|'''Changelog:'''
 
|'''Changelog:'''
 
|-
 
|-
|''v.0.0.1b''
+
|''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
 +
|-
 +
|''[http://www.linux-club.de/wiki/index.php?title=Videoconverterscript&direction=next&oldid=5845 v.0.0.1b]''
 
|Grundlegende Pfadstruktur der Zielpfade verbessert
 
|Grundlegende Pfadstruktur der Zielpfade verbessert
 
|-
 
|-
|''v.0.0.1''
+
|''[http://www.linux-club.de/wiki/index.php?title=Videoconverterscript&oldid=2970 v.0.0.1]''
 
|Anfangsversion des Converterscripts
 
|Anfangsversion des Converterscripts
 
|-
 
|-
Zeile 17: Zeile 31:
 
converterscript.sh
 
converterscript.sh
 
<pre>
 
<pre>
 
 
#!/bin/sh
 
#!/bin/sh
# Conversionscript for converting Videofiles to Widescreen+Fullscreen/
+
# Conversionscript for converting Videofiles to Widescreen+Fullscreen/ PAL+NTSC DVD, PAL+NTSC VCD/SVCD/XVCD, PSP Fileformat with Help of mencoder and ffmpeg
# PAL+NTSC DVD, PAL+NTSC VCD+ SVCD, PSP Fileformat with Help of mencoder and ffmpeg
+
# V. 0.0.2
# (c) by Tom Meierjrgen tomcatmj@web.de
+
#
 +
# (c) by Tom Meierjürgen tomcatmj@web.de
 
# Licence: Creative Commons - attribution - non-commercial - sharealike
 
# Licence: Creative Commons - attribution - non-commercial - sharealike
# V. 0.0.1b
+
#
 +
# Basic settings
 +
#
 +
#
 +
# Mediatype ALL, DVD, VCD or PSP
 +
#
 +
export MEDIA=ALL
 +
#
 +
# TV-Standards
 +
# Choose PAL, NTSC or ALL
 +
export STANDARD=ALL
 +
#
 +
# Fullscreen or Widescreen or both (DVD only) (FULL, WIDE, BOTH)
 +
export VIEW=BOTH
 
#
 
#
 
#
 
#
# Changes: Targetdirectorystructure reorganized,
+
export CDTYPE=ALL
#         removed anoying garbage from previous structur
+
#
 
+
# Targetdirectories, change values to your needs
# Configuration of basical directorystructure settings
 
# (freely editable for individual purposes)
 
 
 
 
export BASE=~/converted
 
export BASE=~/converted
 
export PSP=$BASE/PSP
 
export PSP=$BASE/PSP
Zeile 39: Zeile 63:
 
export XVCD=$BASE/XVCD
 
export XVCD=$BASE/XVCD
 
export SVCD=$BASE/SVCD
 
export SVCD=$BASE/SVCD
 +
#
 +
# Initializing and conversions
 +
#
 +
# Check if basic targetdirectory exists
 +
#
 +
test -d $BASE || { mkdir -p $BASE ; }
 +
#
 +
# DVD initial targetdirectory existencecheck
 +
#
 +
# Check if DVD-Targetdirectories exist
 +
#
 +
# FFMpeg Fullscreen DVD
 +
#
 +
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] )  && ( [ $VIEW="FULL" ] || [ $VIEW="BOTH" ] ) ) )
 +
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
 +
else echo "No Fullscreen PAL-DVD conversion with encodertype ffmpeg selected"
 +
fi
 +
 +
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD=="ALL" ] || [ $STANDARD=="NTSC" ] )  && ( [ $VIEW=="FULL" ] || [ $VIEW=="BOTH" ] ) ) )
 +
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
 +
else echo "No Fullscreen NTSC-DVD conversion with encodertype ffmpeg selected."\n
 +
fi
 +
 +
#
 +
# FFMpeg Widescreen DVD
 +
#
 +
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] ||  [ $STANDARD="PAL" ] ) && ( [ $VIEW="WIDE" ] || [ $VIEW="BOTH" ] ) ) )
 +
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
 +
else echo "No Widescreen PAL-DVD conversion with encodertype ffmpeg selected."\n
 +
fi
 +
 +
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) && ( [ $VIEW="WIDE" ] || [ $VIEW="BOTH" ] ) ) )
 +
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 ;
 +
else echo "No Widescreen NTSC-DVD conversion with encodertype ffmpeg selected."\n
 +
fi
  
# Initializing previous configured directorystructure
+
#
 +
# Mencoder Fullscreen DVD
 +
#
  
mkdir -p $BASE
+
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $VIEW="FULL" ] || [ $VIEW="BOTH" ] ) ) )
mkdir -p $PSP
+
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/PAL/ffmpeg
+
else echo "No Fullscreen PAL-DVD conversion with encodertype mencoder selected."\n
mkdir -p $WIDEDVD/PAL/ffmpeg
+
fi
mkdir -p $VCD/PAL/ffmpeg
 
mkdir -p $SVCD/PAL/ffmpeg
 
mkdir -p $FULLDVD/NTSC/ffmpeg
 
mkdir -p $WIDEDVD/NTSC/ffmpeg
 
mkdir -p $VCD/NTSC/ffmpeg
 
mkdir -p $SVCD/NTSC/ffmpeg
 
mkdir -p $FULLDVD/PAL/mencoder
 
mkdir -p $WIDEDVD/PAL/mencoder
 
mkdir -p $XVCD/PAL/mencoder
 
mkdir -p $FULLDVD/NTSC/mencoder
 
mkdir -p $WIDEDVD/NTSC/mencoder
 
mkdir -p $XVCD/NTSC/mencoder
 
  
# Conversion begins here :
+
if ( ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) && ( [ $VIEW="FULL" ] || [ $VIEW="BOTH" ] ) )
 +
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 ;
 +
else echo "No Fullscreen NTSC-DVD conversion with encodertype mencoder selected."\n
 +
fi
  
#PSP-Filmconversion
+
#
konsole --noclose --caption "PSP-Film Converting..." -e ffmpeg -i $1 -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 $PSP/$(basename $1).MP4 &
+
# Mencoder Widescreen DVD
konsole --noclose --caption "PSP-Thumb Converting..." -e ffmpeg -y -i $1 -f ljpeg -ss 5 -vframes 1 -s 160x120 -an $PSP/$(basename $1).THM &
+
#
  
#mencoder PAL Widescreen DVD Conversion
+
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $VIEW="WIDE" ] || [ $VIEW="BOTH" ] ) ) )
konsole --noclose --caption "MENCODER PAL Widescreen DVD  Converting..." -e time 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/PAL/mencoder/$(basename $1).mpg $1 &
+
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 ;
 +
else echo "No Widescreen PAL-DVD conversion with encodertype mencoder selected."\n
 +
fi
  
#mencoder PAL Fullscreen DVD Conversion
+
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) && ( [ $VIEW="WIDE" ] || [ $VIEW="BOTH" ] ) ) )
konsole --noclose --caption "MENCODER PAL Fullscreen 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/PAL/mencoder/$(basename $1).mpg $1 &
+
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 ;
 +
else echo "No Widescreen NTSC-DVD conversion with encodertype mencoder selected."\n
 +
fi
 +
 
 +
#
 +
# VCD
 +
#
  
#mencoder PAL XVCD Conversion
+
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) &&  ( ( [  $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $CDTYPE="VCD" ] || [ $CDTYPE="ALL" ] ) ) )
konsole --noclose --caption "MENCODER PAL XVCD Converting..." -e time 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/PAL/mencoder/$(basename $1).mpg $1 &
+
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 ;
 +
else echo "No PAL-VCD conversion selected."\n
 +
fi
  
#mencoder NTSC Widescreen DVD Conversion
+
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD==NTSC ] ) && ( [ $CDTYPE="VCD" ] || [ $CDTYPE="ALL" ] ) ) )
konsole --noclose --caption "MENCODER NTSC Widescreen DVD Converting..." -e time 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/NTSC/mencoder/$(basename $1).mpg $1 &
+
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 ;
 +
else echo "No NTSC-VCD conversion selected."\n
 +
fi
  
#mencoder NTSC Fullscreen DVD Conversion
+
#
konsole --noclose --caption "MENCODER NTSC Fullscreen 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/NTSC/mencoder/$(basename $1).mpg $1 &
+
# SVCD
 +
#
  
#mencoder NTSC XVCD Conversion
+
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $CDTYPE="SVCD" ] || [ $CDTYPE="ALL" ] ) ) )
konsole --noclose --caption "MENCODER NTSC XVCD Converting..." -e time 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/NTSC/mencoder/$(basename $1).mpg $1 &
+
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 ;
 +
else echo "No PAL-SVCD conversion selected."\n
 +
fi
  
#ffmpeg PAL Widescreen DVD Conversion
+
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD==NTSC ] ) && ( [ $CDTYPE="SVCD" ] || [ $CDTYPE="ALL" ] ) ) )
konsole --noclose --caption "FFMPEG PAL Widescreen DVD Converting..." -e time ffmpeg -i $1 -target pal-dvd -aspect 16:9 $WIDEDVD/PAL/ffmpeg/$(basename $1).mpg &
+
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 ;
 +
else echo "No NTSC-SVCD conversion selected."\n
 +
fi
  
#ffmpeg PAL Fullscreen DVD Conversion
+
#
konsole --noclose --caption "FFMPEG PAL Fullscreen DVD Converting..." -e time ffmpeg -i $1 -target pal-dvd -aspect 4:3 $FULLDVD/PAL/ffmpeg/$(basename $1).mpg &
+
# XVCD
 +
#
  
#ffmpeg PAL SVCD Conversion
+
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $CDTYPE="XVCD" ] || [ $CDTYPE="ALL" ] ) ) )
konsole --noclose --caption "FFMPEG PAL SVCD Converting..." -e time ffmpeg -i $1 -target pal-svcd $SVCD/PAL/ffmpeg/$(basename $1).mpg &
+
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 ;
 +
else echo "No PAL-XVCD conversion selected."\n
 +
fi
  
#ffmpeg PAL VCD Conversion
+
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) && ( [ $CDTYPE="XVCD" ] || [ $CDTYPE="ALL" ] ) ) )
konsole --noclose --caption "FFMPEG PAL VCD Converting..." -e time ffmpeg -i $1 -target pal-vcd $VCD/PAL/ffmpeg/$(basename $1).mpg &
+
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 ;
 +
else echo "No NTSC-XVCD conversion selected."\n
 +
fi
  
#ffmpeg NTSC Widescreen DVD Conversion
+
#
konsole --noclose --caption "FFMPEG NTSC Widescreen DVD Converting..." -e time ffmpeg -i $1 -target ntsc-dvd -aspect 16:9 $WIDEDVD/NTSC/ffmpeg/$(basename $1).mpg &
+
# PSP
 +
#
  
#ffmpeg NTSC Fullscreen DVD Conversion
+
if  ( [ $MEDIA="ALL" ] || [ $MEDIA="PSP" ] )
konsole --noclose --caption "FFMPEG NTSC Fullscreen DVD Converting..." -e time ffmpeg -i $1 -target ntsc-dvd -aspect 4:3 $FULLDVD/NTSC/ffmpeg/$(basename $1).mpg &
+
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;
 +
else echo "PSP-Conversion not selected."\n
 +
fi
  
#ffmpeg NTSC SVCD Conversion
+
#
konsole --noclose --caption "FFMPEG NTSC SVCD Converting..." -e time ffmpeg -i $1 -target ntsc-svcd $SVCD/NTSC/ffmpeg/$(basename $1).mpg &
+
# Special
 +
#
 +
 +
if  ( [ $MEDIA="ALL" ] || [ $MEDIA="Special" ] )
 +
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 ;
 +
else echo "PSP-Conversion not selected."\n
 +
fi
  
#ffmpeg NTSC VCD Conversion
+
echo "Conversions finished."\n
konsole --noclose --caption "FFMPEG NTSC VCD Converting..." -e time ffmpeg -i $1 -target ntsc-vcd $VCD/NTSC/ffmpeg/$(basename $1).mpg &
 
 
</pre>
 
</pre>
  
--[[Benutzer:TomcatMJ|TomcatMJ]] 05:55, 11. Mär 2007 (CET)
+
 
 +
--[[Benutzer:TomcatMJ|TomcatMJ]] 10:27, 14. Mär 2007 (CET)
 
----
 
----
 
[[Multimedia | Zurück zur Multimediaübersicht]]<br />
 
[[Multimedia | Zurück zur Multimediaübersicht]]<br />

Version vom 14. März 2007, 09:27 Uhr

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

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.


To-Do Liste:

  • 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
  • Weitere Formate einbauen
  • Optionale Einstellung für den Konsolentyp/Terminaltyp einbauen (bisher nur mit der DE-Konsole laufend)

Changelog:
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
#
# (c) by Tom Meierjürgen tomcatmj@web.de
# Licence: Creative Commons - attribution - non-commercial - sharealike
#
# Basic settings
#
#
# Mediatype ALL, DVD, VCD or PSP
#
export MEDIA=ALL
#
# TV-Standards
# Choose PAL, NTSC or ALL
export STANDARD=ALL
#
# Fullscreen or Widescreen or both (DVD only) (FULL, WIDE, BOTH)
export VIEW=BOTH
#
#
export CDTYPE=ALL
#
# Targetdirectories, change values to your needs
export BASE=~/converted
export PSP=$BASE/PSP
export FULLDVD=$BASE/DVD/FULLSCREEN
export WIDEDVD=$BASE/DVD/WIDESCREEN
export VCD=$BASE/VCD
export XVCD=$BASE/XVCD
export SVCD=$BASE/SVCD
#
# Initializing and conversions
#
# Check if basic targetdirectory exists
#
test -d $BASE || { mkdir -p $BASE ; }
#
# DVD initial targetdirectory existencecheck
#
# Check if DVD-Targetdirectories exist
#
# FFMpeg Fullscreen DVD
#
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] )  && ( [ $VIEW="FULL" ] || [ $VIEW="BOTH" ] ) ) )
 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 
 else echo "No Fullscreen PAL-DVD conversion with encodertype ffmpeg selected"
fi

if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD=="ALL" ] || [ $STANDARD=="NTSC" ] )  && ( [ $VIEW=="FULL" ] || [ $VIEW=="BOTH" ] ) ) )
 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 
else echo "No Fullscreen NTSC-DVD conversion with encodertype ffmpeg selected."\n
fi

#
# FFMpeg Widescreen DVD
#
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] ||  [ $STANDARD="PAL" ] ) && ( [ $VIEW="WIDE" ] || [ $VIEW="BOTH" ] ) ) )
 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 
 else echo "No Widescreen PAL-DVD conversion with encodertype ffmpeg selected."\n 
fi
 
if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) && ( [ $VIEW="WIDE" ] || [ $VIEW="BOTH" ] ) ) )
 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 ;
else echo "No Widescreen NTSC-DVD conversion with encodertype ffmpeg selected."\n
fi

#
# Mencoder Fullscreen DVD
# 

if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $VIEW="FULL" ] || [ $VIEW="BOTH" ] ) ) )
 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 ;
else echo "No Fullscreen PAL-DVD conversion with encodertype mencoder selected."\n
fi 

if ( ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) && ( [ $VIEW="FULL" ] || [ $VIEW="BOTH" ] ) )
 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 ;
else echo "No Fullscreen NTSC-DVD conversion with encodertype mencoder selected."\n
fi

#
# Mencoder Widescreen DVD
#

if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $VIEW="WIDE" ] || [ $VIEW="BOTH" ] ) ) )
 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 ;
else echo "No Widescreen PAL-DVD conversion with encodertype mencoder selected."\n
fi

if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="DVD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) && ( [ $VIEW="WIDE" ] || [ $VIEW="BOTH" ] ) ) )
 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 ;
else echo "No Widescreen NTSC-DVD conversion with encodertype mencoder selected."\n
fi

#
# VCD
#

if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) &&  ( ( [  $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $CDTYPE="VCD" ] || [ $CDTYPE="ALL" ] ) ) )
 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 ;
else echo "No PAL-VCD conversion selected."\n
fi 

if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD==NTSC ] ) && ( [ $CDTYPE="VCD" ] || [ $CDTYPE="ALL" ] ) ) )
 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 ;
else echo "No NTSC-VCD conversion selected."\n
fi

#
# SVCD
#

if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $CDTYPE="SVCD" ] || [ $CDTYPE="ALL" ] ) ) )
 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 ;
else echo "No PAL-SVCD conversion selected."\n
fi 

if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD==NTSC ] ) && ( [ $CDTYPE="SVCD" ] || [ $CDTYPE="ALL" ] ) ) )
 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 ;
else echo "No NTSC-SVCD conversion selected."\n
fi

#
# XVCD
#

if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="PAL" ] ) && ( [ $CDTYPE="XVCD" ] || [ $CDTYPE="ALL" ] ) ) )
 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 ;
else echo "No PAL-XVCD conversion selected."\n
fi

if ( ( [ $MEDIA="ALL" ] || [ $MEDIA="VCD" ] ) && ( ( [ $STANDARD="ALL" ] || [ $STANDARD="NTSC" ] ) && ( [ $CDTYPE="XVCD" ] || [ $CDTYPE="ALL" ] ) ) )
 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 ;
else echo "No NTSC-XVCD conversion selected."\n
fi

#
# PSP
#

if  ( [ $MEDIA="ALL" ] || [ $MEDIA="PSP" ] ) 
 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;
else echo "PSP-Conversion not selected."\n
fi

#
# Special
#
	
if  ( [ $MEDIA="ALL" ] || [ $MEDIA="Special" ] ) 
 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 ;
else echo "PSP-Conversion not selected."\n
fi

echo "Conversions finished."\n


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


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


--