m-ab-s / media-autobuild_suite

This Windows Batchscript helps setup a Mingw-w64 compiler environment for building ffmpeg and other media tools under Windows.
GNU General Public License v3.0
1.49k stars 257 forks source link

VapourSynth: R63 seems to be the last release for Win32; and it even fails #2592

Closed LigH-de closed 4 months ago

LigH-de commented 5 months ago
Error 404 while downloading https://github.com/vapoursynth/vapoursynth/releases/download/R65/VapourSynth32-Portable-R65.7z

No more Win32 release after R63.

So may VapourSynth support in ffmpeg have to be disabled for the 32 bit branch? Or would it still work with R63?

You seem to prefer abandoning the whole Win32 compilation for every tool anyway...

1480c1 commented 5 months ago

I presume the wrapper would work with r63, so should be easy enough to do something like if [[ $bits == 32bit ]]; then _vsver=r63... or something and limit 32-bit to r63. I do not know what is the latest python that 32-bit supports, though, do you?

hydra3333 commented 5 months ago

I looked at the vapoursynth git and release R62 notes say

updated the supported python versions to 3.11

so R63 would be 3.11.7 I checked python.org and 3.11.7 has 32 bit download.

cheers

1480c1 commented 5 months ago

@LigH-de can you try https://github.com/1480c1/media-autobuild_suite/tree/vp32 and see if you can make sure the vapoursynth works there? I'm fine with “pinning” projects for 32-bit to their last known version as long as we know it works at that version.

In the future, I may see about making it work better, instead of just hard-coding if [[ $bits = 32bit ]]; then .. else ... fi

LigH-de commented 5 months ago

Yes, vp32 branch downloads R63; ffmpeg got compiled. To check if it actually works, I hope @Selur can check that quickly or give me some advice about the prerequisites...

Selur commented 5 months ago

I never really used Vapoursynth 32bit, so can't advice on it. In Hybrid, only 32bit tools are:

hydra3333 commented 5 months ago

give me some advice about the prerequisites...

IIRC, without using installers (everything portable): extract portable (embedded) python 3.11.7 32bit into a folder extract vapoursynth R63 (portable) 32bit into the same folder pop the new ffmpeg 32bit into the same folder install any filters (eg using vsrepo) and dgsource/dgindex if you use that run ffmpeg with -f vapoursynth -i "input_script.vpy" ...

here's an example from a test script I just used. "C:\SOFTWARE\Vapoursynth-x64\ffmpeg_OpenCL.exe" -hide_banner -v verbose -nostats -f vapoursynth -i "D:\VRDTVSP-SCRATCH\%TS_SOURCE%.QSF.vpy" -probesize 200M -analyzeduration 200M -i "D:\VRDTVSP-SCRATCH\%TS_SOURCE%.QSF.mp4" -map 0:v:0 -map 1:a:0 -vf "setdar=16/9" -fps_mode passthrough -sws_flags lanczos+accurate_rnd+full_chroma_int+full_chroma_inp -strict experimental -c:v h264_nvenc -pix_fmt nv12 -preset p7 -multipass fullres -forced-idr 1 -g 25 -coder:v cabac -spatial-aq 1 -temporal-aq 1 -dpb_size 0 -bf:v 3 -b_ref_mode:v 0 -rc:v vbr -cq:v 0 -b:v 2656208 -minrate:v 505944 -maxrate:v 5312416 -bufsize 5312416 -profile:v high -level 5.2 -movflags +faststart+write_colr -c:a libfdk_aac -cutoff 18000 -ab 256k -ar 48000 -y "%TEST_RESULT_DIR%%TS_SOURCE%.mp4"

.vpy script from the calling test.bat

