This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintained by Chris Petersen <mythtv@forevermore.net>
Expand All
@@ -23,21 +23,21 @@ package export::ffmpeg::SVCD;
subnew {
my$class = shift;
my$self = {
'cli'=>qr/\bsvcd\b/i,
'name'=>'Export to SVCD',
'enabled'=> 1,
'errors'=> [],
# Transcode-related settings
'noise_reduction'=> 1,
'deinterlace'=> 1,
'crop'=> 1,
# SVCD-specific settings
'quantisation'=> 5, # 4 through 6 is probably right...
'a_bitrate'=> 192,
'v_bitrate'=> 2500,
'cli'=>qr/\bsvcd\b/i,
'name'=>'Export to SVCD',
'enabled'=> 1,
'errors'=> [],
'defaults'=> {},
};
bless($self, $class);
# Initialize the default parameters
$self->load_defaults();
# Verify any commandline or config file options
die"Audio bitrate must be > 0\n"unless (!defined$self->val('a_bitrate') || $self->{'a_bitrate'} > 0);
die"Video bitrate must be > 0\n"unless (!defined$self->val('v_bitrate') || $self->{'v_bitrate'} > 0);
# Initialize and check for ffmpeg
$self->init_ffmpeg();
# Can we even encode svcd?
Expand All
@@ -53,66 +53,76 @@ package export::ffmpeg::SVCD;
return$self;
}
# Load default settings
subload_defaults {
my$self = shift;
# Load the parent module's settings
$self->SUPER::load_defaults();
# Add the svcd preferred bitrates
$self->{'defaults'}{'quantisation'} = 5;
$self->{'defaults'}{'a_bitrate'} = 192;
$self->{'defaults'}{'v_bitrate'} = 2500;
}
# Gather settings from the user
subgather_settings {
my$self = shift;
# Load the parent module's settings
$self->SUPER::gather_settings();
# Ask the user what audio bitrate he/she wants
$self->{'a_bitrate'} = arg('a_bitrate') if (arg('a_bitrate'));
if (!arg('a_bitrate') || arg('confirm')) {
while (1) {
my$a_bitrate = query_text('Audio bitrate?',
'int',
$self->{'a_bitrate'});
if ($a_bitrate < 64) {
print"Too low; please choose a bitrate >= 64.\n";
}
elsif ($a_bitrate > 384) {
print"Too high; please choose a bitrate <= 384.\n";
}
else {
$self->{'a_bitrate'} = $a_bitrate;
last;
}
# Audio Bitrate
while (1) {
my$a_bitrate = query_text('Audio bitrate?',
'int',
$self->val('a_bitrate'));
if ($a_bitrate < 64) {
print"Too low; please choose a bitrate between 64 and 384.\n";
}
elsif ($a_bitrate > 384) {
print"Too high; please choose a bitrate between 64 and 384.\n";
}
else {
$self->{'a_bitrate'} = $a_bitrate;
last;
}
}
# Ask the user what video bitrate he/she wants, or calculate the max bitrate (2756 max, though we round down a bit since some dvd players can't handle the max)
# Then again, mpeg2enc seems to have trouble with bitrates > 2500
my$max_v_bitrate = 2742 - $self->{'a_bitrate'};
$self->{'v_bitrate'} = arg('v_bitrate') if (arg('v_bitrate'));
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$self->{'a_bitrate'} = arg('a_bitrate') if (arg('a_bitrate'));
if (!arg('a_bitrate') || arg('confirm')) {
while (1) {
my$a_bitrate = query_text('Audio bitrate?',
'int',
$self->{'a_bitrate'});
if ($a_bitrate < 64) {
print"Too low; please choose a bitrate >= 64.\n";
}
elsif ($a_bitrate > 384) {
print"Too high; please choose a bitrate <= 384.\n";
}
else {
$self->{'a_bitrate'} = $a_bitrate;
last;
}
# Audio Bitrate
while (1) {
my$a_bitrate = query_text('Audio bitrate?',
'int',
$self->val('a_bitrate'));
if ($a_bitrate < 64) {
print"Too low; please choose a bitrate between 64 and 384.\n";
}
elsif ($a_bitrate > 384) {
print"Too high; please choose a bitrate between 64 and 384.\n";
}
else {
$self->{'a_bitrate'} = $a_bitrate;
last;
}
}
# Ask the user what video bitrate he/she wants, or calculate the max bitrate (2756 max, though we round down a bit since some dvd players can't handle the max)
# Then again, mpeg2enc seems to have trouble with bitrates > 2500
my$max_v_bitrate = 2742 - $self->{'a_bitrate'};
$self->{'v_bitrate'} = arg('v_bitrate') if (arg('v_bitrate'));
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters