All pastes #481806 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-11 00:10 UTC
rendered paste body
my $fname="/video$mpg";
$fname =~ s/-[0-9:]*-[0-9]*\.mpg$/.mpg/;
$fname =~ s/'/\\\\\\\\x27/g;
my $outname="$mpg";
$outname =~ s/\.mpg/.mp4/;
#replace "hard" chars in output name
$outname =~ s/['"]/_/g;
$outname =~ s/&/_/g;

my $offset_opts="";
$offset_opts.=" -ss $start" if($start);
$offset_opts.=" -t $duration" if($duration);
my $opts = " -b 99999 -acodec aac -ab 256 -async 1 \"$outname\"";

#wish we could do a pipe, but that confuses ffmpeg
my $cmd="ssh ffmpeggen\@$host 'x=`printf \"$fname\"`; ffmpeg $offset_opts -i \"\$x\" $opts';";
open(my $fh, "$cmd |");
my $out=<$fh>;
close($fh);