[ExtractStream] Re: SplitStream 0.3 and other utils

kamka@7... kamka at 7...
Sun, 21 Oct 2001 14:52:46 -0400


Hi, All
Here's a little perl script that i wrote to make splitstream process bad 
chuck until it can't extract anymore video/audio

just cut/paste this the script into a file saves as gogosplitter.pl 
chmod it to 755 and Run.
make sure to run it in the same directory as splitstream

Kevin Fowlks
------ CUT HERE ----

# Tivo SplitStream Helper
# Written By Kevin Fowlks
# 10/21/01
# Released Under GPL
# Purpose: This program will repeatly run splitstream on the BAd chucks 
that it outputs
#	Until it can't extract anymore AUDIO / VIDEO streams.
#	It then concatenates the Audio file into a complete stream.

# Uses: ./gogosplitter <tystream as input>
# Your output will look like (video) 1.m2v 2.m2v ..etc (Audio) 1.m2a 
2.m2a .. etc
# the file final.mp2 is the concatenation of all the audio streams
#

#!/usr/bin/perl

use POSIX ":sys_wait_h";

my $fsize;
my $tyStream_in;
my @filestats;
my $filename;
my $filenum;
my $killfilename;
my $audio_out;

$filenum = 1;

$tyStream_in = $ARGV[0];


if ($tyStream_in ne "") {

print "Working on $tyStream_in\n";

@filestats = stat($tyStream_in);

$fsize = $filestats[7];


while ($fsize > 0)
{
system "./splitstream $tyStream_in $filenum.m2a $filenum.m2v 
$filenum.bad > /dev/null";
do {

$kid = waitpid(-1,&WNOHANG);

} until $kid == -1;

$audio_out = $audio_out . " $filenum.m2a";

@filestats = stat("$filenum.bad");

$fsize = $filestats[7];

$tyStream_in = "$filenum.bad";

$filenum++;

if ($filenum > 2)
{
$killfilename = $filenum - 2;
print "Deleting File $killfilename.bad\n";
unlink "$killfilename.bad";

}

}

print "Building Audio File\n";

print "$audio_out\n";

system "cat $audio_out > final.mp2";

do {

$kid = waitpid(-1,&WNOHANG);

} until $kid == -1;

}
else
{
print "You must specify a tivo stream for input.\n";

}

--- END of FILE ----