ECHO !DATE! !TIME!
SET "_VPY_file=D:\VRDTVSP-SCRATCH\%TS_SOURCE%.QSF.vpy"
ECHO import vapoursynth as vs       # this allows use of constants eg vs.YUV420P8 >> "!_VPY_file!" 2>&1
ECHO from vapoursynth import core   # actual vapoursynth core >> "!_VPY_file!" 2>&1
ECHO #import functool >> "!_VPY_file!" 2>&1
ECHO #import mvsfunc as mvs         # this relies on the .py residing at the VS folder root level - see run_vsrepo.bat >> "!_VPY_file!" 2>&1
ECHO #import havsfunc as haf        # this relies on the .py residing at the VS folder root level - see run_vsrepo.bat >> "!_VPY_file!" 2>&1
ECHO core.std.LoadPlugin^(r'C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGDecodeNV.dll'^) # do it like gonca https://forum.doom9.org/showthread.php?p=1877765#post1877765 >> "!_VPY_file!" 2>&1
ECHO core.avs.LoadPlugin^(r'C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGDecodeNV.dll'^) # do it like gonca https://forum.doom9.org/showthread.php?p=1877765#post1877765 >> "!_VPY_file!" 2>&1
ECHO # NOTE: deinterlace=1, use_top_field=True for "Interlaced"/"TFF" "AVC"/"MPA1L2" >> "!_VPY_file!" 2>&1
ECHO video = core.dgdecodenv.DGSource^(r'D:\VRDTVSP-SCRATCH\%TS_SOURCE%.QSF.dgi', deinterlace=1, use_top_field=True, use_pf=False^) >> "!_VPY_file!" 2>&1
ECHO # DGDecNV changes - >> "!_VPY_file!" 2>&1
ECHO # 2020.10.21 Added new parameters cstrength and cblend to independently control the chroma denoising. >> "!_VPY_file!" 2>&1
ECHO # 2020.11.07 Revised DGDenoise parameters. The 'chroma' option is removed. >> "!_VPY_file!" 2>&1
ECHO #            Now, if 'strength' is set to 0.0 then luma denoising is disabled, >> "!_VPY_file!" 2>&1
ECHO #            and if cstrength is set to 0.0 then chroma denoising is disabled. >> "!_VPY_file!" 2>&1
ECHO #            'cstrength' is now defaulted to 0.0, and 'searchw' is defaulted to 9. >> "!_VPY_file!" 2>&1
ECHO # example: video = core.avs.DGDenoise^(video, strength=0.06, cstrength=0.06^) # replaced chroma=True >> "!_VPY_file!" 2>&1
ECHO # example: video = core.avs.DGSharpen^(video, strength=0.3^) >> "!_VPY_file!" 2>&1
ECHO video = core.avs.DGSharpen^(video, strength=0.2^) >> "!_VPY_file!" 2>&1
ECHO #video = vs.core.text.ClipInfo^(video^) >> "!_VPY_file!" 2>&1
ECHO video.set_output^(^) >> "!_VPY_file!" 2>&1
ECHO ---------------------------- 2>&1
TYPE "!_VPY_file!" 2>&1
ECHO ---------------------------- 2>&1

Feel free to ignore this post.

LigH-de commented 5 months ago

I tested the freshly built ffmpeg with the following script:

version.vpy

import vapoursynth as vs
core = vs.core
clip = core.std.BlankClip(format=vs.RGB24, color=[0, 0, 0])
c = core.text.CoreInfo(clip)
c.set_output()

VapourSynth recognises it: VSPipe.exe --info version.vpy

Width: 640
Height: 480
Frames: 240
FPS: 24/1 (24.000 fps)
Format Name: RGB24
Color Family: RGB
Alpha: No
Sample Type: Integer
Bits: 8
SubSampling W: 0
SubSampling H: 0

Apparently, ffmpeg accepts it. But it prints only its configuration, then quits. Same for ffprobe and ffplay. ffplay.exe -f vapoursynth version.vpy

