diff options
-rw-r--r-- | tools/audio_check_noise | 13 | ||||
-rw-r--r-- | tools/audio_check_volume | 8 | ||||
-rw-r--r-- | tools/audio_extract | 4 | ||||
-rw-r--r-- | tools/audio_gain_volume | 7 | ||||
-rw-r--r-- | tools/audio_remove_noise | 11 | ||||
-rw-r--r-- | tools/audio_spectrogram | 2 | ||||
-rw-r--r-- | tools/check_diskspace | 4 | ||||
-rwxr-xr-x | tools/convert2theora | 5 | ||||
-rwxr-xr-x | tools/csv | 15 | ||||
-rwxr-xr-x | tools/intro | 4 | ||||
-rw-r--r-- | tools/join_video | 11 | ||||
-rw-r--r-- | tools/merge_av | 5 | ||||
-rwxr-xr-x | tools/metadata | 26 | ||||
-rwxr-xr-x | tools/outro | 4 | ||||
-rw-r--r-- | tools/process-video | 68 |
15 files changed, 134 insertions, 53 deletions
diff --git a/tools/audio_check_noise b/tools/audio_check_noise index f914834..e08fc01 100644 --- a/tools/audio_check_noise +++ b/tools/audio_check_noise @@ -3,7 +3,16 @@ EXT=`echo "$1"|awk -F . '{print $NF}'` NAME=`basename $1 .$EXT` -if [ -z "$2" ]; then - echo "Usage: $0 <video-file> <csv-file>" +if [ -z "$1" ]; then + echo "Usage: $0 <wav-file>" exit 1 fi + +if [ $EXT == "wav" ] ; then + echo -n " * Generating noise-profile..." +# sox $1 -n trim 0 1.5 noiseprof $NAME.noise-profile + sox $1 -n noiseprof $NAME.noise-profile + echo -e "OK" +else + echo "Error: need .wav" +fi diff --git a/tools/audio_check_volume b/tools/audio_check_volume index f914834..37a7239 100644 --- a/tools/audio_check_volume +++ b/tools/audio_check_volume @@ -3,7 +3,11 @@ EXT=`echo "$1"|awk -F . '{print $NF}'` NAME=`basename $1 .$EXT` -if [ -z "$2" ]; then - echo "Usage: $0 <video-file> <csv-file>" +if [ -z "$1" ]; then + echo "Usage: $0 <wav-file>" exit 1 fi + +echo -n " * Checking volume levels..." +sox $1 -n stat -v 2> $1.vol +echo -e "OK!" diff --git a/tools/audio_extract b/tools/audio_extract index ee3c96f..e13c601 100644 --- a/tools/audio_extract +++ b/tools/audio_extract @@ -19,7 +19,7 @@ fi # FORMAT="wav" #fi -echo "Extracting $NAME.$FORMAT..." +echo -n " * Extracting audio ($FORMAT)..." if [ "$3" ]; then #DURATION="30" #`./duration$1` @@ -29,3 +29,5 @@ if [ "$3" ]; then else ffmpeg -i $1 -vn -acodec copy $NAME.$FORMAT 2> /dev/null fi + +echo -e "OK!" diff --git a/tools/audio_gain_volume b/tools/audio_gain_volume index f914834..92c42d3 100644 --- a/tools/audio_gain_volume +++ b/tools/audio_gain_volume @@ -4,6 +4,11 @@ EXT=`echo "$1"|awk -F . '{print $NF}'` NAME=`basename $1 .$EXT` if [ -z "$2" ]; then - echo "Usage: $0 <video-file> <csv-file>" + echo "Usage: $0 <wav-file> <volume>" exit 1 fi + +echo -n " * Gaining volume with $2..." +mv $1 $NAME-old.$EXT +sox -v $2 $NAME-old.$EXT $1 2> /dev/null +echo -e "OK!" diff --git a/tools/audio_remove_noise b/tools/audio_remove_noise index f914834..05c9a5f 100644 --- a/tools/audio_remove_noise +++ b/tools/audio_remove_noise @@ -3,7 +3,14 @@ EXT=`echo "$1"|awk -F . '{print $NF}'` NAME=`basename $1 .$EXT` -if [ -z "$2" ]; then - echo "Usage: $0 <video-file> <csv-file>" +NOISE="0.1" + +if [ -z "$1" ]; then + echo "Usage: $0 <wav-file> [<noise-profile-file>]" exit 1 fi + +echo -n " * Removing noise with $NOISE..." +mv $1 $NAME-old.$EXT +sox $NAME-old.$EXT $NAME.wav noisered $NAME.noise-profile $NOISE 2> /dev/null +echo -e "OK!" diff --git a/tools/audio_spectrogram b/tools/audio_spectrogram index de0685a..b91af40 100644 --- a/tools/audio_spectrogram +++ b/tools/audio_spectrogram @@ -14,5 +14,7 @@ if [ -z "$1" ]; then exit 1 fi +echo -n " * Generating spectrogram..." sox $1 -n spectrogram mv spectrogram.png $NAME.png +echo -e "OK!" diff --git a/tools/check_diskspace b/tools/check_diskspace index d30f5e5..b8a3520 100644 --- a/tools/check_diskspace +++ b/tools/check_diskspace @@ -14,9 +14,11 @@ if [ -z "$1" ]; then exit 1 fi -echo "Checking for enough disk space to continue..." +echo -n " * Checking for enough disk space to continue..." if [ $DISK -le $FILE ]; then echo "Error: Not enough disk space to continue! Aborting." exit 1 fi + +echo -e "OK!" diff --git a/tools/convert2theora b/tools/convert2theora index 98b049a..2d32420 100755 --- a/tools/convert2theora +++ b/tools/convert2theora @@ -9,7 +9,7 @@ EXT=`echo "$1"|awk -F . '{print $NF}'` BASENAME=`basename $1 .$EXT` -VIDEOQUALITY=8 +VIDEOQUALITY=6 #7 AUDIOQUALITY=4 if [ -z "$1" ]; then @@ -25,11 +25,12 @@ fi # todo: pass på å behold 4:3/16:9 i x:y.. if [ ! -f "$BASENAME.ogv" ] ; then - echo "Generating $BASENAME.ogv..." + echo -n " * Convertering video to Ogg Theora (video quality: $VIDEOQUALITY - audio quality: $AUDIOQUALITY)..." ffmpeg2theora $1 -o $BASENAME.ogv \ --videoquality $VIDEOQUALITY --audioquality $AUDIOQUALITY \ > "$BASENAME.ogv-compresslog" 2>&1 # --width 384 --height 288 + echo -e "OK!" else echo "$BASENAME.ogv allready exist!" exit 1 @@ -31,6 +31,7 @@ my $location; my $genre; my $license; my $organization; +my $language; my $contact; my @takk; my @url; @@ -69,6 +70,8 @@ while (<CSV>) { $organization=$index; } elsif ($_ eq "Contact") { $contact=$index; + } elsif ($_ eq "Language") { + $language=$index; } elsif ($_ eq "Takk") { push(@takk, $index); } elsif ($_ eq "URL") { @@ -78,7 +81,8 @@ while (<CSV>) { } } - next if ($. == 1); + next if ($. == 1); +#print "# $. \n\n"; if ($video eq $columns[0]) { if ($info eq "filename") { @@ -103,6 +107,8 @@ while (<CSV>) { print "$columns[$organization]"; } elsif ($info eq "contact") { print "$columns[$contact]"; + } elsif ($info eq "language") { + print "$columns[$language]"; } elsif ($info eq "takk") { foreach (@takk) { my $takk = $columns[$_]; @@ -118,9 +124,10 @@ while (<CSV>) { } else { print "$info column doesn't exist\n"; } - } else { - print "$info row doesn't exist\n"; - } + + }# else { + # print "$info row doesn't exist\n"; + #} } else { my $err = $csv->error_input; print "Failed to parse line #$..: $err"; diff --git a/tools/intro b/tools/intro index e7c969c..d437197 100755 --- a/tools/intro +++ b/tools/intro @@ -23,7 +23,7 @@ if [ -z "$2" ]; then exit 1 fi -echo "Generating intro-video from $2 for $1..." +echo -n " * Generating intro-video..." # LOGO ./image_logo $1 intro-$COUNT white $LOGO @@ -50,3 +50,5 @@ rm $BASENAME-intro-$COUNT.png ./image2video $1 intro rm $BASENAME-intro-*.png + +echo -e "OK!" diff --git a/tools/join_video b/tools/join_video index 6663148..0d2ebe1 100644 --- a/tools/join_video +++ b/tools/join_video @@ -25,9 +25,14 @@ unset array[0] # todo: Concatenating works with MPEG-1, MPEG-2 PS and DV if [ $EXT == "dv" ] ; then -echo "Joining video-files using cat..." +echo -n " * Joining video-files using cat..." cat ${array[*]} > $1 else -echo "Joining video-files using mencoder.." - mencoder -oac copy -ovc copy -idx -o ${array[*]} +echo -n " * Joining video-files using mencoder..." + mencoder -oac copy -ovc copy -idx -o $1 ${array[*]} > "$BASENAME.log" 2>&1 fi +rm $BASENAME.log +echo -e "OK!" + +# mencoder må hyssje! +# -quiet diff --git a/tools/merge_av b/tools/merge_av index 6b5bdaa..052a6c0 100644 --- a/tools/merge_av +++ b/tools/merge_av @@ -14,4 +14,7 @@ if [ -z "$2" ]; then exit 1 fi -ffmpeg -i $1 -i $2 -map 1:0 -map 0:0 -acodec copy -vcodec copy $NAME-new.$EXT 2> /dev/null +echo -n " * Merging new audio with video..." +mv $2 $NAME-old.$EXT +ffmpeg -i $1 -i $NAME-old.$EXT -map 1:0 -map 0:0 -acodec copy -vcodec copy $2 2> /dev/null +echo -e "OK!" diff --git a/tools/metadata b/tools/metadata index 1d7b30d..4477e50 100755 --- a/tools/metadata +++ b/tools/metadata @@ -8,7 +8,6 @@ # todo: fiks csv ext.. kan ikke være hardkodet.. # video og lyd, blir dobbelt av comments.. ikke bra - hvis funker, split opp if-ene!!! -# mangler i vlc: Language, Publisher # utf8- øæå funker dårlig EXT=`echo "$1"|awk -F . '{print $NF}'` @@ -23,6 +22,7 @@ NAME=`./csv $2 $BASENAME.dv name` LICENSE=`./csv $2 $BASENAME.dv license` ORGANIZATION=`./csv $2 $BASENAME.dv organization` CONTACT=`./csv $2 $BASENAME.dv contact` +LANGUAGE=`./csv $2 $BASENAME.dv language` if [ -z "$1" ]; then echo "Usage: $0 <video/audio-file> [<csv-file>]" @@ -34,8 +34,23 @@ fi if [ $EXT == "ogg" ] || [ $EXT == "ogv" ]; then if [ "$2" ]; then - echo "Writing metadata to $1..." - oggz-comment $1 -o $BASENAME-comment.$EXT --content-type theora\ + + mv $1 $BASENAME-old.$EXT + +if [ $LICENSE == "cc-by-sa-3.0-no" ]; then + LICENSE="http://creativecommons.org/licenses/by-sa/3.0/no/" +fi + +if [ $LANGUAGE == "no" ]; then + LANGUAGE="Norsk" +fi + +if [ $LANGUAGE == "en" ]; then + LANGUAGE="Engelsk" +fi + + echo -n " * Writing Ogg metadata..." + oggz-comment $BASENAME-old.$EXT -o $1 --content-type theora\ TITLE="$TITLE" \ ALBUM="$WHAT" \ ARTIST="$NAME" \ @@ -46,8 +61,11 @@ if [ $EXT == "ogg" ] || [ $EXT == "ogv" ]; then GENRE="$GENRE" \ DATE="$DATE" \ LOCATION="$LOCATION" \ - CONTACT="$CONTACT" + CONTACT="$CONTACT" \ + LANGUAGE="$LANGUAGE" \ + PUBLISHER="$ORGANIZATION" + echo -e "OK!" # rm, mv else diff --git a/tools/outro b/tools/outro index c9fc197..a144376 100755 --- a/tools/outro +++ b/tools/outro @@ -20,7 +20,7 @@ if [ -z "$1" ]; then exit 1 fi -echo "Generating outro-video from $2 for $1..." +echo -n " * Generating outro-video..." ./image_text $1 outro-$COUNT black "TAKK TIL" ./fade $BASENAME-outro-$COUNT.png 3 black @@ -65,3 +65,5 @@ done ./image2video $1 outro rm $BASENAME-outro*.png + +echo -e "OK!" diff --git a/tools/process-video b/tools/process-video index 4cb6463..c80c4f7 100644 --- a/tools/process-video +++ b/tools/process-video @@ -15,45 +15,57 @@ if [ -z "$2" ]; then exit 1 fi -echo "Processing video $1 with info from $2..." +echo "Processing video $1 with info from $2:" -#./check_diskspace $1 -#if [ "${?}" == "1" ] ; then -# exit 1 -#fi +./check_diskspace $1 +if [ "${?}" == "1" ] ; then + exit 1 +fi -#./audio_channels_diff $1 -#if [ "${?}" == "3" ] ; then -# echo "should run ./merge_audio_stereo_track $1...neh.." - #./merge_audio_stereo_track $1 -#fi +##./audio_channels_diff $1 +##if [ "${?}" == "3" ] ; then +## echo "should run ./merge_audio_stereo_track $1...neh.." +# #./merge_audio_stereo_track $1 +##fi -# ./audio_check_silence +## ./audio_check_silence -# ./audio_check_noise $1 - # if x do ./audio_remove_noise +./audio_extract $1 +##./audio_spectrogram $NAME.wav +##mv $NAME.png $NAME-old.png +./audio_check_volume $NAME.wav +VOLUME=`cat $NAME.wav.vol` +./audio_gain_volume $NAME.wav $VOLUME +./audio_check_noise $NAME.wav +./audio_remove_noise $NAME.wav +##./audio_spectrogram $NAME.wav +./merge_av $NAME.wav $1 -# bytte plass? ^ v +echo -n " * Cleaning up temp. audio-files..." +rm $NAME.wav $NAME-old.wav $NAME.wav.vol $NAME.noise-profile +echo -e "OK!" -# ./audio_check_volume $1 - # if x do ./audio_gain_volume +#### Denn maa inn igjen #### +rm $NAME-old.dv +#### -# mv fade video/image_fade -# ./audio_fade +## mv fade video/image_fade +## ./audio_fade -#./intro $1 $2 -#./outro $1 $2 -#./join_video $NAME-new.$EXT $NAME-intro.$EXT $1 $NAME-outro.$EXT -#rm $NAME-intro.$EXT $NAME-outro.$EXT +./intro $1 $2 +./outro $1 $2 +mv $1 $NAME-temp.$EXT +./join_video $NAME.$EXT $NAME-intro.$EXT $NAME-temp.$EXT $NAME-outro.$EXT +rm $NAME-intro.$EXT $NAME-outro.$EXT $NAME-temp.dv -#echo "Backing up $1 to $NAME-old.$EXT..." -#mv $1 $NAME-old.$EXT -#mv $NAME-new.$EXT $1 +##echo "Backing up $1 to $NAME-old.$EXT..." +##mv $1 $NAME-old.$EXT +##mv $NAME-new.$EXT $1 ./convert2theora $1 +rm $NAME.ogv-compresslog ./metadata $NAME.ogv $2 -./convert2vorbis $1 -./metadata $NAME.ogg $2 - +##./convert2vorbis $1 +##./metadata $NAME.ogg $2 |