diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-09-05 17:55:35 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-09-05 17:55:35 +0100 |
| commit | 741fb4b9e135cfb161a749db88713229038577bb (patch) | |
| tree | 08bc9925659cbcac45162bacf31dc6336d4f60b4 /ffmpeg1/tools/make_chlayout_test | |
| parent | a2e1bf3495b7bfefdaedb8fc737e969ab06df079 (diff) | |
making act segmenter
Diffstat (limited to 'ffmpeg1/tools/make_chlayout_test')
| -rwxr-xr-x | ffmpeg1/tools/make_chlayout_test | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/ffmpeg1/tools/make_chlayout_test b/ffmpeg1/tools/make_chlayout_test deleted file mode 100755 index fcdbda3..0000000 --- a/ffmpeg1/tools/make_chlayout_test +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env perl - -# Copyright (c) 2012 Nicolas George -# -# This file is part of FFmpeg. -# -# FFmpeg is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# FFmpeg is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with FFmpeg; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -=head1 NAME - -make_chlayout_test - produce a multichannel test file with the channels -clearly identified - -=head1 SYNOPSIS - -tools/make_chlayout_test I<channels> I<out_options> - -=head1 DESCRIPTION - -This script uses B<ffmpeg> and B<libflite> to produce a file with audio -channels clearly identified by their name. The resulting file can be used to -check that the layout and order of channels is correctly handled by a piece -of software, either a part of B<FFmpeg> or not. - -I<channels> is a list of channels or channel layouts, separated by '+'. - -I<out_options> is a list of valid ffmpeg outout options, including the -output file. - -Note that some output codecs or formats can not handle arbitrary channel -layout. - -This script requires a B<ffmpeg> binary, either in the source tree or in the -search path; it must have the flite audio source enabled. - -=head1 EXAMPLES - -Check that the speakers are correctly plugged: - - tools/make_chlayout_test FL+FR -f alsa default - -Produce a 5.1 FLAC file: - - tools/make_chlayout_test 5.1 surround.flac - -=cut - -use strict; -use warnings; -use Getopt::Long ":config" => "require_order"; -use Pod::Usage; - -GetOptions ( - "help|usage|?|h" => sub { pod2usage({ -verbose => 1, -exitval => 0 }) }, - "manpage|m" => sub { pod2usage({ -verbose => 2, -exitval => 0 }) }, -) and @ARGV >= 2 or pod2usage({ -verbose => 1, -exitval => 1 }); - -my $channels = shift @ARGV; -my @out_options = @ARGV; - -my $ffmpeg = exists $ENV{FFMPEG} ? $ENV{FFMPEG} : - $0 =~ /(.*)\// && -e "$1/../ffmpeg" ? "$1/../ffmpeg" : - "ffmpeg"; - -my %channel_label_to_descr; -my %layout_to_channels; - -{ - open my $stderr, ">&STDERR"; - open STDERR, ">", "/dev/null"; - open my $f, "-|", $ffmpeg, "-layouts" or die "$ffmpeg: $!\n"; - open STDERR, ">&", $stderr; - while (<$f>) { - chomp; - next if /^NAME/ or /:$/ or /^$/; # skip headings - my ($name, $descr) = split " ", $_, 2; - next unless $descr; - if ($descr =~ /^[[:upper:]]+(?:\+[[:upper:]]+)*$/) { - $layout_to_channels{$name} = [ split /\+/, $descr ]; - } else { - $channel_label_to_descr{$name} = $descr; - } - } -} - -my @channels = map { @{$layout_to_channels{$_} // [$_]} } split /\+/, $channels; - -my $layout = join "+", @channels; -my $graph = ""; -my $concat_in = ""; -for my $i (0 .. $#channels) { - my $label = $channels[$i]; - my $descr = $channel_label_to_descr{$label} - or die "Channel $label not found\n"; - $graph .= "flite=text='${descr}', aformat=channel_layouts=mono, " . - "pan=${layout}:${label}=c0 [ch$i] ;\n"; - $concat_in .= "[ch$i] "; -} -$graph .= "${concat_in}concat=v=0:a=1:n=" . scalar(@channels); - -exec $ffmpeg, "-f", "lavfi", "-i", $graph, @out_options - or die "$ffmpeg: $!\n"; |
