diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/README | 31 | ||||
-rw-r--r-- | tools/TODO | 10 | ||||
-rwxr-xr-x | tools/audio_channels_diff | 41 | ||||
-rw-r--r-- | tools/audio_format | 9 | ||||
-rwxr-xr-x | tools/convert2theora | 10 | ||||
-rw-r--r-- | tools/convert2vorbis | 45 | ||||
-rw-r--r-- | tools/cut_video | 1 | ||||
-rw-r--r-- | tools/extract_audio | 10 | ||||
-rwxr-xr-x | tools/fade | 42 | ||||
-rwxr-xr-x | tools/fade.sh | 25 | ||||
-rw-r--r-- | tools/image2video | 3 | ||||
-rwxr-xr-x | tools/intro | 28 | ||||
-rwxr-xr-x | tools/outro | 27 | ||||
-rw-r--r-- | tools/process-video | 22 |
14 files changed, 243 insertions, 61 deletions
diff --git a/tools/README b/tools/README new file mode 100644 index 0000000..1fc4422 --- /dev/null +++ b/tools/README @@ -0,0 +1,31 @@ +README + +Dette er en samling av små-verktøy for postprod av video-opptak, +laget spesielt med tanke på NUUGs videogruppe. + +"process-video" vil for øyeblikket utføre følgene: +* Generere intro- og outro-video med informasjon fra en csv-fil. +* Kombinere disse to sammen med orginal videoen. +* Konvertere til Ogg Theora og Vorbis - med metadata fra en csv-fil. + +Advarsel: Aldri jobb direkte med orginalfilen(e), scriptene kan + variere av kvalitet. :) + +Du vil alltid finne den nyeste versjon av verktøyene i SVN: + svn co svn+ssh://nerdhaven.nuug.no/data/video/svnroot/trunk/tools + +Arbeidsflyt + +1. Kopier template.csv til en ny fil og rediger etter behov. +1.1. Tips: Bruk gjerne OpenOffice.org Spreadsheet til oppgaven. +1.2. CSV-filen kan innholde en eller flere felt med "Takk" og "URL". +1.3. Pass på at "Filename" stemmer overens med video-filen du skal bearbeide. +2. Kopier inn videoen(e) du skal arbeide med inn i mappen. +3. Kjør: ./process-video <video-fil> <csv-fil> + +Når scriptet er ferdig, vil det ligge en Ogg Theora og Vorbis utgave +klar til opplastning/publisering. :) + +-- +Ole Kristian Lien (oklien) <oklien@nuug.no> +NUUGs videogruppe diff --git a/tools/TODO b/tools/TODO new file mode 100644 index 0000000..0ccb9b7 --- /dev/null +++ b/tools/TODO @@ -0,0 +1,10 @@ +TODO + +* Små fikser og mulighet for å liste alle rader i csv-filen +* Kopier funksjoner i fra http://wiki.nuug.no/grupper/video/scripts +* Konverter til flere formater (samt tilpasset til vimeo, youtube, etc) +* Opplastning til f.eks: vimeo, youtube, google video, wikipedia commons, etc +* Annonserings scripts; e-post, rss, twitter, identica, linkedin, etc +* Oppsett av dvswitch i fra cvs-fil +* Full støtte for dv- og hdv-video i alle scripts +* Automatisere alt av manuell postprod. ;) diff --git a/tools/audio_channels_diff b/tools/audio_channels_diff new file mode 100755 index 0000000..201c131 --- /dev/null +++ b/tools/audio_channels_diff @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Date: 2009-12-10 +# Author: Ole Kristian Lien +# License: GNU General Public License +# +# Check if the left and right channel is equal. + +EXT=`echo "$1"|awk -F . '{print $NF}'` +NAME=`basename $1 .$EXT` +FORMAT=`./audio_format $1` + +if [ -z "$1" ]; then + echo "Usage: $0 <video-file>" + exit 1 +fi + +# funker ikke helt enda +./extract_audio $1 0 10 + +# legg på navn-left/right +./audio_split $NAME +#sox $1 -c 1 $NAME-left.wav mixer -l 2> /dev/null +#sox $1 -c 1 $NAME-right.wav mixer -r 2> /dev/null + +./audio_info $NAME-left.$FORMAT &> $NAME-left.$FORMAT.stat +./audio_info $NAME-right.$FORMAT &> $NAME-right.$FORMAT.stat + +LEFT=`md5sum $NAME-left.$FORMAT.stat | awk '{print $1}'` +RIGHT=`md5sum $NAME-right.$FORMAT.stat | awk '{print $1}'` + +#sox left.wav -n stat &> left.wav.stat +#sox right.wav -n stat &> right.wav.stat + +if [ "$LEFT" == "$RIGHT" ]; then + echo 0 +else + echo 1 +fi + +rm $NAME.$FORMAT $NAME-left* $NAME-right* diff --git a/tools/audio_format b/tools/audio_format index a96348c..96523cb 100644 --- a/tools/audio_format +++ b/tools/audio_format @@ -6,9 +6,16 @@ # # Grabs audio format from audio/video-file +FORMAT=`ffmpeg -i $1 2>&1 | grep Audio | cut -d " " -f 8 | sed 's/,//g'` + if [ -z "$1" ]; then echo "Usage: $0 <audio/video-file>" exit 1 fi -ffmpeg -i $1 2>&1 | grep Audio | cut -d " " -f 8 | sed 's/,//g' +if [ "$FORMAT" == "pcm_s16le" ]; then + echo "wav" +else + echo $FORMAT +fi + diff --git a/tools/convert2theora b/tools/convert2theora index acdb12e..495da56 100755 --- a/tools/convert2theora +++ b/tools/convert2theora @@ -1,5 +1,10 @@ #!/bin/bash -# ikke i svn +# +# Date: 2009-12-10 +# Author: Ole Kristian Lien +# License: GNU General Public License +# +# Convert the video to Ogg Theora. EXT=`echo "$1"|awk -F . '{print $NF}'` BASENAME=`basename $1 .$EXT` @@ -28,7 +33,8 @@ if [ ! -f "$BASENAME.ogv" ] ; then --location "$LOCATION" \ --license "$LICENSE" \ > "$BASENAME.ogv-compresslog" 2>&1 - + +# NUUG:http://nuug.no/ alltid første URL? # --organization # Name of organization (studio) # --copyright # Copyright # --license $LICENSE \ diff --git a/tools/convert2vorbis b/tools/convert2vorbis new file mode 100644 index 0000000..33552b9 --- /dev/null +++ b/tools/convert2vorbis @@ -0,0 +1,45 @@ +#!/bin/bash +# +# Date: 2009-12-10 +# Author: Ole Kristian Lien +# License: GNU General Public License +# +# Convert the sound from the video to Ogg Vorbis. + +#./require oggenc vorbis-tools + +# todo: add license metadata, other? + + echo "Generating $basename.ogg" + $debug oggenc --downmix -b 64 -o "$basename.ogg" "$basename.wav" > "${basename}.ogg-compresslog" 2>&1 + + + -c comment, --comment comment + Add the string comment as an extra comment. This may be used multiple times, and all instances will be added to each of the input files + specified. The argument should be in the form "tag=value". + + -a artist, --artist artist + Set the artist comment field in the comments to artist. + + -G genre, --genre genre + Set the genre comment field in the comments to genre. + + -d date, --date date + Sets the date comment field to the given value. This should be the date of recording. + + -N n, --tracknum n + Sets the track number comment field to the given value. + + -t title, --title title + Set the track title comment field to title. + + -l album, --album album + Set the album comment field to album. + +genre + +-a $NAME +-G $GENRE +-d $DATE +-t $TITLE +-l $WHAT diff --git a/tools/cut_video b/tools/cut_video index 2e12be9..287f52c 100644 --- a/tools/cut_video +++ b/tools/cut_video @@ -18,7 +18,6 @@ fi if [ -z "$4" ]; then DURATION=`./duration $1` ffmpeg -i $1 -ss $3 -t $DURATION -vcodec copy -acodec copy $NAME-new.$EXT - else ffmpeg -i $1 -ss $3 -t $4 -vcodec copy -acodec copy $NAME-new.$EXT fi diff --git a/tools/extract_audio b/tools/extract_audio index 26a8588..5f7eee9 100644 --- a/tools/extract_audio +++ b/tools/extract_audio @@ -11,8 +11,14 @@ NAME=`basename $1 .$EXT` FORMAT=`./audio_format $1` if [ -z "$1" ]; then - echo "Usage: $0 <video-file>" + echo "Usage: $0 <video-file> [<start-pos> <duration>]" exit 1 fi -ffmpeg -i $1 -vn -acodec copy $NAME.$FORMAT 2> /dev/null +if [ -z "$4" ]; then + DURATION="30" #`./duration $1` +echo "start: $2 - Dur: $DURATION" + ffmpeg -i $1 -ss $2 -t $DURATION -vn -acodec copy $NAME.$FORMAT #2> /dev/null +else + ffmpeg -i $1 -vn -acodec copy $NAME.$FORMAT #2> /dev/null +fi diff --git a/tools/fade b/tools/fade new file mode 100755 index 0000000..be46a9b --- /dev/null +++ b/tools/fade @@ -0,0 +1,42 @@ +#!/bin/bash +# +# Date: 2009-12-10 +# Author: Ole Kristian Lien +# License: GNU General Public License +# +# Fades in and out a image for x seconds. + +EXT=`echo "$1"|awk -F . '{print $NF}'` +NAME=`basename $1 .$EXT` + +if [ -z "$3" ]; then + echo "Usage: $0 <image-file> <seconds> <bg-color>" + exit 1 +fi + +count=100 # mer enn 10 sek, må denne økes(?) +file=$1 +seconds=`expr $2 \* 100` +color=$3 + +#fps=25 + +for ((i = 100 ; i >= 4 ; i = i - 4)); do + count=`expr $count + 1` +# echo "Generating intro - fade in $i% (frame $count)" + convert -fill $color -colorize $i% $1 $NAME$count.png +done + +# todo: gjør om til hardlenke(?) +for ((i = 4 ; i <= $seconds ; i = i + 4)); do + count=`expr $count + 1` +# echo "Generating intro - still $i% (frame $count)" + cp $1 $NAME$count.png +done + +# Fade out +for ((i = 4 ; i <= 100 ; i = i + 4)); do + count=`expr $count + 1` +# echo "Generating intro - fade out $i% (frame $count)" + convert -fill $color -colorize $i% $1 $NAME$count.png +done diff --git a/tools/fade.sh b/tools/fade.sh deleted file mode 100755 index 3f1f580..0000000 --- a/tools/fade.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -count=0 -file="NUUG-logo-2-150-2.png" - -echo "Generating intro frame images" - -# Generate 50 fade-in frames -for i in {1..50}; do - count=`expr $count + 1` - echo "Generating intro frame image $file ($count)" -# convert -fill black -colorize $i% NUUG-logo-2-150-2.png test-$i.png -done - -for i in {1..50}; do - count=`expr $count + 1` - echo "Generating intro frame image $file ($count)" - #cp 51 $count -done - -for i in {1..50}; do -count=`expr $count + 1` -echo "Generating intro frame image $file ($count)" -#cp 51 $count -done - diff --git a/tools/image2video b/tools/image2video index 23ca123..30fbecb 100644 --- a/tools/image2video +++ b/tools/image2video @@ -9,7 +9,8 @@ EXT=`echo "$1"|awk -F . '{print $NF}'` NAME=`basename $1 .$EXT` WIDESCREEN=`./video_aspect_ratio $1` -FRAMES=`./video_fps $1` +#FRAMES=`./video_fps $1` +FRAMES=1 ENDNAME=$2 NTSC=`./video_standard $1` diff --git a/tools/intro b/tools/intro index 9b08b23..52e6572 100755 --- a/tools/intro +++ b/tools/intro @@ -4,11 +4,11 @@ # Author: Ole Kristian Lien # License: GNU General Public License # -# Generate intro-file to a video +# Generate intro-file with fade in/out from csv-file EXT=`echo "$1"|awk -F . '{print $NF}'` BASENAME=`basename $1 .$EXT` -COUNT="10" +COUNT="1" LOGO=`./csv $2 $1 logo` WHAT=`./csv $2 $1 what` @@ -25,34 +25,26 @@ fi # LOGO ./image_logo $1 intro-$COUNT white $LOGO -COUNT=`expr $COUNT + 1` -./image_logo $1 intro-$COUNT white $LOGO -COUNT=`expr $COUNT + 1` -./image_logo $1 intro-$COUNT white $LOGO +./fade $BASENAME-intro-$COUNT.png 3 white +rm $BASENAME-intro-$COUNT.png COUNT=`expr $COUNT + 1` # SLIDE 1 ./image_text $1 intro-$COUNT white "$WHAT" "$DATE - $LOCATION" -COUNT=`expr $COUNT + 1` -./image_text $1 intro-$COUNT white "$WHAT" "$DATE - $LOCATION" -COUNT=`expr $COUNT + 1` -./image_text $1 intro-$COUNT white "$WHAT" "$DATE - $LOCATION" +./fade $BASENAME-intro-$COUNT.png 3 white +rm $BASENAME-intro-$COUNT.png COUNT=`expr $COUNT + 1` # SLIDE 2 ./image_text $1 intro-$COUNT white "$TITLE" "$NAME" -COUNT=`expr $COUNT + 1` -./image_text $1 intro-$COUNT white "$TITLE" "$NAME" -COUNT=`expr $COUNT + 1` -./image_text $1 intro-$COUNT white "$TITLE" "$NAME" +./fade $BASENAME-intro-$COUNT.png 3 white +rm $BASENAME-intro-$COUNT.png COUNT=`expr $COUNT + 1` # LICENSE cp $LICENSE.png $BASENAME-intro-$COUNT.png -COUNT=`expr $COUNT + 1` -cp $LICENSE.png $BASENAME-intro-$COUNT.png -COUNT=`expr $COUNT + 1` -cp $LICENSE.png $BASENAME-intro-$COUNT.png +./fade $BASENAME-intro-$COUNT.png 3 white +rm $BASENAME-intro-$COUNT.png ./image2video $1 intro rm $BASENAME-intro-*.png diff --git a/tools/outro b/tools/outro index a41e4f1..a898231 100755 --- a/tools/outro +++ b/tools/outro @@ -4,7 +4,7 @@ # Author: Ole Kristian Lien # License: GNU General Public License # -# Generate outro-file to a video +# Generate outro-file with fade in/out from csv-file EXT=`echo "$1"|awk -F . '{print $NF}'` BASENAME=`basename $1 .$EXT` @@ -21,19 +21,21 @@ if [ -z "$1" ]; then fi ./image_text $1 outro-$COUNT black "TAKK TIL" -COUNT=`expr $COUNT + 1` -./image_text $1 outro-$COUNT black "TAKK TIL" -COUNT=`expr $COUNT + 1` -./image_text $1 outro-$COUNT black "TAKK TIL" +./fade $BASENAME-outro-$COUNT.png 3 black +rm $BASENAME-outro-$COUNT.png COUNT=`expr $COUNT + 1` ./image_text $1 outro-$COUNT black "$NAME" Foredragsholder +./fade $BASENAME-outro-$COUNT.png 1 black +rm $BASENAME-outro-$COUNT.png COUNT=`expr $COUNT + 1` + ./image_text $1 outro-$COUNT black "$LOCATION" Lokaler +./fade $BASENAME-outro-$COUNT.png 1 black +rm $BASENAME-outro-$COUNT.png COUNT=`expr $COUNT + 1` -# takk -# quick hack +# dirty hack oldIFS=$IFS IFS=' ' @@ -42,18 +44,21 @@ for i in $TAKK ; do HVEM=`echo "$i" | cut -d ":" -f 2` # echo "TAKK: $HVA - $HVEM" ./image_text $1 outro-$COUNT black "$HVEM" "$HVA" + ./fade $BASENAME-outro-$COUNT.png 1 black + rm $BASENAME-outro-$COUNT.png COUNT=`expr $COUNT + 1` done IFS=$IFS -# url for i in $URL ; do # echo "URL: $i" ./image_text $1 outro-$COUNT black " " - COUNT=`expr $COUNT + 1` - ./image_text $1 outro-$COUNT black "$i" - COUNT=`expr $COUNT + 1` + ./fade $BASENAME-outro-$COUNT.png 1 black + rm $BASENAME-outro-$COUNT.png + ./image_text $1 outro-$COUNT black "$i" + ./fade $BASENAME-outro-$COUNT.png 2 black + rm $BASENAME-outro-$COUNT.png COUNT=`expr $COUNT + 1` done diff --git a/tools/process-video b/tools/process-video new file mode 100644 index 0000000..e5d77a5 --- /dev/null +++ b/tools/process-video @@ -0,0 +1,22 @@ +#!/bin/bash + +EXT=`echo "$1"|awk -F . '{print $NF}'` +NAME=`basename $1 .$EXT` +FORMAT=`./audio_format $1` + +if [ -z "$2" ]; then + echo "Usage: $0 <video-file> <csv-file>" + exit 1 +fi + +./check_diskspace $1 +#./audio_channels_diff $1 +./intro $1 $2 +./outro $1 $2 +./join_video $NAME-new.$FORMAT $NAME-intro$FORMAT $1 $NAME-outro$FORMAT + +# todo: bli kvitt mv.. +./convert2theora $1 $2 +mv $NAME-new.ogv $NAME.ogv +./convert2vorbis $1 $2 +mv $NAME-new.ogg $NAME.ogg |