Saturday, May 22, 2010

EDL (edit decision list) Audio player functionality

EDL (edit decision list) Audio player functionality

Creative Commons License
EDL (edit decision list) Audio player functionality by drew Roberts is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

What I started looking for is an audio player that can do for audio when mplayer can do for video as described here:

http://www.mplayerhq.hu/DOCS/HTML/en/edl.html

It would be so simple if mplayer would do this for audio as well as video but it does not seem to want to.

Cannot use EDL without video, disabling.

So. I have been on a twisty journey for a few days but it looks like I have found a workable if sub-optimal solution.

I can do the thing with ecasound and ewf files and ecaplay to play multiple ewf files one after the other.

Now, can I hack up a quick utility to take the edl file that I can create in mplayer even though I can't use it there and write multiple ewf files for ecaplay to play for me.

I really want something simpler and cross platform.

Why can't mplayer do this for audio only? Does anyone know of another Free Software player that can do this?

I will update this post as I get new info and include any script I come up with as well. (Or a link to the script)

all the best,

drew

Edit: here is a pastebin link to the code in case there are problems with cop and paste below.

Edit: (this is my first working demo, hopefully the formatting will not bork things)

#!/usr/bin/perl -w

# ecaedl.pl
# script to take an mplayer created edl file
# and the corresponding audio file and write
# a series of ecasound ewf files to match
# mplayer's edl file and then play them in
# sequence with ecaplayer

use strict;

use Getopt::Long;
use File::Basename;


my ($help, $edl, $audfile, $result, $line, @lines, @parts, $numfiles, $oom, $efw, $efwo, $outfile, $name, $dir, $ext, @args);

sub usage
{
print "Unknown option: @_\n" if ( @_ );
print "usage: program [--edl edlfilename ] [--audfile audfilename] [--help|-h|-?]\n";
exit;
}


usage() if ( ! GetOptions('help|h|?' => \$help, 'edl=s' => \$edl, 'audfile=s' => \$audfile) or defined $help or ! defined $edl or ! defined $audfile);

print "$edl\n";
print "$audfile\n";
($name,$dir,$ext) = fileparse($edl,'\..*');
print "dir is $dir, name is $name, extension is $ext\n";



open(EDLF, $edl);
@lines = <EDLF>;
close(EDLF);
$numfiles = scalar @lines;
$oom = length($numfiles);
print "The number of files is $numfiles, order of magnitude $oom\n";

$efw = 1;
$efwo = substr("00000000$efw",-$oom);
print "$efwo\n";

for $line (@lines) {
@parts = split(/ /, $line);
$outfile = $name.$efwo."."."ewf";
print "Outfile = $outfile\n";
open(EDWF, ">$outfile");
print EDWF "source = $audfile\n";
print EDWF "start-position = $parts[0]\n";
print EDWF "length = $parts[1]\n";
close(EDWF);
$efw = $efw + 1;
print "efw is now $efw\n";
$efwo = substr("00000000$efw",-$oom);
print "$efwo\n";
system("ecaplay $outfile");
}

No comments: