@@ -41,10 +41,11 @@ package export::generic;
4141 add_arg(' fast_denoise|fast-denoise!' , ' Use fast noise reduction instead of standard.' );
4242 add_arg(' nocrop' , ' Do not crop out broadcast overscan.' );
4343 add_arg(' crop_pct=f' , ' Percentage of overscan to crop (0-5%, defaults to 2%).' );
44- add_arg(' crop_top=f' , ' Percentage of overscan to crop from the top.' );
44+ add_arg(' crop_top=f' , ' Percentage of overscan to crop from the top. (0-20%) ' );
4545 add_arg(' crop_right=f' , ' Percentage of overscan to crop from the right.' );
46- add_arg(' crop_bottom=f' , ' Percentage of overscan to crop from the top. ' );
46+ add_arg(' crop_bottom=f' , ' Percentage of overscan to crop from the bottom. (0-20%) ' );
4747 add_arg(' crop_left=f' , ' Percentage of overscan to crop from the left.' );
48+ add_arg(' out_aspect=s' , ' Force output aspect ratio.' );
4849
4950# Load defaults
5051 sub load_defaults {
@@ -85,14 +86,14 @@ package export::generic;
8586 if ($self -> val(' crop_pct' ) < 0 || $self -> val(' crop_pct' ) > 5) {
8687 die " crop_pct must be a number between 0 and 5.\n " ;
8788 }
88- if ($self -> val(' crop_top' ) < 0 || $self -> val(' crop_top' ) > 5 ) {
89- die " crop_top must be a number between 0 and 5 .\n " ;
89+ if ($self -> val(' crop_top' ) < 0 || $self -> val(' crop_top' ) > 20 ) {
90+ die " crop_top must be a number between 0 and 20 .\n " ;
9091 }
9192 if ($self -> val(' crop_right' ) < 0 || $self -> val(' crop_right' ) > 5) {
9293 die " crop_right must be a number between 0 and 5.\n " ;
9394 }
94- if ($self -> val(' crop_bottom' ) < 0 || $self -> val(' crop_bottom' ) > 5 ) {
95- die " crop_bottom must be a number between 0 and 5 .\n " ;
95+ if ($self -> val(' crop_bottom' ) < 0 || $self -> val(' crop_bottom' ) > 20 ) {
96+ die " crop_bottom must be a number between 0 and 20 .\n " ;
9697 }
9798 if ($self -> val(' crop_left' ) < 0 || $self -> val(' crop_left' ) > 5) {
9899 die " crop_left must be a number between 0 and 5.\n " ;
@@ -104,6 +105,23 @@ package export::generic;
104105 $self -> {' crop' } = 1;
105106 }
106107 }
108+ # Clean up the aspect override, if one was passed in
109+ if ($self -> val(' out_aspect' )) {
110+ $self -> {' aspect_stretched' } = 1;
111+ my $aspect = $self -> {' out_aspect' };
112+ # European decimals...
113+ $aspect =~ s /\, / \. / ;
114+ # In ratio format -- do the math
115+ if ($aspect =~ / ^\d +:\d +$ / ) {
116+ my ($w , $h ) = split /:/, $aspect ;
117+ $aspect = $w / $h ;
118+ }
119+ # Parse out decimal formats
120+ elsif ($aspect eq ' 1' ) { $aspect = 1; }
121+ elsif ($aspect =~ m / ^1.3/ ) { $aspect = 4 / 3; }
122+ elsif ($aspect =~ m / ^1.7/ ) { $aspect = 16 / 9; }
123+ $self -> {' out_aspect' } = $aspect ;
124+ }
107125 }
108126
109127# Gather settings from the user
@@ -157,11 +175,12 @@ package export::generic;
157175 else {
158176 foreach my $side (' top' , ' right' , ' bottom' , ' left' ) {
159177 while (1) {
178+ my $max = ($side eq ' top' || $side eq ' bottom' ) ? 20 : 5;
160179 my $pct = query_text(" Crop broadcast overscan $side border (0-5\% ) ?" ,
161180 ' float' ,
162181 $self -> val(" crop_$side " ));
163- if ($pct < 0 || $pct > 5 ) {
164- print " Crop percentage must be between 0 and 5 percent.\n " ;
182+ if ($pct < 0 || $pct > $max ) {
183+ print " Crop percentage must be between 0 and $max percent.\n " ;
165184 }
166185 else {
167186 $self -> {" crop_$side " } = $pct ;
0 commit comments