[PATCH] Output AAC as M4A with metadata tags

Roger Burton West roger at firedrake.org
Fri Apr 1 06:11:52 EDT 2011


On Fri, Apr 01, 2011 at 11:01:02AM +0100, Shevek wrote:
>because of the change from array to string passed to System() and
>Open3() any programmes with characters such as " in the title won't
>download

As I feared might be a problem...

>It looks like it will have to be a 2 calls to ffmpeg - I'll take a
>look and hopefully have another patch later.

I don't have scope to test this in place, but broadly speaking I would
expect you could get away with something like this. Set up @cmd1 and
@cmd2 to be the first and second system() calls, then:

my $buffersize=1024*4096;

open(INPUT,'-|', at cmd1); # or report the error
binmode INPUT;
open(OUTPUT,'|-', at cmd2); # or report the error
binmode OUTPUT;
my $buffer;
my $len=1;
while ($len && !eof(INPUT)) {
  $len=read(INPUT,$buffer,$buffersize);
  unless (defined $len) {
    # some sort of error occurred - deal with $!
  }
  print OUTPUT $buffer;
}
close INPUT;
close OUTPUT;

(plus error handling, of course!)

R



More information about the get_iplayer mailing list