-
Notifications
You must be signed in to change notification settings - Fork 267
/
media-autobuild_suite.bat
executable file
·2112 lines (1929 loc) · 83.6 KB
/
media-autobuild_suite.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
@echo off
rem -----------------------------------------------------------------------------
rem LICENSE --------------------------------------------------------------------
rem -----------------------------------------------------------------------------
rem This Windows Batchscript is for setup a compiler environment for building
rem ffmpeg and other media tools under Windows.
rem
rem Copyright (C) 2013 jb_alvarado
rem
rem This program is free software: you can redistribute it and/or modify
rem it under the terms of the GNU General Public License as published by
rem the Free Software Foundation, either version 3 of the License, or
rem (at your option) any later version.
rem
rem This program is distributed in the hope that it will be useful,
rem but WITHOUT ANY WARRANTY; without even the implied warranty of
rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
rem GNU General Public License for more details.
rem
rem You should have received a copy of the GNU General Public License
rem along with this program. If not, see <https://www.gnu.org/licenses/>.
rem -----------------------------------------------------------------------------
color 70
title media-autobuild_suite
setlocal
chcp 65001 >nul 2>&1
cd /d "%~dp0"
set "TERM=xterm-256color"
setlocal
set instdir=%CD%
if %PROCESSOR_ARCHITECTURE%==x86 if NOT DEFINED PROCESSOR_ARCHITEW6432 (
echo ----------------------------------------------------------------------
echo. 32-bit host machine and OS are no longer supported by the suite
echo. nor upstream for building.
echo. Please consider either moving to a 64-bit machine and OS or use
echo. a 64-bit machine to compile the binaries you need.
pause
exit
)
if not exist %instdir% (
echo ----------------------------------------------------------------------
echo. You have probably run the script in a path with spaces.
echo. This is not supported.
echo. Please move the script to use a path without spaces. Example:
echo. Incorrect: C:\build suite\
echo. Correct: C:\build_suite\
pause
exit
)
if not ["%instdir:~32,1%"]==[""] (
echo -------------------------------------------------------------------------------
echo. The total filepath to the suite seems too large (larger than 32 characters^):
echo. %instdir%
echo. Some packages might fail building because of it.
echo. Please move the suite directory closer to the root of your drive and maybe
echo. rename the suite directory to a smaller name. Examples:
echo. Avoid: C:\Users\Administrator\Desktop\testing\media-autobuild_suite-master
echo. Prefer: C:\media-autobuild_suite
echo. Prefer: C:\ab-suite
pause
)
for /f "usebackq tokens=*" %%f in (`powershell -noprofile -command $PSVersionTable.PSVersion.Major`) ^
do if %%f lss 4 (
echo ----------------------------------------------------------------------
echo. You do not have a powershell version greater than 4.
echo. This is not supported.
echo. Please upgrade your powershell either through downloading and installing WMF 5.1
echo. https://docs.microsoft.com/en-us/powershell/wmf/5.1/install-configure
echo. or by upgrading your OS.
echo. This is not Powershell Core. That is separate.
pause
exit
)
(
where lib.exe || ^
where cl.exe || ^
if DEFINED VSINSTALLDIR cd .
) >nul 2>&1 && (
rem MSVCINSTALLED
echo ----------------------------------------------------------------------
echo. You are running in a MSVC environment (cl.exe or lib.exe detected^)
echo. This is not supported.
echo. Please run the script through a normal cmd.exe some other way.
echo.
echo. Detected Paths:
where lib.exe 2>nul
where cl.exe 2>nul
echo %VSINSTALLDIR%
pause
exit
)
set build=%instdir%\build
if not exist %build% mkdir %build%
set msyspackages=asciidoc autoconf-wrapper automake-wrapper autogen base bison diffstat dos2unix filesystem help2man ^
intltool libtool patch python xmlto make zip unzip git subversion wget p7zip man-db ^
gperf winpty texinfo gyp doxygen autoconf-archive itstool ruby mintty flex msys2-runtime pacutils
set mingwpackages=cmake dlfcn libpng nasm pcre tools-git yasm ninja pkgconf meson ccache jq ^
gettext-tools
:: built-ins
set ffmpeg_options_builtin=--disable-autodetect amf bzlib cuda cuvid d3d12va d3d11va dxva2 ^
iconv lzma nvenc schannel zlib sdl2 ffnvcodec nvdec cuda-llvm
:: common external libs
set ffmpeg_options_basic=gmp libmp3lame libopus libvorbis libvpx libx264 libx265 ^
libdav1d libaom --disable-debug libfdk-aac
:: options used in zeranoe builds and not present above
set ffmpeg_options_zeranoe=fontconfig gnutls libass libbluray libfreetype ^
libharfbuzz libvpl libmysofa libopencore-amrnb libopencore-amrwb libopenjpeg libsnappy ^
libsoxr libspeex libtheora libtwolame libvidstab libvo-amrwbenc ^
libwebp libxml2 libzimg libshine gpl openssl libtls avisynth #mbedtls libxvid ^
libopenmpt version3 librav1e libsrt libgsm libvmaf libsvtav1
:: options also available with the suite
set ffmpeg_options_full=chromaprint decklink frei0r libaribb24 libbs2b libcaca ^
libcdio libflite libfribidi libgme libilbc libsvthevc ^
libsvtvp9 libkvazaar libmodplug librist librtmp librubberband #libssh ^
libtesseract libxavs libzmq libzvbi openal libcodec2 ladspa #vapoursynth #liblensfun ^
libglslang vulkan libdavs2 libxavs2 libuavs3d libplacebo libjxl libvvenc libvvdec liblc3
:: options also available with the suite that add shared dependencies
set ffmpeg_options_full_shared=opencl opengl cuda-nvcc libnpp libopenh264
:: built-ins
set mpv_options_builtin=#cplayer #manpage-build #lua #javascript ^
#libbluray #uchardet #rubberband #lcms2 #libarchive #libavdevice ^
#shaderc #spirv-cross #d3d11 #jpeg #vapoursynth #vulkan #libplacebo
:: overriden defaults
set mpv_options_basic=--disable-debug-build "--lua=luajit"
:: all supported options
set mpv_options_full=dvdnav cdda #egl-angle #html-build ^
#pdf-build libmpv-shared openal sdl2 #sdl2-gamepad #sdl2-audio #sdl2-video
set iniOptions=arch license2 vpx2 x2643 x2652 other265 flac fdkaac mediainfo ^
soxB ffmpegB2 ffmpegUpdate ffmpegChoice mp4box rtmpdump mplayer2 mpv cores deleteSource ^
strip pack logging bmx standalone updateSuite av1an aom faac exhale ffmbc curl cyanrip2 ^
rav1e ripgrep dav1d libavif vvc uvg266 jq dssim avs2 dovitool hdr10plustool timeStamp ^
noMintty ccache svthevc svtav1 svtvp9 xvc jo vlc CC jpegxl vvenc vvdec ffmpegPath pkgUpdateTime
@rem re-add autouploadlogs if we find some way to upload to github directly instead
set deleteIni=0
set ini=%build%\media-autobuild_suite.ini
rem Set all INI options to 0
for %%a in (%iniOptions%) do set %%aINI=0
if exist %ini% (
rem Set INI options to what's found in the inifile
echo.foreach ($option in $env:iniOptions.split(" "^)^) { ^
$m = Select-String -Path $env:ini -CaseSensitive -SimpleMatch -Pattern $option; ^
if ($null -ne $m^) { ^
Write-Output "set `"${option}INI^=$($m.Line.Split("="^, 2^)[1]^)`"" ^
} else { ^
Write-Output "set `"${option}INI^=0^`"" ^
} ^
} | powershell -NoProfile -Command - > %build%\options.bat
call %build%\options.bat
del %build%\options.bat
) else set deleteIni=1
setlocal EnableDelayedExpansion
rem Check if any of the *INI options are still unset (0)
for %%a in (%iniOptions%) do if [0]==[!%%aINI!] set deleteIni=1 && goto :endINIcheck
:endINIcheck
endlocal & set deleteIni=%deleteIni%
if %deleteINI%==1 echo.[compiler list] >"%ini%"
:selectSystem
if [0]==[%archINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Select the build target system:
echo. 1 = both [32 bit and 64 bit]
echo. 2 = 32 bit build system
echo. 3 = 64 bit build system
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildEnv="Build System: "
) else set buildEnv=%archINI%
if "%buildEnv%"=="" GOTO selectSystem
if %buildEnv%==1 set "build32=yes" && set "build64=yes"
if %buildEnv%==2 set "build32=yes" && set "build64=no"
if %buildEnv%==3 set "build32=no" && set "build64=yes"
if %buildEnv% GTR 3 GOTO selectSystem
if %deleteINI%==1 echo.arch=^%buildEnv%>>%ini%
:ffmpeglicense
if [0]==[%license2INI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build FFmpeg with which license?
echo. 1 = Non-free [unredistributable, but can include anything]
echo. 2 = GPLv3 [disables OpenSSL and FDK-AAC]
echo. 3 = GPLv2.1
echo. [Same disables as GPLv3 with addition of gmp, opencore codecs]
echo. 4 = LGPLv3
echo. [Disables x264, x265, XviD, GPL filters, etc.
echo. but reenables OpenSSL/FDK-AAC]
echo. 5 = LGPLv2.1 [same disables as LGPLv3 + GPLv2.1]
echo.
echo. If building for yourself, it's OK to choose non-free.
echo. If building to redistribute online, choose GPL or LGPL.
echo. If building to include in a GPLv2.1 binary, choose LGPLv2.1 or GPLv2.1.
echo. If you want to use FFmpeg together with closed source software, choose LGPL
echo. and follow instructions in https://www.ffmpeg.org/legal.html
echo.
echo. OpenSSL and FDK-AAC have licenses incompatible with GPL but compatible
echo. with LGPL, so they won't be disabled automatically if you choose LGPL.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P ffmpegLicense="FFmpeg license: "
) else set ffmpegLicense=%license2INI%
if "%ffmpegLicense%"=="" GOTO ffmpeglicense
if %ffmpegLicense%==1 set "license2=nonfree"
if %ffmpegLicense%==2 set "license2=gplv3"
if %ffmpegLicense%==3 set "license2=gpl"
if %ffmpegLicense%==4 set "license2=lgplv3"
if %ffmpegLicense%==5 set "license2=lgpl"
if %ffmpegLicense% GTR 5 GOTO ffmpeglicense
if %deleteINI%==1 echo.license2=^%ffmpegLicense%>>%ini%
:standalone
if [0]==[%standaloneINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build standalone binaries for libraries included in FFmpeg?
echo. eg. Compile opusenc.exe if --enable-libopus
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildstandalone="Build standalone binaries: "
) else set buildstandalone=%standaloneINI%
if "%buildstandalone%"=="" GOTO standalone
if %buildstandalone%==1 set "standalone=y"
if %buildstandalone%==2 set "standalone=n"
if %buildstandalone% GTR 2 GOTO standalone
if %deleteINI%==1 echo.standalone=^%buildstandalone%>>%ini%
:av1an
if [0]==[%av1anINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build Av1an [Scalable video encoding framework]?
echo. 1 = Yes [link with static FFmpeg]
echo. 2 = Yes [link with shared FFmpeg]
echo. 3 = No
echo.
echo. Av1an requires local installed copies of Python and Vapoursynth,
echo. an executable of FFmpeg and one of these encoders to function:
echo. aom, SVT-AV1, rav1e, vpx, x264, or x265
echo. If FFmpeg is built shared, then the Av1an executable will be in a subfolder.
echo. (Note: Not available for 32-bit due to Vapoursynth being broken in 32-bit!^)
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildav1an="Build av1an: "
) else set buildav1an=%av1anINI%
if "%buildav1an%"=="" GOTO av1an
if %buildav1an%==1 set "av1an=y"
if %buildav1an%==2 set "av1an=shared"
if %buildav1an%==3 set "av1an=n"
if %buildav1an% GTR 3 GOTO av1an
if %deleteINI%==1 echo.av1an=^%buildav1an%>>%ini%
:vpx
if [0]==[%vpx2INI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build vpx [VP8/VP9 encoder]?
echo. 1 = Yes
echo. 2 = No
echo.
echo. Binaries being built depends on "standalone/av1an=y" and are always static.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildvpx="Build vpx: "
) else set buildvpx=%vpx2INI%
if "%buildvpx%"=="" GOTO vpx
if %buildvpx%==1 set "vpx2=y"
if %buildvpx%==2 set "vpx2=n"
if %buildvpx% GTR 2 GOTO vpx
if %deleteINI%==1 echo.vpx2=^%buildvpx%>>%ini%
:aom
if [0]==[%aomINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build aom [Alliance for Open Media codec]?
echo. 1 = Yes
echo. 2 = No
echo.
echo. Binaries being built depends on "standalone/av1an=y" and are always static.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildaom="Build aom: "
) else set buildaom=%aomINI%
if "%buildaom%"=="" GOTO aom
if %buildaom%==1 set "aom=y"
if %buildaom%==2 set "aom=n"
if %buildaom% GTR 2 GOTO aom
if %deleteINI%==1 echo.aom=^%buildaom%>>%ini%
:rav1e
if [0]==[%rav1eINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build rav1e [Alternative, faster AV1 standalone encoder]?
echo. 1 = Yes
echo. 2 = No
echo.
echo. Binaries being built depends on "standalone/av1an=y" and are always static.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildrav1e="Build rav1e: "
) else set buildrav1e=%rav1eINI%
if "%buildrav1e%"=="" GOTO rav1e
if %buildrav1e%==1 set "rav1e=y"
if %buildrav1e%==2 set "rav1e=n"
if %buildrav1e% GTR 2 GOTO rav1e
if %deleteINI%==1 echo.rav1e=^%buildrav1e%>>%ini%
:dav1d
if [0]==[%dav1dINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build dav1d [Alternative, faster AV1 decoder]?
echo. 1 = Yes
echo. 2 = No
echo.
echo. Binaries being built depends on "standalone=y" and are always static.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P builddav1d="Build dav1d: "
) else set builddav1d=%dav1dINI%
if "%builddav1d%"=="" GOTO dav1d
if %builddav1d%==1 set "dav1d=y"
if %builddav1d%==2 set "dav1d=n"
if %builddav1d% GTR 2 GOTO dav1d
if %deleteINI%==1 echo.dav1d=^%builddav1d%>>%ini%
:libavif
if [0]==[%libavifINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build libavif [AV1 image format encoder and decoder]?
echo. 1 = Yes
echo. 2 = No
echo.
echo. Binaries being built depends on "standalone=y" and are always static.
echo. Will build aom, dav1d, and rav1e if not already previously enabled
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildlibavif="Build libavif: "
) else set buildlibavif=%libavifINI%
if "%buildlibavif%"=="" GOTO libavif
if %buildlibavif%==1 set "libavif=y"
if %buildlibavif%==2 set "libavif=n"
if %buildlibavif% GTR 2 GOTO libavif
if %deleteINI%==1 echo.libavif=^%buildlibavif%>>%ini%
:jpegxl
if [0]==[%jpegxlINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build jpeg-xl tools [JPEG XL image format encoder and decoder]?
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildjpegxl="Build jpegxl: "
) else set buildjpegxl=%jpegxlINI%
if "%buildjpegxl%"=="" GOTO jpegxl
if %buildjpegxl%==1 set "jpegxl=y"
if %buildjpegxl%==2 set "jpegxl=n"
if %buildjpegxl% GTR 2 GOTO jpegxl
if %deleteINI%==1 echo.jpegxl=^%buildjpegxl%>>%ini%
:x264
if [0]==[%x2643INI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build x264 [H.264 encoder]?
echo. 1 = Lib/binary with 8 and 10-bit
echo. 2 = No
echo. 3 = Lib/binary with only 10-bit
echo. 4 = Lib/binary with 8 and 10-bit, and libavformat and ffms2
echo. 5 = Shared lib/binary with 8 and 10-bit
echo. 6 = Same as 4 with video codecs only (can reduce size by ~3MB^)
echo. 7 = Lib/binary with only 8-bit
echo.
echo. Binaries being built depends on "standalone/av1an=y" and are always static.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildx264="Build x264: "
) else set buildx264=%x2643INI%
if "%buildx264%"=="" GOTO x264
if %buildx264%==1 set "x2643=yes"
if %buildx264%==2 set "x2643=no"
if %buildx264%==3 set "x2643=high"
if %buildx264%==4 set "x2643=full"
if %buildx264%==5 set "x2643=shared"
if %buildx264%==6 set "x2643=fullv"
if %buildx264%==7 set "x2643=o8"
if %buildx264% GTR 7 GOTO x264
if %deleteINI%==1 echo.x2643=^%buildx264%>>%ini%
:x265
if [0]==[%x2652INI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build x265 [H.265 encoder]?
echo. 1 = Lib/binary with Main, Main10 and Main12
echo. 2 = No
echo. 3 = Lib/binary with Main10 only
echo. 4 = Lib/binary with Main only
echo. 5 = Lib/binary with Main, shared libs with Main10 and Main12
echo. 6 = Same as 1 with XP support and non-XP compatible x265-numa.exe
echo. 7 = Lib/binary with Main12 only
echo.
echo. Binaries being built depends on "standalone/av1an=y" and are always static.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildx265="Build x265: "
) else set buildx265=%x2652INI%
if "%buildx265%"=="" GOTO x265
if %buildx265%==1 set "x2652=y"
if %buildx265%==2 set "x2652=n"
if %buildx265%==3 set "x2652=o10"
if %buildx265%==4 set "x2652=o8"
if %buildx265%==5 set "x2652=s"
if %buildx265%==6 set "x2652=d"
if %buildx265%==7 set "x2652=o12"
if %buildx265% GTR 7 GOTO x265
if %deleteINI%==1 echo.x2652=^%buildx265%>>%ini%
:other265
if [0]==[%other265INI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build Kvazaar? [H.265 encoder]
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildother265="Build kvazaar: "
) else set buildother265=%other265INI%
if "%buildother265%"=="" GOTO other265
if %buildother265%==1 set "other265=y"
if %buildother265%==2 set "other265=n"
if %buildother265% GTR 2 GOTO other265
if %deleteINI%==1 echo.other265=^%buildother265%>>%ini%
:svthevc
if [0]==[%svthevcINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build SVT-HEVC? [H.265 encoder]
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildsvthevc="Build SVT-HEVC: "
) else set buildsvthevc=%svthevcINI%
if "%buildsvthevc%"=="" GOTO svthevc
if %buildsvthevc%==1 set "svthevc=y"
if %buildsvthevc%==2 set "svthevc=n"
if %buildsvthevc% GTR 2 GOTO svthevc
if %deleteINI%==1 echo.svthevc=^%buildsvthevc%>>%ini%
:xvc
if [0]==[%xvcINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build xvc? [HEVC and AV1 competitor]
echo. 1 = Yes
echo. 2 = No
echo.
echo. Any issues with this will be considered low-priority due to lack of
echo. potential stability
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildxvc="Build xvc: "
) else set buildxvc=%xvcINI%
if "%buildxvc%"=="" GOTO xvc
if %buildxvc%==1 set "xvc=y"
if %buildxvc%==2 set "xvc=n"
if %buildxvc% GTR 2 GOTO xvc
if %deleteINI%==1 echo.xvc=^%buildxvc%>>%ini%
:vvc
if [0]==[%vvcINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build VVC Reference Software? [H.265 successor enc/decoder]
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildvvc="Build vvc: "
) else set buildvvc=%vvcINI%
if "%buildvvc%"=="" GOTO vvc
if %buildvvc%==1 set "vvc=y"
if %buildvvc%==2 set "vvc=n"
if %buildvvc% GTR 2 GOTO vvc
if %deleteINI%==1 echo.vvc=^%buildvvc%>>%ini%
:uvg266
if [0]==[%uvg266INI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build uvg266? [H.266 encoder by ultravideo, the Kvazaar team]
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P builduvg266="Build uvg266: "
) else set builduvg266=%uvg266INI%
if "%builduvg266%"=="" GOTO uvg266
if %builduvg266%==1 set "uvg266=y"
if %builduvg266%==2 set "uvg266=n"
if %builduvg266% GTR 2 GOTO uvg266
if %deleteINI%==1 echo.uvg266=^%builduvg266%>>%ini%
:vvenc
if [0]==[%vvencINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build vvenc? [Fraunhofer HHI Versatile Video Encoder]
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildvvenc="Build vvenc: "
) else set buildvvenc=%vvencINI%
if "%buildvvenc%"=="" GOTO vvenc
if %buildvvenc%==1 set "vvenc=y"
if %buildvvenc%==2 set "vvenc=n"
if %buildvvenc% GTR 2 GOTO vvenc
if %deleteINI%==1 echo.vvenc=^%buildvvenc%>>%ini%
:vvdec
if [0]==[%vvdecINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build vvdec? [Fraunhofer HHI Versatile Video Decoder]
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildvvdec="Build vvdec: "
) else set buildvvdec=%vvdecINI%
if "%buildvvdec%"=="" GOTO vvdec
if %buildvvdec%==1 set "vvdec=y"
if %buildvvdec%==2 set "vvdec=n"
if %buildvvdec% GTR 2 GOTO vvdec
if %deleteINI%==1 echo.vvdec=^%buildvvdec%>>%ini%
:svtav1
if [0]==[%svtav1INI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build SVT-AV1? [AV1 encoder]
echo. 1 = Yes
echo. 2 = No
echo.
echo. Look at the link for hardware requirements
echo. https://github.com/OpenVisualCloud/SVT-AV1/blob/master/README.md#Hardware
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildsvtav1="Build SVT-AV1: "
) else set buildsvtav1=%svtav1INI%
if "%buildsvtav1%"=="" GOTO svtav1
if %buildsvtav1%==1 set "svtav1=y"
if %buildsvtav1%==2 set "svtav1=n"
if %buildsvtav1% GTR 2 GOTO svtav1
if %deleteINI%==1 echo.svtav1=^%buildsvtav1%>>%ini%
:svtvp9
if [0]==[%svtvp9INI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build SVT-VP9? [VP9 encoder]
echo. 1 = Yes
echo. 2 = No
echo.
echo. Look at the link for hardware requirements
echo. https://github.com/OpenVisualCloud/SVT-VP9#Hardware
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildsvtvp9="Build SVT-VP9: "
) else set buildsvtvp9=%svtvp9INI%
if "%buildsvtvp9%"=="" GOTO svtvp9
if %buildsvtvp9%==1 set "svtvp9=y"
if %buildsvtvp9%==2 set "svtvp9=n"
if %buildsvtvp9% GTR 2 GOTO svtvp9
if %deleteINI%==1 echo.svtvp9=^%buildsvtvp9%>>%ini%
:flac
if [0]==[%flacINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build FLAC? [Free Lossless Audio Codec]
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildflac="Build flac: "
) else set buildflac=%flacINI%
if "%buildflac%"=="" GOTO flac
if %buildflac%==1 set "flac=y"
if %buildflac%==2 set "flac=n"
if %buildflac% GTR 2 GOTO flac
if %deleteINI%==1 echo.flac=^%buildflac%>>%ini%
:fdkaac
if [0]==[%fdkaacINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build FDK-AAC library and binary? [AAC-LC/HE/HEv2 codec]
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildfdkaac="Build fdkaac: "
) else set buildfdkaac=%fdkaacINI%
if "%buildfdkaac%"=="" GOTO fdkaac
if %buildfdkaac%==1 set "fdkaac=y"
if %buildfdkaac%==2 set "fdkaac=n"
if %buildfdkaac% GTR 2 GOTO fdkaac
if %deleteINI%==1 echo.fdkaac=^%buildfdkaac%>>%ini%
:faac
if [0]==[%faacINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build FAAC library and binary? [old, low-quality and nonfree AAC-LC codec]
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildfaac="Build faac: "
) else set buildfaac=%faacINI%
if "%buildfaac%"=="" GOTO faac
if %buildfaac%==1 set "faac=y"
if %buildfaac%==2 set "faac=n"
if %buildfaac% GTR 2 GOTO faac
if %deleteINI%==1 echo.faac=^%buildfaac%>>%ini%
:exhale
if [0]==[%exhaleINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build exhale binary? [open-source ISO/IEC 23003-3 USAC, xHE-AAC encoder]
echo. 1 = Yes
echo. 2 = No
echo.
echo. Binaries being built do not depend on "standalone=y"
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildexhale="Build exhale: "
) else set buildexhale=%exhaleINI%
if "%buildexhale%"=="" GOTO exhale
if %buildexhale%==1 set "exhale=y"
if %buildexhale%==2 set "exhale=n"
if %buildexhale% GTR 2 GOTO exhale
if %deleteINI%==1 echo.exhale=^%buildexhale%>>%ini%
:mediainfo
if [0]==[%mediainfoINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build mediainfo binaries [Multimedia file information tool]?
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildmediainfo="Build mediainfo: "
) else set buildmediainfo=%mediainfoINI%
if "%buildmediainfo%"=="" GOTO mediainfo
if %buildmediainfo%==1 set "mediainfo=y"
if %buildmediainfo%==2 set "mediainfo=n"
if %buildmediainfo% GTR 2 GOTO mediainfo
if %deleteINI%==1 echo.mediainfo=^%buildmediainfo%>>%ini%
:sox
if [0]==[%soxBINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build sox binaries [Sound processing tool]?
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildsox="Build sox: "
) else set buildsox=%soxBINI%
if "%buildsox%"=="" GOTO sox
if %buildsox%==1 set "sox=y"
if %buildsox%==2 set "sox=n"
if %buildsox% GTR 2 GOTO sox
if %deleteINI%==1 echo.soxB=^%buildsox%>>%ini%
:ffmpeg
if [0]==[%ffmpegB2INI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build FFmpeg binaries and libraries:
echo. 1 = Yes [static] [recommended]
echo. 2 = No
echo. 3 = Shared
echo. 4 = Both static and shared [shared goes to an isolated directory]
echo. 5 = Shared-only with some shared dependencies (libass, freetype and fribidi^)
echo. 6 = Same as 4, but static compilation ignores shared dependencies
echo.
echo. Note: Option 5 differs from 3 in that libass, freetype and fribidi are
echo. compiled shared so they take less space. Currently broken if libass or libass
echo. dependees are enabled.
echo. Option 6 produces static and shared ffmpeg and ffmpeg libs where the static
echo. one includes only strictly static dependencies (opencl, opengl, cuda-nvcc,
echo. libnpp, libopenh264 are hard disabled.^)
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildffmpeg="Build FFmpeg: "
) else set buildffmpeg=%ffmpegB2INI%
if "%buildffmpeg%"=="" GOTO ffmpeg
if %buildffmpeg%==1 set "ffmpeg=static"
if %buildffmpeg%==2 set "ffmpeg=no"
if %buildffmpeg%==3 set "ffmpeg=shared"
if %buildffmpeg%==4 set "ffmpeg=both"
if %buildffmpeg%==5 set "ffmpeg=sharedlibs"
if %buildffmpeg%==6 set "ffmpeg=bothstatic"
if %buildffmpeg% GTR 6 GOTO ffmpeg
if %deleteINI%==1 echo.ffmpegB2=^%buildffmpeg%>>%ini%
set defaultFFmpegPath=https://git.ffmpeg.org/ffmpeg.git
:ffmpegPath
if [0]==[%ffmpegPathINI%] (
set ffmpegPath=%defaultFFmpegPath%
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Using default ffmpeg source path: https://git.ffmpeg.org/ffmpeg.git
echo.
echo. If you want to use a custom source repository, add a line like this
echo. to media-autobuild_suite.ini:
echo.
echo. ffmpegPath=https://github.com/username/FFmpeg.git#branch=branchname
echo.
echo. or for a local repository like:
echo.
echo. ffmpegPath=../myrepos/ffmpeg
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
) else set ffmpegPath=%ffmpegPathINI%
if %deleteINI%==1 echo.ffmpegPath=%ffmpegPath%>>%ini%
rem Handle relative paths and convert to absolute path
rem after sanitizing: back- to forward-slashes, remove colon after drive letter
call :resolvePath %ffmpegPath%
setlocal EnableDelayedExpansion
if exist %resolvePath% (
set nixdir=!resolvePath:\=/!
set "ffmpegPath=/!nixdir::=!"
)
endlocal & set "ffmpegPath=%ffmpegPath%"
if not [%defaultFFmpegPath%]==[%ffmpegPath%] (
echo -------------------------------------------------------------------------------
echo.
echo. Using ffmpeg path: %ffmpegPath%
echo.
echo -------------------------------------------------------------------------------
)
:ffmpegUp
if [0]==[%ffmpegUpdateINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Always build FFmpeg when libraries have been updated?
echo. 1 = Yes
echo. 2 = No
echo. 3 = Only build FFmpeg/mpv and missing dependencies
echo.
echo. FFmpeg is updated a lot so you only need to select this if you
echo. absolutely need updated external libraries in FFmpeg.
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildffmpegUp="Build ffmpeg if lib is new: "
) else set buildffmpegUp=%ffmpegUpdateINI%
if "%buildffmpegUp%"=="" GOTO ffmpegUp
if %buildffmpegUp%==1 set "ffmpegUpdate=y"
if %buildffmpegUp%==2 set "ffmpegUpdate=n"
if %buildffmpegUp%==3 set "ffmpegUpdate=onlyFFmpeg"
if %buildffmpegUp% GTR 3 GOTO ffmpegUp
if %deleteINI%==1 echo.ffmpegUpdate=^%buildffmpegUp%>>%ini%
:ffmpegChoice
if [0]==[%ffmpegChoiceINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Choose ffmpeg and mpv optional libraries?
echo. 1 = Yes
echo. 2 = No (Light build^)
echo. 3 = No (Mimic Zeranoe^)
echo. 4 = No (All available external libs^)
echo.
echo. Avoid the last two unless you really want useless libraries you'll never use.
echo. Just because you can include a shitty codec no one uses doesn't mean you should.
echo.
echo. If you select yes, we will create files with the default options
echo. we use with FFmpeg and mpv. You can remove any that you don't need or prefix
echo. them with #
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildffmpegChoice="Choose ffmpeg and mpv optional libs: "
) else set buildffmpegChoice=%ffmpegChoiceINI%
if "%buildffmpegChoice%"=="" GOTO ffmpegChoice
if %buildffmpegChoice%==1 (
set "ffmpegChoice=y"
if not exist %build%\ffmpeg_options.txt (
(
echo.# Lines starting with this character are ignored
echo.# To override some options specifically for the shared build, create a ffmpeg_options_shared.txt file.
echo.
echo.# Basic built-in options, can be removed if you delete "--disable-autodetect"
call :writeOption %ffmpeg_options_builtin%
echo.
echo.# Common options
call :writeOption %ffmpeg_options_basic%
echo.
echo.# Zeranoe
call :writeOption %ffmpeg_options_zeranoe%
echo.
echo.# Full
call :writeOption %ffmpeg_options_full%
echo.
echo.# Full plus options that add shared dependencies
call :writeOption %ffmpeg_options_full_shared%
)>%build%\ffmpeg_options.txt
echo -------------------------------------------------------------------------------
echo. File with default FFmpeg options has been created in
echo. %build%\ffmpeg_options.txt
echo.
echo. Edit it now or leave it unedited to compile according to defaults.
echo -------------------------------------------------------------------------------
pause
)
if not exist %build%\mpv_options.txt (
(
echo.# Lines starting with this character are ignored
echo.
echo.# Built-in options, use --disable- to disable them
call :writeOption %mpv_options_builtin%
echo.
echo.# Common options or overriden defaults
call :writeOption %mpv_options_basic%
echo.
echo.# Full
call :writeOption %mpv_options_full%
)>%build%\mpv_options.txt
echo -------------------------------------------------------------------------------
echo. File with default mpv options has been created in
echo. %build%\mpv_options.txt
echo.
echo. Edit it now or leave it unedited to compile according to defaults.
echo -------------------------------------------------------------------------------
pause
)
)
if %buildffmpegChoice%==2 set "ffmpegChoice=n"
if %buildffmpegChoice%==3 set "ffmpegChoice=z"
if %buildffmpegChoice%==4 set "ffmpegChoice=f"
if %buildffmpegChoice% GTR 4 GOTO ffmpegChoice
if %deleteINI%==1 echo.ffmpegChoice=^%buildffmpegChoice%>>%ini%
:mp4boxStatic
if [0]==[%mp4boxINI%] (
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
echo.
echo. Build static mp4box [mp4 muxer/toolbox] binary?
echo. 1 = Yes
echo. 2 = No
echo.
echo -------------------------------------------------------------------------------
echo -------------------------------------------------------------------------------
set /P buildMp4box="Build mp4box: "
) else set buildMp4box=%mp4boxINI%
if "%buildMp4box%"=="" GOTO mp4boxStatic
if %buildMp4box%==1 set "mp4box=y"
if %buildMp4box%==2 set "mp4box=n"
if %buildMp4box% GTR 2 GOTO mp4boxStatic
if %deleteINI%==1 echo.mp4box=^%buildMp4box%>>%ini%