@@ -113,7 +113,7 @@ public static void AudEncoderSelected(int index)
113113
114114 static void LoadQualityLevel ( IEncoder enc )
115115 {
116- if ( form . encQualModeBox . SelectedIndex == 0 )
116+ if ( form . encQualModeBox . SelectedIndex == 0 )
117117 {
118118 if ( enc . QMax > 0 )
119119 form . encVidQualityBox . Maximum = enc . QMax ;
@@ -179,42 +179,26 @@ static void LoadAudBitrate(IEncoder enc)
179179
180180 public static void ValidateContainer ( )
181181 {
182- if ( form . ffmpegContainerBox . SelectedIndex < 0 )
182+ if ( form . av1anContainerBox . SelectedIndex < 0 )
183183 return ;
184184
185- CodecUtils . VideoCodec vCodec = ( CodecUtils . VideoCodec ) form . encVidCodecsBox . SelectedIndex ;
186- CodecUtils . AudioCodec aCodec = ( CodecUtils . AudioCodec ) form . encAudCodecBox . SelectedIndex ;
187- CodecUtils . SubtitleCodec sCodec = ( CodecUtils . SubtitleCodec ) form . encSubCodecBox . SelectedIndex ;
188- IEncoder encV = CodecUtils . GetCodec ( vCodec ) ;
185+ CodecUtils . AudioCodec aCodec = ( CodecUtils . AudioCodec ) form . av1anAudCodecBox . SelectedIndex ;
189186 IEncoder encA = CodecUtils . GetCodec ( aCodec ) ;
190- IEncoder encS = CodecUtils . GetCodec ( sCodec ) ;
191187
192- Containers . Container c = ( Containers . Container ) form . ffmpegContainerBox . SelectedIndex ;
188+ Containers . Container c = ( Containers . Container ) form . av1anContainerBox . SelectedIndex ;
193189
194- if ( ! ( Containers . ContainerSupports ( c , encV ) && Containers . ContainerSupports ( c , encA ) && Containers . ContainerSupports ( c , encS ) ) )
190+ if ( ! Containers . ContainerSupports ( c , encA ) )
195191 {
196- Containers . Container supported = Containers . GetSupportedContainer ( encV , encA , encS ) ;
192+ Containers . Container supported = Containers . Container . Mkv ;
197193
198- //Logger.Log($"{c.ToString().ToUpper()} doesn't support one of the selected codecs - Auto-selected {supported.ToString().ToUpper()} instead.");
199-
200- for ( int i = 0 ; i < form . ffmpegContainerBox . Items . Count ; i ++ )
201- if ( form . ffmpegContainerBox . Items [ i ] . ToString ( ) . ToUpper ( ) == supported . ToString ( ) . ToUpper ( ) )
202- form . ffmpegContainerBox . SelectedIndex = i ;
194+ for ( int i = 0 ; i < form . av1anContainerBox . Items . Count ; i ++ )
195+ if ( form . av1anContainerBox . Items [ i ] . ToString ( ) . ToUpper ( ) == supported . ToString ( ) . ToUpper ( ) )
196+ form . av1anContainerBox . SelectedIndex = i ;
203197 }
204198
205- bool fixedFormat = CodecUtils . GetCodec ( vCodec ) . IsFixedFormat ;
199+ Containers . Container current = MiscUtils . ParseEnum < Containers . Container > ( form . av1anContainerBox . Text ) ;
200+ Program . mainForm . av1anOutputPathBox . Text = Path . ChangeExtension ( form . av1anOutputPathBox . Text . Trim ( ) , current . ToString ( ) . ToLower ( ) ) ;
206201
207- if ( fixedFormat )
208- {
209- string format = vCodec . ToString ( ) . ToLower ( ) ;
210- Program . mainForm . ffmpegOutputBox . Text = Path . ChangeExtension ( form . ffmpegOutputBox . Text . Trim ( ) , format ) ;
211- }
212- else
213- {
214- Containers . Container current = MiscUtils . ParseEnum < Containers . Container > ( form . ffmpegContainerBox . Text ) ;
215- Program . mainForm . ffmpegOutputBox . Text = Path . ChangeExtension ( form . ffmpegOutputBox . Text . Trim ( ) , current . ToString ( ) . ToLower ( ) ) ;
216- }
217-
218202 ValidatePath ( ) ;
219203 }
220204
@@ -225,7 +209,7 @@ public static void ValidatePath()
225209
226210 //string ext = Program.mainForm.containerBox.Text.ToLower();
227211
228- if ( File . Exists ( Program . mainForm . ffmpegOutputBox . Text ) )
212+ if ( File . Exists ( Program . mainForm . ffmpegOutputBox . Text ) )
229213 Program . mainForm . ffmpegOutputBox . Text = IoUtils . GetAvailableFilename ( Program . mainForm . ffmpegOutputBox . Text ) ;
230214 }
231215
@@ -256,7 +240,7 @@ public static Dictionary<string, string> GetVideoArgsFromUi(bool vbr)
256240 dict . Add ( "bitrate" , GetVideoKbps ( ) . ToString ( ) ) ;
257241 else
258242 dict . Add ( "q" , form . encVidQualityBox . Value . ToString ( ) ) ;
259-
243+
260244 dict . Add ( "preset" , form . encVidPresetBox . Text . ToLower ( ) ) ;
261245 dict . Add ( "pixFmt" , form . encVidColorsBox . Text . ToLower ( ) ) ;
262246 dict . Add ( "qMode" , form . encQualModeBox . SelectedIndex . ToString ( ) ) ;
@@ -267,7 +251,7 @@ public static Dictionary<string, string> GetVideoArgsFromUi(bool vbr)
267251
268252 private static int GetVideoKbps ( )
269253 {
270- if ( ( QualityMode ) Program . mainForm . encQualModeBox . SelectedIndex == QualityMode . TargetKbps )
254+ if ( ( QualityMode ) Program . mainForm . encQualModeBox . SelectedIndex == QualityMode . TargetKbps )
271255 {
272256 string br = form . encVidQualityBox . Text . ToLower ( ) . Trim ( ) ;
273257 if ( br . EndsWith ( "k" ) ) return br . GetInt ( ) * 1024 ;
@@ -283,7 +267,7 @@ private static int GetVideoKbps()
283267 int audioBps = aud ? ( ( int ) form . encAudQualUpDown . Value * 1024 ) * audioTracks : 0 ;
284268 double durationSecs = TrackList . current . File . DurationMs / ( double ) 1000 ;
285269 float targetMbytes = form . encVidQualityBox . Text . GetFloat ( ) ;
286- long targetBits = ( long ) Math . Round ( targetMbytes * 8 * 1024 * 1024 ) ;
270+ long targetBits = ( long ) Math . Round ( targetMbytes * 8 * 1024 * 1024 ) ;
287271 int targetVidBitrate = ( int ) Math . Floor ( targetBits / durationSecs ) - audioBps ; // Round down since undershooting is better than overshooting here
288272 string brTotal = ( ( ( float ) targetVidBitrate + audioBps ) / 1024 ) . ToString ( "0.0" ) ;
289273 string brVid = ( ( float ) targetVidBitrate / 1024 ) . ToString ( "0" ) ;
@@ -369,7 +353,7 @@ public static void LoadMetadataGrid()
369353 grid . Columns [ 2 ] . FillWeight = 6 ;
370354 }
371355
372- public static void SaveMetadata ( )
356+ public static void SaveMetadata ( )
373357 {
374358 DataGridView grid = Program . mainForm . metaGrid ;
375359 Logger . Log ( $ "Saving metadata.", true ) ;
@@ -419,7 +403,7 @@ public static string GetMetadataArgs()
419403 {
420404 stripStr = "-map_metadata -1" ;
421405 }
422-
406+
423407
424408 int cfg = Config . GetInt ( Config . Key . metaMode ) ;
425409 DataGridView grid = form . metaGrid ;
@@ -452,7 +436,7 @@ public static string GetMetadataArgs()
452436 }
453437
454438 if ( cfg == 2 ) // 2 = Strip All
455- return $ "{ stripStr } { string . Join ( " " , argsDispo ) } ";
439+ return $ "{ stripStr } { string . Join ( " " , argsDispo ) } ";
456440
457441 bool map = cfg == 0 || cfg == 1 ; // 0 = Copy + Apply Editor Tags - 1 = Strip Others + Apply Editor Tags
458442 List < string > argsMeta = new List < string > ( ) ;
@@ -478,7 +462,7 @@ public static string GetMetadataArgs()
478462
479463 if ( cfg == 0 && entry . LanguageEdited . Trim ( ) != entry . Language )
480464 argsMeta . Add ( $ "-metadata:s:{ i } language=\" { entry . LanguageEdited } \" ") ;
481- else if ( cfg == 1 )
465+ else if ( cfg == 1 )
482466 argsMeta . Add ( $ "-metadata:s:{ i } language=\" { entry . LanguageEdited } \" ") ;
483467 }
484468 }
@@ -545,7 +529,7 @@ public static async Task<string> GetVideoFilterArgs(IEncoder vCodec, CodecArgs c
545529 return "" ;
546530 }
547531
548- public static string GetOutPath ( IEncoder c )
532+ public static string GetOutPath ( IEncoder c )
549533 {
550534 string uiPath = Program . mainForm . ffmpegOutputBox . Text . Trim ( ) ;
551535
0 commit comments