DTS file support (in .dts and .wav files)
How can I modify profiles.xml to transcode this to LPCM ... or ideally play it as a DTS stream ... fallback being encoding as AC3 with a loss in fidelity due to transcoding to lossy format.
#!/usr/bin/perl
use strict;
if ($#ARGV <= 3) {
print "Usage: $0 <destdir> <container> <videoCodec> <audioCodec> <file_or_dir_1> [<file_or_dir_2> ...]\n";
print "Usage: $0 . mp4 h264-100k dts-1509k \"../FLAC/Pink Floyd/The Dark Side Of The Moon [Original 4.0 Mix 1973] (BD-4.0-24b-48k)\"\n";
exit;
}
my %AUDIOS;
$AUDIOS{'ac3-448k'} = "-acodec ac3 -ab 448k";
$AUDIOS{'ac3-640k'} = "-acodec ac3 -ab 640k";
$AUDIOS{'dts-1509k'} = "-acodec dca -ab 1509k -strict experimental";
$AUDIOS{'dts-1500k'} = "-acodec dca -ab 1500k -strict experimental";
$AUDIOS{'dts-1536k'} = "-acodec dca -ab 1536k -strict experimental";
my %VIDEOS;
$VIDEOS{'h264-100k'} = "-vcodec libx264 -b 100k -r 1";
my $DEST = $ARGV[0];
my $CONTAINER = $ARGV[1];
my $VCODEC = $ARGV[2];
my $ACODEC = $ARGV[3];
if ($VIDEOS{$VCODEC} eq '') {
print "Error: Unsupported audioCodec '$VCODEC', valid options are:\n";
foreach my $c (sort keys %VIDEOS) {
print "\t$c\n";
}
exit;
}
if ($AUDIOS{$ACODEC} eq '') {
print "Error: Unsupported audioCodec '$ACODEC', valid options are:\n";
foreach my $c (sort keys %AUDIOS) {
print "\t$c\n";
}
exit;
}
for (my $i=4; $i<=$#ARGV; $i++) {
convertThis($ARGV[$i]);
}
exit;
sub convertThis {
my ($path) = @_;
if (-d $path) {
opendir(DIR, $path);
my @files = readdir(DIR);
closedir(DIR);
@files = sort(@files);
shift @files;
shift @files;
foreach my $file (@files) {
if (-d "$path/$file") {
convertThis("$path/$file");
}
elsif ($file =~ /\.flac$/ and $path =~ /\((LPCM|SACD|DVDA|BD|DTS|R2R|USB|UNK)/) {
convertThis("$path/$file");
}
}
return;
}
my $newdir = $path;
$newdir =~ s/.*FLAC\//FLAC\//;
my @t = split(/\//, $newdir);
my $fname = pop @t;
$newdir = $DEST ."/". join("/", @t);
`mkdir -p "$newdir"`;
$fname =~ s/\.(flac)$//;
my $out1 = "$newdir/$fname.$CONTAINER";
print "$out1\n";
my $cmd1 = "ffmpeg -loop_input -i 001.jpg -b 10 -r 1 -i \"$path\" $AUDIOS{$ACODEC} $VIDEOS{$VCODEC} -shortest \"$out1\" > /dev/null";
if (!-f $out1) {
print "$cmd1\n";
system($cmd1);
#open(FILE, ">$out1"); close(FILE);
}
}
Users browsing this forum: No registered users and 58 guests