From ccc5ba6af9895a58ada0a9a867a14567f46e1f20 Mon Sep 17 00:00:00 2001 From: moex3 <46636583+moex3@users.noreply.github.com> Date: Wed, 7 Dec 2022 16:50:39 +0100 Subject: [PATCH] Add option for 320 CBR transcode --- flac2mp3.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/flac2mp3.pl b/flac2mp3.pl index b43149a..bcdc7dc 100755 --- a/flac2mp3.pl +++ b/flac2mp3.pl @@ -142,6 +142,7 @@ sub tagmap_catalogid { my $opt_genre; my $opt_help; my @opt_tagreplace; +my $opt_cbr = 0; GetOptions( "genre|g=s" => \$opt_genre, "no-genre|G" => \$opt_no_genre, @@ -150,6 +151,7 @@ GetOptions( "catid=s" => \$opt_catid, "comment=s" => \$opt_comment, "tagreplace|t=s" => \@opt_tagreplace, + "320|3" => \$opt_cbr, ) or die("Error in command line option"); if ($opt_help) { @@ -201,7 +203,12 @@ sub iterFlac { #print("Debug: @$tagopts\n"); shellsan(\$dest); - my $cmd = "flac -cd -- '$flac' | lame -V0 -S --vbr-new -q 0 --add-id3v2 @$tagopts - '$dest'"; + my $cmd; + if ($opt_cbr) { + $cmd = "flac -cd -- '$flac' | lame -S -b 320 -q 0 --add-id3v2 @$tagopts - '$dest'"; + } else { + $cmd = "flac -cd -- '$flac' | lame -S -V0 --vbr-new -q 0 --add-id3v2 @$tagopts - '$dest'"; + } #print("Debug - CMD: [$cmd]\n"); qx($cmd); if ($? != 0) { @@ -311,7 +318,7 @@ sub shellsan { } sub usage { - print("Usage: flac2mp3.pl [-h | --help] [-r] [-g | --genre NUM] \n"); + print("Usage: flac2mp3.pl [-h | --help] [-r] [-3] [-g | --genre NUM] \n"); exit 1; } @@ -328,6 +335,7 @@ Usage: --comment STRING the comment to set (or "") -t --tagreplace STR Replace flac tags for a specific file only Like -t '02*flac/TITLE=Some other title' + -3, --320 Convert into CBR 320 instead into the default V0 EOF print($h); exit 0;