ffplay version N-113440-gd4a43de233-gd52e8ed114+3 Copyright (c) 2003-2024 the FFmpeg developers
  built with gcc 13.2.0 (Rev3, Built by MSYS2 project)
  configuration:  --pkg-config=pkgconf --cc='ccache gcc' --cxx='ccache g++' --ld='ccache g++' --extra-cxxflags=-fpermissive --extra-cflags=-Wno-int-conversion --disable-autodetect --disable-doc --enable-amf --enable-bzlib --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-iconv --enable-lzma --enable-nvenc --enable-zlib --enable-sdl2 --enable-ffnvcodec --enable-nvdec --enable-cuda-llvm --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libdav1d --enable-libaom --disable-debug --enable-libfdk-aac --enable-fontconfig --enable-libass --enable-libbluray --enable-libfreetype --enable-libmfx --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libshine --enable-gpl --enable-avisynth --enable-libxvid --enable-libopenmpt --enable-version3 --enable-librav1e --enable-libsrt --enable-libgsm --enable-libvmaf --enable-chromaprint --enable-decklink --enable-frei0r --enable-libaribb24 --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfribidi --enable-libgme --enable-libilbc --enable-libkvazaar --enable-libmodplug --enable-librtmp --enable-librubberband --enable-libtesseract --enable-libxavs --enable-libzmq --enable-libzvbi --enable-openal --enable-libcodec2 --enable-ladspa --enable-vapoursynth --enable-liblensfun --enable-libglslang --enable-vulkan --enable-libuavs3d --enable-libplacebo --enable-libjxl --enable-opencl --enable-opengl --enable-libopenh264 --enable-openssl --extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++ --extra-cflags=-DCACA_STATIC --extra-cflags=-DMODPLUG_STATIC --extra-cflags=-DCHROMAPRINT_NODLL --extra-libs=-lstdc++ --extra-cflags=-DZMQ_STATIC --extra-libs=-lpsapi --extra-cflags=-DLIBXML_STATIC --extra-libs=-liconv --disable-w32threads --extra-cflags=-DKVZ_STATIC_LIB --enable-nonfree --extra-cflags=-DAL_LIBTYPE_STATIC --extra-cflags='-IG:/MABS/local32/include' --extra-cflags='-IG:/MABS/local32/include/AL'
  libavutil      58. 36.101 / 58. 36.101
  libavcodec     60. 38.100 / 60. 38.100
  libavformat    60. 20.100 / 60. 20.100
  libavdevice    60.  4.100 / 60.  4.100
  libavfilter     9. 17.100 /  9. 17.100
  libswscale      7.  6.100 /  7.  6.100
  libswresample   4. 13.100 /  4. 13.100
  libpostproc    57.  4.100 / 57.  4.100
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   
hydra3333 commented 5 months ago

Interestingly, 64bit (current release) seemed to work for me. I'll go back and try R63 later today if you like ?

import vapoursynth as vs
core = vs.core
from vapoursynth import core    # actual vapoursynth core
clip = core.std.BlankClip(format=vs.RGB24, color=[0, 0, 0])
c = core.text.CoreInfo(clip)
c.set_output()
"C:\SOFTWARE\Vapoursynth-x64\VSPipe.exe" --info "!_VPY_file!"
Width: 640
Height: 480
Frames: 240
FPS: 24/1 (24.000 fps)
Format Name: RGB24
Color Family: RGB
Alpha: No
Sample Type: Integer
Bits: 8
SubSampling W: 0
SubSampling H: 0
"C:\SOFTWARE\Vapoursynth-x64\ffmpeg_OpenCL.exe" -hide_banner -v verbose -nostats -f vapoursynth -i "!_VPY_file!" -probesize 200M -analyzeduration 200M -vf "setdar=16/9" -fps_mode passthrough -sws_flags lanczos+accurate_rnd+full_chroma_int+full_chroma_inp -strict experimental -c:v h264_nvenc -pix_fmt nv12 -preset p7 -multipass fullres -forced-idr 1 -g 25 -coder:v cabac -spatial-aq 1 -temporal-aq 1 -dpb_size 0 -bf:v 3 -b_ref_mode:v 0 -rc:v vbr -cq:v 0 -b:v 3000000 -minrate:v 500000 -maxrate:v 6000000 -bufsize 6000000 -profile:v high -level 5.2 -movflags +faststart+write_colr -an  -y "G:\HDTV\000-TO-BE-PROCESSED\TEST_RESULT\TEST_blankclip.mp4"
Routing option strict to both codec and muxer layer
[vapoursynth @ 0000019f0b434c40] VS format RGB24 -> pixfmt gbrp
Input #0, vapoursynth, from 'D:\VRDTVSP-SCRATCH\TEST_blankclip.vpy':
  Duration: 00:00:10.00, start: 0.000000, bitrate: 0 kb/s
  Stream #0:0: Video: wrapped_avframe, 1 reference frame, gbrp, 640x480, 24 tbr, 24 tbn
