extract length using oggLength
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 22 Oct 2009 12:41:18 +0000 (14:41 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 22 Oct 2009 12:41:18 +0000 (14:41 +0200)
bin/video-timecoded.pl

index 8134e40..6a94436 100755 (executable)
@@ -9,6 +9,12 @@ use File::Path qw(rmtree);
 my $length = 100;
 my $fps = 5;
 
+if ( my $original = shift @ARGV ) {
+       my $len_ms = `oggLength $original`;
+       $length = int( ( $len_ms + 500 ) / 1000 );
+       warn "$original\t$length s\n";
+}
+
 rmtree "/tmp/blank";
 mkdir "/tmp/blank";
 
@@ -31,7 +37,7 @@ foreach my $pos ( 0 .. $length * $fps ) {
        my $path = sprintf $frame_fmt, $pos;
        $im->Write( filename => $path );
 #      warn "# $hh $mm $ss $path ", -s $path, $/ if $t % $fps == 0;
-       print STDERR '.' if $pos % $fps == 0;
+       print STDERR $pos % 60 * %fps == 0 ? '*' : '.' if $pos % $fps == 0;
 }
 
 print STDERR "\n";