Videohokuspokus mit ffmpeg ========================== http://spielwiese.la-evento.com/hokuspokus/index.html#main ffmpeg ist ein Kommandozeilen-Tool zur Konvertierung aller gängigen Codecs - quasi ein schweizer Taschenmesser der Video- und Audio-Bearbeitung. Zuhause ist das Projekt auf ffmpeg.mplayerhq.hu Auf meiner Suche nach irgendeinem Linux-Tool zum Umwandeln von Video-Dateien, musste ich feststellen, dass ffmpeg zwar alles kann, aber leider schlecht dokumentiert ist. Das hat mich veranlasst, hier ein paar praxisnahe Beispiele zusammenzustellen (ziemlich unsortiert). Wichtig: Es gibt Unterschiede zwischen der Windows- und der Linux-Version von ffmpeg. Darum möchte ich klarstellen, dass es hier ausschließlich um Linux geht. --- tbn = the time base in AVStream that has come from the container tbc = the time base in AVCodecContext for the codec used for a particular stream tbr = tbr is guessed from the video stream and is the value users want to see when they look for the video frame rate This was also asked on the FFmpeg mailing lists: What does the output of ffmpeg mean? tbr tbn tbc etc? (http://ffmpeg-users.933282.n4.nabble.com/What-does-the-output-of-ffmpeg-mean-tbr-tbn-tbc-etc-td941538.html) (http://stackoverflow.com/questions/3199489/meaning-of-ffmpeg-output-tbc-tbn-tbr) --- http://sonnati.wordpress.com/2011/07/11/ffmpeg-the-swiss-army-knife-of-internet-streaming-part-i/ FFmpeg – the swiss army knife of Internet Streaming – part I - V Fortgeschritten, anspruchsvoll, Beispiele funktionieren nicht immer, zeigt Moeglichkeiten ------------------------------------------------------ examples: # extracts all audio from .flv files in whole dir to .mp3 echo Params: $# echo if test $# -eq 2; then # echo "mplayer -dumpaudio $1 -dumpfile $2" echo "ffmpeg -i $1 -ab 128 -ar 44100 $2" echo # mplayer -dumpaudio "$1" -dumpfile "$2" ffmpeg -i "$1" -ab 128 -ar 44100 "$2" else echo "$# Params" echo "Usage: $0 infile outfile" fi -------------------------------------------------- # Videodatei zu extrahieren ffmpeg -i Videodatei.avi -vn Tonspur.wav ffmpeg -i aaa.mp4 -ab 128 -ar 44100 aaa.mp3 ffmpeg -i aaa.flv -ab 128 -ar 44100 aaa.mp3 ------------------------------------------ !/bin/bash # echo $1 $2 # shows only 1. + 2. file in dir # echo * # shows all files in dir in 1 line for i in *.flv; do <------>j=${i%flv} <------>j=${j}wav #<-----><------>echo "$i @@@ $j" <------>if test ! -e "$j"; then <------><------> ffmpeg -i "$i" -vn "$j" <------>fi done for i in *.mp4; do <------>j=${i%mp4} <------>j=${j}wav #<-----><------>echo "$i @@@ $j" <------>if test ! -e "$j"; then <------><------> ffmpeg -i "$i" -vn "$j" <------>fi done for i in *.avi; do <------>j=${i%avi} <------>j=${j}wav #<-----><------>echo "$i @@@ $j" <------>if test ! -e "$j"; then <------><------> ffmpeg -i "$i" -vn "$j" <------>fi done -------------------------------------------see extract-audio-by-ffmpeg