@@ -343,23 +343,8 @@ private void buttonTogglePreview_Click(object sender, EventArgs e)
343
343
344
344
private bool GeneratePreviewViaMpv ( )
345
345
{
346
- var fileName = Path . Combine ( Configuration . DataDirectory , "preview.mp4" ) ;
347
- if ( ! File . Exists ( fileName ) )
348
- {
349
- var isFfmpegAvailable = ! Configuration . IsRunningOnWindows || ! string . IsNullOrEmpty ( Configuration . Settings . General . FFmpegLocation ) && File . Exists ( Configuration . Settings . General . FFmpegLocation ) ;
350
- if ( ! isFfmpegAvailable )
351
- {
352
- return false ;
353
- }
354
-
355
- using ( var p = GetFFmpegProcess ( fileName ) )
356
- {
357
- p . Start ( ) ;
358
- p . WaitForExit ( ) ;
359
- }
360
- }
361
-
362
- if ( ! LibMpvDynamic . IsInstalled )
346
+ var fileName = VideoPreviewGenerator . GetVideoPreviewFileName ( ) ;
347
+ if ( string . IsNullOrEmpty ( fileName ) || ! LibMpvDynamic . IsInstalled )
363
348
{
364
349
return false ;
365
350
}
@@ -377,26 +362,6 @@ private bool GeneratePreviewViaMpv()
377
362
return true ;
378
363
}
379
364
380
- public static Process GetFFmpegProcess ( string outputFileName )
381
- {
382
- var ffmpegLocation = Configuration . Settings . General . FFmpegLocation ;
383
- if ( ! Configuration . IsRunningOnWindows && ( string . IsNullOrEmpty ( ffmpegLocation ) || ! File . Exists ( ffmpegLocation ) ) )
384
- {
385
- ffmpegLocation = "ffmpeg" ;
386
- }
387
-
388
- return new Process
389
- {
390
- StartInfo =
391
- {
392
- FileName = ffmpegLocation ,
393
- Arguments = $ "-t 1 -f lavfi -i color=c=blue:s=720x480 -c:v libx264 -tune stillimage -pix_fmt yuv420p \" { outputFileName } \" ",
394
- UseShellExecute = false ,
395
- CreateNoWindow = true
396
- }
397
- } ;
398
- }
399
-
400
365
private void VideoLoaded ( object sender , EventArgs e )
401
366
{
402
367
var format = new AdvancedSubStationAlpha ( ) ;
@@ -407,8 +372,8 @@ private void VideoLoaded(object sender, EventArgs e)
407
372
{
408
373
var p = new Paragraph ( _subtitle . Paragraphs [ indices [ 0 ] ] )
409
374
{
410
- StartTime = { TotalMilliseconds = 0 } ,
411
- EndTime = { TotalMilliseconds = 1000 }
375
+ StartTime = { TotalMilliseconds = 0 } ,
376
+ EndTime = { TotalMilliseconds = 2000 }
412
377
} ;
413
378
p . Text = styleToApply + p . Text ;
414
379
subtitle . Paragraphs . Add ( p ) ;
0 commit comments