@@ -37,7 +37,15 @@ getId("menuIcon").addEventListener("click", () => {
37
37
let ffmpeg ;
38
38
if ( os . platform ( ) === "win32" ) {
39
39
ffmpeg = `"${ __dirname } \\..\\ffmpeg.exe"` ;
40
- } else {
40
+ } else if ( os . platform ( ) === "freebsd" ) {
41
+ try {
42
+ ffmpeg = cp . execSync ( "which ffmpeg" ) . toString ( "utf8" ) . split ( "\n" ) [ 0 ] . trim ( ) ;
43
+ } catch ( error ) {
44
+ console . log ( error )
45
+ showPopup ( "No ffmpeg found in PATH." ) ;
46
+ }
47
+ }
48
+ else {
41
49
ffmpeg = `"${ __dirname } /../ffmpeg"` ;
42
50
}
43
51
@@ -304,6 +312,7 @@ function buildFFmpegCommand(file, settings, outputPath) {
304
312
"libx264" ,
305
313
"-preset" ,
306
314
settings . speed ,
315
+ "-vf" , "format=yuv420p" ,
307
316
"-crf" ,
308
317
parseInt ( settings . videoQuality ) . toString ( )
309
318
) ;
@@ -312,6 +321,7 @@ function buildFFmpegCommand(file, settings, outputPath) {
312
321
args . push (
313
322
"-c:v" ,
314
323
"libx265" ,
324
+ "-vf" , "format=yuv420p" ,
315
325
"-preset" ,
316
326
settings . speed ,
317
327
"-crf" ,
@@ -323,6 +333,7 @@ function buildFFmpegCommand(file, settings, outputPath) {
323
333
args . push (
324
334
"-c:v" ,
325
335
"h264_qsv" ,
336
+ "-vf" , "format=yuv420p" ,
326
337
"-preset" ,
327
338
settings . speed ,
328
339
"-global_quality" ,
@@ -359,6 +370,7 @@ function buildFFmpegCommand(file, settings, outputPath) {
359
370
args . push (
360
371
"-c:v" ,
361
372
"h264_nvenc" ,
373
+ "-vf" , "format=yuv420p" ,
362
374
"-preset" ,
363
375
getNvencPreset ( settings . speed ) ,
364
376
"-rc" ,
@@ -380,6 +392,7 @@ function buildFFmpegCommand(file, settings, outputPath) {
380
392
args . push (
381
393
"-c:v" ,
382
394
"hevc_amf" ,
395
+ "-vf" , "format=yuv420p" ,
383
396
"-quality" ,
384
397
amf_hevc_quality ,
385
398
"-rc" ,
@@ -402,6 +415,7 @@ function buildFFmpegCommand(file, settings, outputPath) {
402
415
args . push (
403
416
"-c:v" ,
404
417
"h264_amf" ,
418
+ "-vf" , "format=yuv420p" ,
405
419
"-quality" ,
406
420
amf_quality ,
407
421
"-rc" ,
@@ -417,6 +431,7 @@ function buildFFmpegCommand(file, settings, outputPath) {
417
431
case "videotoolbox" :
418
432
args . push (
419
433
"-c:v" ,
434
+ "-vf" , "format=yuv420p" ,
420
435
"h264_videotoolbox" ,
421
436
"-q:v" ,
422
437
parseInt ( settings . videoQuality ) . toString ( )
@@ -426,8 +441,6 @@ function buildFFmpegCommand(file, settings, outputPath) {
426
441
427
442
// args.push("-vf", "scale=trunc(iw*1/2)*2:trunc(ih*1/2)*2,format=yuv420p");
428
443
429
- args . push ( "-vf" , "format=yuv420p" ) ;
430
-
431
444
args . push ( "-c:a" , settings . audioFormat , `"${ outputPath } "` ) ;
432
445
433
446
return `${ ffmpeg } ${ args . join ( " " ) } ` ;
@@ -499,7 +512,7 @@ function createProgressItem(filename, status, data, itemId) {
499
512
<div class="filename">${ visibleFilename } </div>
500
513
<div id="${ itemId + "_prog" } " class="itemProgress">${ data } </div>
501
514
` ;
502
- statusElement . prepend ( newStatus ) ;
515
+ statusElement . append ( newStatus ) ;
503
516
}
504
517
505
518
/**
@@ -528,21 +541,6 @@ function timeToSeconds(timeStr) {
528
541
return hh * 3600 + mm * 60 + ss ;
529
542
}
530
543
531
- // Menu
532
- getId ( "preferenceWin" ) . addEventListener ( "click" , ( ) => {
533
- closeMenu ( ) ;
534
- ipcRenderer . send ( "load-page" , __dirname + "/preferences.html" ) ;
535
- } ) ;
536
-
537
- getId ( "aboutWin" ) . addEventListener ( "click" , ( ) => {
538
- closeMenu ( ) ;
539
- ipcRenderer . send ( "load-page" , __dirname + "/about.html" ) ;
540
- } ) ;
541
- getId ( "homeWin" ) . addEventListener ( "click" , ( ) => {
542
- closeMenu ( ) ;
543
- ipcRenderer . send ( "load-win" , __dirname + "/index.html" ) ;
544
- } ) ;
545
-
546
544
getId ( "themeToggle" ) . addEventListener ( "change" , ( ) => {
547
545
document . documentElement . setAttribute ( "theme" , getId ( "themeToggle" ) . value ) ;
548
546
localStorage . setItem ( "theme" , getId ( "themeToggle" ) . value ) ;
@@ -591,19 +589,33 @@ function closeMenu() {
591
589
// Menu
592
590
getId ( "preferenceWin" ) . addEventListener ( "click" , ( ) => {
593
591
closeMenu ( ) ;
592
+ menuIsOpen = false ;
594
593
ipcRenderer . send ( "load-page" , __dirname + "/preferences.html" ) ;
595
594
} ) ;
596
595
597
596
getId ( "playlistWin" ) . addEventListener ( "click" , ( ) => {
598
597
closeMenu ( ) ;
598
+ menuIsOpen = false ;
599
599
ipcRenderer . send ( "load-win" , __dirname + "/playlist.html" ) ;
600
600
} ) ;
601
601
602
602
getId ( "aboutWin" ) . addEventListener ( "click" , ( ) => {
603
603
closeMenu ( ) ;
604
+ menuIsOpen = false ;
604
605
ipcRenderer . send ( "load-page" , __dirname + "/about.html" ) ;
605
606
} ) ;
606
607
getId ( "homeWin" ) . addEventListener ( "click" , ( ) => {
607
608
closeMenu ( ) ;
609
+ menuIsOpen = false ;
608
610
ipcRenderer . send ( "load-win" , __dirname + "/index.html" ) ;
609
- } ) ;
611
+ } ) ;
612
+
613
+ // Popup message
614
+ function showPopup ( text ) {
615
+ console . log ( "Triggered showpopup" ) ;
616
+ getId ( "popupText" ) . textContent = text ;
617
+ getId ( "popupText" ) . style . display = "inline-block" ;
618
+ setTimeout ( ( ) => {
619
+ getId ( "popupText" ) . style . display = "none" ;
620
+ } , 2200 ) ;
621
+ }
0 commit comments