FilmApart

20060707

Batch Transcode DV to OGG Theora

This scipt was necessary to replace all the spaces in the file names before the transcode of all DV media in the directory could be accomlished with the next script.
#!/usr/bin/perl -w
# nospace /this/dir /that/dir /those/too

use File::Find;
use strict;
die "usage: nospace dir[s]\n" unless @ARGV;

my %ext;

find(\&remspaces, @ARGV);

sub remspaces {
return if ($_ eq '.');
return if ($_ eq '..');
(my $new = $_) =~ tr/a-zA-Z0-9_.-/_/c;
my $duplicate = ($new ne $_ and -e $new);
my $try = $new;

$ext{"$File::Find::dir/$try"}++ if $duplicate;

while (my $count = $ext{"$File::Find::dir/$new"}++) {
(my $with_num = $new) =~ s/(?=\.|$)/_$count/;
$new = $with_num, last if not -e $with_num;
}

$ext{"$File::Find::dir/$try"}-- if $duplicate;

rename $_ => $new
or warn "can't rename $_ to $new: $!";
}

And this will output the OGG files to a folder on my desktop when run from the directory containing all the DV media.
#!/bin/bash
#==========================================
# process every file in current directory
# may use "break", "continue"
#==========================================
for FName in $(ls ); do
ffmpeg2theora -f dv -v 10 -a 10 --optimize --artist "Chris Hastings" --title "Alacridad $FName" --organization "http://alacridad.org" --copyright "© 2006 Chris Hastings" --license " True http://creativecommons.org/licenses/by-nc-sa/2.5/ This MovingImage is licensed to the public under the Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. " -o /home/papyromancer/Desktop/AlacridadOGG/$FName.ogg $FName
done

Processing 28.9GB of video began 2PM CDT July 7. I'm going to see how long it takes, but I'm guessing it'll be 5 Days 17 Hours...I'll report back on Tuesday. Then I'll have to run it again to see if enabling MMX extensions as detailed here will make any difference. Maybe the upload to the archive will be faster, it should only be around 7GB of footage that can then be frame accurately rendered in Cinelerra with an EDL applicable to either the DV or Ogg files.
octave:9> 840/28900
ans = 0.029066
octave:10> 4/.029
ans = 137.93
octave:11> 137.93/24.
ans = 5.7471
octave:12> .7471*24
ans = 17.930


2 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home