[FFmpeg-devel] [PATCH] ALSA: implement channel layout for playback.

Nicolas George nicolas.george
Sun Mar 13 11:24:00 CET 2011


Le primidi 21 vent?se, an CCXIX, Carl Eugen Hoyos a ?crit?:
> Inlined is the tested function to reorder 7.1.

Thanks. New version of the patch incoming.

> More difficult is to fix AV_CH_LAYOUT_4POINT0
> (Edward.Scissorhands.x264.DTS-4.0-48_24.mkv), because it has to be mapped to 5.1
> - Alsa's 4-channel layout is AV_CH_LAYOUT_QUAD.

My opinion is that the output driver should not do that automatically. Using
an audio filter: "-af layout=5.1", would IMHO be a better solution.

For reference, I attach the perl script I use to generate surround test
files.

Regards,

-- 
  Nicolas George
-------------- next part --------------
#!/usr/bin/perl

use strict;
use warnings;

my @layout = (undef, undef,
  [ "left", "right" ],
  [ "left", "center", "right" ],
  [ "front left", "front right", "rear left", "rear right" ],
  [ "front left", "front center", "front right", "rear left", "rear right" ],
  [ "front left", "front center", "front right", "rear left", "rear right",
    "low freq" ],
  [ "front left", "front center", "front right", "side left", "side right",
    "rear center", "low freq" ],
  [ "front left", "front center", "front right", "side left", "side right",
    "rear left", "rear right", "low freq" ],
);

my ($channels, $file) = @ARGV;
die "Usage: $0 channels file\n" unless defined $file;

my $layout = $layout[$channels] or die "$channels channels not supported.\n";
my @channels = @$layout;
my $out = "";
for my $i (0 .. $channels - 1) {
  my $data = `espeak --stdout "$channels[$i]" |
    sox -t wav - -t raw -r 48000 -s -2 -c 1 -`;
  my $pfx = "\0\0" x $i;
  my $sfx = "\0\0" x ($channels - 1 - $i);
  $data =~ s/(..)/$pfx$1$sfx/gs;
  $out .= $data;
}
open my $oggenc, "|-", "oggenc", "-r", "-R", 48000, "-C", $channels, "-B", 16,
  "-o", $file, "-";
print $oggenc $out;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110313/a0472073/attachment.pgp>



More information about the ffmpeg-devel mailing list