summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/audio_channels_diff33
-rw-r--r--tools/audio_extract (renamed from tools/extract_audio)15
-rw-r--r--tools/audio_format8
-rwxr-xr-xtools/audio_split18
-rwxr-xr-xtools/audio_stats14
-rwxr-xr-xtools/convert2theora14
-rw-r--r--tools/convert2vorbis83
-rwxr-xr-xtools/csv15
-rw-r--r--tools/process-video2
-rw-r--r--tools/split_audio11
-rwxr-xr-xtools/test.csv4
11 files changed, 140 insertions, 77 deletions
diff --git a/tools/audio_channels_diff b/tools/audio_channels_diff
index 201c131..804687b 100755
--- a/tools/audio_channels_diff
+++ b/tools/audio_channels_diff
@@ -6,36 +6,33 @@
#
# Check if the left and right channel is equal.
+# ext-format må fikses!! hmm
+
EXT=`echo "$1"|awk -F . '{print $NF}'`
NAME=`basename $1 .$EXT`
-FORMAT=`./audio_format $1`
+#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
+if [ ! -f $BASENAME.wav ]; then
+ echo "File $BASENAME.wav does not exists"
+ ./audio_extract $1 0 60
+fi
-LEFT=`md5sum $NAME-left.$FORMAT.stat | awk '{print $1}'`
-RIGHT=`md5sum $NAME-right.$FORMAT.stat | awk '{print $1}'`
+./audio_split $NAME.wav
+./audio_stats $NAME-left.wav &> $NAME-left.wav.stat
+./audio_stats $NAME-right.wav &> $NAME-right.wav.stat
-#sox left.wav -n stat &> left.wav.stat
-#sox right.wav -n stat &> right.wav.stat
+LEFT=`md5sum $NAME-left.wav.stat | awk '{print $1}'`
+RIGHT=`md5sum $NAME-right.wav.stat | awk '{print $1}'`
if [ "$LEFT" == "$RIGHT" ]; then
- echo 0
+ echo "eq"
else
- echo 1
+ echo "nq"
fi
-rm $NAME.$FORMAT $NAME-left* $NAME-right*
+rm $NAME.wav $NAME-left* $NAME-right*
diff --git a/tools/extract_audio b/tools/audio_extract
index 5f7eee9..bd0afa8 100644
--- a/tools/extract_audio
+++ b/tools/audio_extract
@@ -15,10 +15,15 @@ if [ -z "$1" ]; then
exit 1
fi
-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
+if [ "$FORMAT" == "pcm_s16le" ]; then
+ FORMAT="wav"
+fi
+
+if [ "$3" ]; then
+ #DURATION="30" #`./duration$1`
+ DURATION="$3"
+ #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
+ ffmpeg -i $1 -vn -acodec copy $NAME.$FORMAT 2> /dev/null
fi
diff --git a/tools/audio_format b/tools/audio_format
index 96523cb..37760d2 100644
--- a/tools/audio_format
+++ b/tools/audio_format
@@ -13,9 +13,9 @@ if [ -z "$1" ]; then
exit 1
fi
-if [ "$FORMAT" == "pcm_s16le" ]; then
- echo "wav"
-else
+#if [ "$FORMAT" == "pcm_s16le" ]; then
+# echo "wav"
+#else
echo $FORMAT
-fi
+#fi
diff --git a/tools/audio_split b/tools/audio_split
new file mode 100755
index 0000000..a5e5525
--- /dev/null
+++ b/tools/audio_split
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# Date: 2009-12-10
+# Author: Ole Kristian Lien
+# License: GNU General Public License
+#
+# Splits a audio-file to a left- and right-file.
+
+EXT=`echo "$1"|awk -F . '{print $NF}'`
+NAME=`basename $1 .$EXT`
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 <audio-file>"
+ exit 1
+fi
+
+sox $1 -c 1 $NAME-left.$EXT mixer -l 2> /dev/null
+sox $1 -c 1 $NAME-right.$EXT mixer -r 2> /dev/null
diff --git a/tools/audio_stats b/tools/audio_stats
new file mode 100755
index 0000000..be677aa
--- /dev/null
+++ b/tools/audio_stats
@@ -0,0 +1,14 @@
+#!/bin/bash
+#
+# Date: 2009-12-10
+# Author: Ole Kristian Lien
+# License: GNU General Public License
+#
+# Print out some audio info/stats
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 <audio-file>"
+ exit 1
+fi
+
+sox $1 -n stat
diff --git a/tools/convert2theora b/tools/convert2theora
index 495da56..887718d 100755
--- a/tools/convert2theora
+++ b/tools/convert2theora
@@ -15,12 +15,16 @@ LOCATION=`./csv $2 $1 location`
TITLE=`./csv $2 $1 title`
NAME=`./csv $2 $1 name`
LICENSE=`./csv $2 $1 license`
+ORGANIZATION=`./csv $2 $1 organization`
+CONTACT=`./csv $2 $1 contact`
if [ -z "$1" ]; then
echo "Usage: $0 <video-file> [<csv-file>]"
exit 1
fi
+# todo: pass på å behold 4:3/16:9 i x:y..
+
if [ ! -f "$BASENAME.ogv" ] ; then
echo "Generating $BASENAME.ogv"
@@ -31,15 +35,11 @@ if [ ! -f "$BASENAME.ogv" ] ; then
--title "$TITLE" \
--date "$DATE" \
--location "$LOCATION" \
+ --organization "$ORGANIZATION" \
+ --copyright "$COPYRIGHT" \
--license "$LICENSE" \
+ --contact "$CONTACT" \
> "$BASENAME.ogv-compresslog" 2>&1
-
-# NUUG:http://nuug.no/ alltid første URL?
-# --organization # Name of organization (studio)
-# --copyright # Copyright
-# --license $LICENSE \
-# --contact # Contact link
-
else
ffmpeg2theora $1 -o $BASENAME.ogv
# --width 384 --height 288
diff --git a/tools/convert2vorbis b/tools/convert2vorbis
index 33552b9..b3e3809 100644
--- a/tools/convert2vorbis
+++ b/tools/convert2vorbis
@@ -8,38 +8,51 @@
#./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
+# todo: add tag license and copyright metadata (-c tag=value), more tags?
+# * language, publisher, copyright
+# legg til require
+
+EXT=`echo "$1"|awk -F . '{print $NF}'`
+BASENAME=`basename $1 .$EXT`
+
+BITRATE="64"
+
+DATE=`./csv $2 $1 date`
+TITLE=`./csv $2 $1 title`
+WHAT=`./csv $2 $1 what`
+NAME=`./csv $2 $1 name`
+GENRE=`./csv $2 $1 genre`
+LOCATION=`./csv $2 $1 location`
+LICENSE=`./csv $2 $1 license`
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 <video-file> [<csv-file>]"
+ exit 1
+fi
+
+if [ ! -f $BASENAME.wav ]; then
+ echo "File $BASENAME.wav does not exists"
+ ./audio_extract $1
+fi
+
+echo "Generating $BASENAME.ogg ($BITRATE kbps)"
+
+# --downmix
+#Downmix stereo to mono. Only allowed on stereo input.
+# sjekke om det er stero først? hvis ja, legg på downmix..
+
+if [ "$2" ]; then
+echo "test"
+ oggenc "$BASENAME.wav" --downmix -b $BITRATE \
+ --date "$DATE" \
+ --title "$TITLE" \
+ --album "$WHAT" \
+ --artist "$NAME" \
+ --genre "$GENRE" \
+ 2>&1
+# > "$BASENAME.ogg-compresslog" 2>&1
+else
+ oggenc "$BASENAME.wav" --downmix -b $BITRATE \
+ 2>&1
+ #> "$BASENAME.ogg-compresslog" 2>&1
+fi
diff --git a/tools/csv b/tools/csv
index f11e444..6c27a93 100755
--- a/tools/csv
+++ b/tools/csv
@@ -28,7 +28,10 @@ my $title;
my $what;
my $date;
my $location;
+my $genre;
my $license;
+my $organization;
+my $contact;
my @takk;
my @url;
@@ -58,8 +61,14 @@ while (<CSV>) {
$date=$index;
} elsif ($_ eq "Location") {
$location=$index;
+ } elsif ($_ eq "Genre") {
+ $genre=$index;
} elsif ($_ eq "License") {
$license=$index;
+ } elsif ($_ eq "Organization") {
+ $organization=$index;
+ } elsif ($_ eq "Contact") {
+ $contact=$index;
} elsif ($_ eq "Takk") {
push(@takk, $index);
} elsif ($_ eq "URL") {
@@ -86,8 +95,14 @@ while (<CSV>) {
print "$columns[$date]";
} elsif ($info eq "location") {
print "$columns[$location]";
+ } elsif ($info eq "genre") {
+ print "$columns[$genre]";
} elsif ($info eq "license") {
print "$columns[$license]";
+ } elsif ($info eq "organization") {
+ print "$columns[$organization]";
+ } elsif ($info eq "contact") {
+ print "$columns[$contact]";
} elsif ($info eq "takk") {
foreach (@takk) {
my $takk = $columns[$_];
diff --git a/tools/process-video b/tools/process-video
index e5d77a5..e575ab1 100644
--- a/tools/process-video
+++ b/tools/process-video
@@ -10,7 +10,7 @@ if [ -z "$2" ]; then
fi
./check_diskspace $1
-#./audio_channels_diff $1
+./audio_channels_diff $1
./intro $1 $2
./outro $1 $2
./join_video $NAME-new.$FORMAT $NAME-intro$FORMAT $1 $NAME-outro$FORMAT
diff --git a/tools/split_audio b/tools/split_audio
index 4e97221..e615a50 100644
--- a/tools/split_audio
+++ b/tools/split_audio
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Date: 2009-11-30
+# Date: 2009-12-10
# Author: Ole Kristian Lien
# License: GNU General Public License
#
@@ -16,9 +16,10 @@ if [ -z "$1" ]; then
exit 1
fi
-sox $1 -c 1 left.wav mixer -l 2> /dev/null
-sox $1 -c 1 right.wav mixer -r 2> /dev/null
-sox -m left.wav right.wav mono.wav 2> /dev/null
+#sox $1 -c 1 left.wav mixer -l 2> /dev/null
+#sox $1 -c 1 right.wav mixer -r 2> /dev/null
+./audio_split $1
+sox -m $NAME-left.wav $NAME-right.wav mono.wav 2> /dev/null
sox mono.wav -c 2 stereo.wav 2> /dev/null
ffmpeg -i stereo.wav -acodec $EXT -ab "$BITRATE"k $NAME-new.$EXT 2> /dev/null
-rm left.wav right.wav mono.wav stereo.wav
+rm $NAME-left.wav $NAME-right.wav mono.wav stereo.wav
diff --git a/tools/test.csv b/tools/test.csv
index 2676998..4c41a52 100755
--- a/tools/test.csv
+++ b/tools/test.csv
@@ -1,2 +1,2 @@
-"Filename","Logo","Name","Title","What","Date","Location","License","Takk","Takk","Takk","URL","URL"
-"20091016-wa-helland-introduksjon_til_wikipedia.dv","Wikimedia_Norge-logo.png","Frode Inge Helland","Introduksjon til Wikipedia","Wikipedia Workshop",10/16/09,"Høgskolen i Bergen","cc-by-sa-3.0-no","Videogruppen:Ole Kristian Lien","Videogruppen:Hans-Petter Fjeld","Videogruppen:Lars Åge Kamfjord","http://nuug.no/","http://no.wikimedia.org/"
+"Filename","Logo","Name","Title","What","Date","Location","Genre","Organization","Contact","License","Takk","Takk","Takk","URL","URL"
+"20091016-wa-helland-introduksjon_til_wikipedia.dv","Wikimedia_Norge-logo.png","Frode Inge Helland","Introduksjon til Wikipedia","Wikipedia Workshop","2009-10-16","Høgskolen i Bergen","Foredrag","NUUG","sekretariat@nuug.no","cc-by-sa-3.0-no","Videogruppen:Ole Kristian Lien","Videogruppen:Hans-Petter Fjeld","Videogruppen:Lars Åge Kamfjord","http://nuug.no/","http://no.wikimedia.org/"