[out#0/mp4 @ 0000019f0b434680] No explicit maps, mapping streams automatically...
[vost#0:0/h264_nvenc @ 0000019f0b4dd200] Created video stream from input stream 0:0
Stream mapping:
  Stream #0:0 -> #0:0 (wrapped_avframe (native) -> h264 (h264_nvenc))
[vost#0:0/h264_nvenc @ 0000019f0b4dd200] Starting thread...
[vf#0:0 @ 0000019f0b4f9900] Starting thread...
[vist#0:0/wrapped_avframe @ 0000019f0b4db0c0] Starting thread...
[in#0/vapoursynth @ 0000019f0b434880] Starting thread...
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0000019f0e68ab00] w:640 h:480 pixfmt:gbrp tb:1/24 fr:24/1 sar:0/1 csp:unknown range:unknown
[auto_scale_0 @ 0000019f0e68b900] w:iw h:ih flags:'' interl:0
[format @ 0000019f0e68bd00] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_setdar_0' and the filter 'format'
[Parsed_setdar_0 @ 0000019f0e68b700] w:640 h:480 dar:4/3 sar:0/1 -> dar:16/9 sar:4/3
[auto_scale_0 @ 0000019f0e68b900] w:640 h:480 fmt:gbrp csp:gbr range:pc sar:4/3 -> w:640 h:480 fmt:nv12 csp:unknown range:unknown sar:4/3 flags:0x00046200
    Last message repeated 2 times
[auto_scale_0 @ 0000019f0e68b900] w:640 h:480 fmt:gbrp csp:unknown range:unknown sar:4/3 -> w:640 h:480 fmt:nv12 csp:unknown range:unknown sar:4/3 flags:0x00046200
[h264_nvenc @ 0000019f0b4de5c0] Loaded Nvenc version 12.1
[h264_nvenc @ 0000019f0b4de5c0] Nvenc initialized successfully
[h264_nvenc @ 0000019f0b4de5c0] 1 CUDA capable devices found
[h264_nvenc @ 0000019f0b4de5c0] [ GPU #0 - < NVIDIA GeForce RTX 2060 SUPER > has Compute SM 7.5 ]
[h264_nvenc @ 0000019f0b4de5c0] supports NVENC
[h264_nvenc @ 0000019f0b4de5c0] AQ enabled.
[h264_nvenc @ 0000019f0b4de5c0] Temporal AQ enabled.
[h264_nvenc @ 0000019f0b4de5c0] Lookahead enabled: depth 28, scenecut enabled, B-adapt enabled.
Output #0, mp4, to 'G:\HDTV\000-TO-BE-PROCESSED\TEST_RESULT\TEST_blankclip.mp4':
  Metadata:
    encoder         : Lavf60.20.100
  Stream #0:0: Video: h264 (High), 1 reference frame (avc1 / 0x31637661), nv12(progressive), 640x480 (0x0) [SAR 4:3 DAR 16:9], q=2-31, 3000 kb/s, 24 fps, 12288 tbn
      Metadata:
        encoder         : Lavc60.38.100 h264_nvenc
      Side data:
        cpb: bitrate max/min/avg: 6000000/0/3000000 buffer size: 6000000 vbv_delay: N/A
[out#0/mp4 @ 0000019f0b434680] Starting thread...
[in#0/vapoursynth @ 0000019f0b434880] EOF while reading input
[in#0/vapoursynth @ 0000019f0b434880] Terminating thread with return code 0 (success)
[vist#0:0/wrapped_avframe @ 0000019f0b4db0c0] Decoder thread received EOF packet
[vist#0:0/wrapped_avframe @ 0000019f0b4db0c0] Decoder returned EOF, finishing
[vist#0:0/wrapped_avframe @ 0000019f0b4db0c0] Terminating thread with return code 0 (success)
[vf#0:0 @ 0000019f0b4f9900] Filtergraph returned EOF, finishing
[vf#0:0 @ 0000019f0b4f9900] All consumers returned EOF
[vost#0:0/h264_nvenc @ 0000019f0b4dd200] Encoder thread received EOF
[vf#0:0 @ 0000019f0b4f9900] Terminating thread with return code 0 (success)
[vost#0:0/h264_nvenc @ 0000019f0b4dd200] Terminating thread with return code 0 (success)
[out#0/mp4 @ 0000019f0b434680] All streams finished
[out#0/mp4 @ 0000019f0b434680] Terminating thread with return code 0 (success)
[mp4 @ 0000019f0b4dc600] Starting second pass: moving the moov atom to the beginning of the file
no ICC profile found, will write nclx/nclc colour info instead
    Last message repeated 1 times
[AVIOContext @ 0000019f0e6f7b80] Statistics: 219952 bytes read, 0 seeks
no ICC profile found, will write nclx/nclc colour info instead
[AVIOContext @ 0000019f0b4fec40] Statistics: 443649 bytes written, 4 seeks, 5 writeouts
[out#0/mp4 @ 0000019f0b434680] Output file #0 (G:\HDTV\000-TO-BE-PROCESSED\TEST_RESULT\TEST_blankclip.mp4):
[out#0/mp4 @ 0000019f0b434680]   Output stream #0:0 (video): 240 frames encoded; 240 packets muxed (219904 bytes);
[out#0/mp4 @ 0000019f0b434680]   Total: 240 packets (219904 bytes) muxed
[out#0/mp4 @ 0000019f0b434680] video:215kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.737576%
frame=  240 fps=0.0 q=10.0 Lsize=     218kB time=00:00:09.87 bitrate= 181.2kbits/s speed=19.2x
[h264_nvenc @ 0000019f0b4de5c0] Nvenc unloaded
[in#0/vapoursynth @ 0000019f0b434880] Input file #0 (D:\VRDTVSP-SCRATCH\TEST_blankclip.vpy):
[in#0/vapoursynth @ 0000019f0b434880]   Input stream #0:0 (video): 240 packets read (115200 bytes); 240 frames decoded; 0 decode errors;
[in#0/vapoursynth @ 0000019f0b434880]   Total: 240 packets (115200 bytes) demuxed
[AVIOContext @ 0000019f0b43d9c0] Statistics: 211 bytes read, 0 seeks
1480c1 commented 5 months ago

@LigH-de So, R63+3.11.7 doesn't work? Do you know of an older combination that does work?

LigH-de commented 5 months ago

I never really used it before, only noticed that building started failing. And then noticed that the Win32 build does not even really work. The way how it does not respond is interesting, though, and I neither know how to debug it nor who to contact about it with sufficient competence regarding communication between ffmpeg's modules.

If I can simply try it by unpacking different Python and VapourSynth portable archives to the same ffmpeg exe, I can test some. But if I would have to compile the ffmpeg matching to each of these combinations, I would not have the time and will...

I hoped that Selur may have preferred using ffmpeg with direct VapourSynth support inside Hybrid. Another hope may be StaxRip maintainers. But if they all relied on piping, they will not know either.

1480c1 commented 5 months ago

Some news, attempting the same thing you did before results in ffplay segfaulting in read_header_vs() in vapoursynth.c, specifically

    if (!vsscript_init()) {

unfortunately, I do not know enough about vapoursynth to be able to figure out anything further.

LigH-de commented 5 months ago

In the doom9 forum, @Selur wrote:

Older Vapoursynth doesn't work with Python 3.11, try Python 3.8 instead.

So I tried unpacking python-3.8.0-embed-win32 and VapourSynth32-Portable-R63 into one directory with ffmpeg; unfortunately, the same result: No output after the version string.

Does the compilation process of ffmpeg with native VapourSynth input support depend on the Python and VapourSynth libraries and headers versions present during the compilation?

PS: Python 3.8.10 seems to be the last v3.8 release with embeddable Win32 binaries. But no output either.

Selur commented 5 months ago

I think something is amiss with the Vapoursynth 32bit portable, since creating a directory, extracting python-3.8.0-embed-win32.zip and then VapourSynth32-Portable-R63.7z into it should at least give an output for 'VSPipe.exe --version', but that already shows 'Failed to initialize VSScript' (doesn't work with R62-54 either) With R54, just calling VSPipe.exe shows the help of VSPipe, but VSPipe.exe --version fails too. => this seems broken to me

LigH-de commented 5 months ago

So it seems it has been broken for a long time already. But nobody used it in 32 bit so nobody noticed that.

Limiting the building of VapourSynth enabled ffmpeg to 64 bit may not hurt anyone then...

Selur commented 5 months ago

Limiting the building of VapourSynth enabled ffmpeg to 64 bit may not hurt anyone then...

True. :)

1480c1 commented 5 months ago

So, the consensus would be to just disable vapoursynth for 32-bit? At least until someone is able to figure out the last working version?

1480c1 commented 4 months ago

New commit changes the output to image for 32-bit