Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg + libbluray broken #2627

Open
Selur opened this issue Mar 31, 2024 · 7 comments
Open

ffmpeg + libbluray broken #2627

Selur opened this issue Mar 31, 2024 · 7 comments

Comments

@Selur
Copy link

Selur commented Mar 31, 2024

Using ffmpeg from gyanet, calling:

ffmpeg.exe -loglevel debug -i "bluray:G:\TestClips&Co\discs\Blu-ray\x264 BR-Demo"

works properly, returning:

ffmpeg version 6.1.1-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as output url with argument 'bluray:G:\TestClips&Co\discs\Blu-ray\x264 BR-Demo'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url bluray:G:\TestClips&Co\discs\Blu-ray\x264 BR-Demo.
Successfully parsed a group of options.
Opening an input file: bluray:G:\TestClips&Co\discs\Blu-ray\x264 BR-Demo.
[AVFormatContext @ 000001f5d4e4b180] Opening 'bluray:G:\TestClips&Co\discs\Blu-ray\x264 BR-Demo' for reading
[bluray @ 000001f5d4e61780] No default whitelist set
[bluray @ 000001f5d4e61780] 3 usable playlists:
[bluray @ 000001f5d4e61780] playlist 00000.mpls (0:09:56)
[bluray @ 000001f5d4e61780] playlist 00002.mpls (0:10:53)
[bluray @ 000001f5d4e61780] playlist 00003.mpls (0:05:35)
[bluray @ 000001f5d4e61780] selected 00002.mpls
[mpegts @ 000001f5d4e4b180] Format mpegts probed with size=2048 and score=50
[mpegts @ 000001f5d4e4b180] stream=0 stream_type=1b pid=1011 prog_reg_desc=HDMV
[mpegts @ 000001f5d4e4b180] stream=1 stream_type=86 pid=1100 prog_reg_desc=HDMV
[mpegts @ 000001f5d4e4b180] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:2
For transform of length 32, inverse, mdct_float, flags: [aligned, out_of_place], found 3 matches:
    1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], factors[2]: [2, any], flags: [aligned, out_of_place, inv_only], prio: 511
    2: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: 96
    3: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: -130976
For transform of length 16, inverse, fft_float, flags: [aligned, inplace, preshuf, asm_call], found 2 matches:
    1: fft16_asm_float_fma3 - type: fft_float, len: 16, factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], prio: 512
    2: fft16_asm_float_avx - type: fft_float, len: 16, factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], prio: 480
Transform tree:
    mdct_inv_float_avx2 - type: mdct_float, len: 32, factors[2]: [2, any], flags: [aligned, out_of_place, inv_only]
        fft16_asm_float_fma3 - type: fft_float, len: 16, factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call]
For transform of length 64, inverse, mdct_float, flags: [aligned, out_of_place], found 3 matches:
    1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], factors[2]: [2, any], flags: [aligned, out_of_place, inv_only], prio: 511
    2: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: 96
    3: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: -130976
For transform of length 32, inverse, fft_float, flags: [aligned, inplace, preshuf, asm_call], found 2 matches:
    1: fft32_asm_float_fma3 - type: fft_float, len: 32, factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], prio: 512
    2: fft32_asm_float_avx - type: fft_float, len: 32, factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], prio: 480
Transform tree:
    mdct_inv_float_avx2 - type: mdct_float, len: 64, factors[2]: [2, any], flags: [aligned, out_of_place, inv_only]
        fft32_asm_float_fma3 - type: fft_float, len: 32, factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call]
[h264 @ 000001f5d4e6ef00] Decoding VUI
[extract_extradata @ 000001f5d4e33180] nal_unit_type: 9(AUD), nal_ref_idc: 0
[extract_extradata @ 000001f5d4e33180] nal_unit_type: 7(SPS), nal_ref_idc: 3
[extract_extradata @ 000001f5d4e33180] nal_unit_type: 8(PPS), nal_ref_idc: 3
[extract_extradata @ 000001f5d4e33180] nal_unit_type: 6(SEI), nal_ref_idc: 0
    Last message repeated 2 times
[extract_extradata @ 000001f5d4e33180] nal_unit_type: 5(IDR), nal_ref_idc: 3
    Last message repeated 3 times
[h264 @ 000001f5d4e6ef00] nal_unit_type: 9(AUD), nal_ref_idc: 0
[h264 @ 000001f5d4e6ef00] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 000001f5d4e6ef00] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 000001f5d4e6ef00] nal_unit_type: 6(SEI), nal_ref_idc: 0
    Last message repeated 2 times
[h264 @ 000001f5d4e6ef00] nal_unit_type: 5(IDR), nal_ref_idc: 3
    Last message repeated 3 times
[h264 @ 000001f5d4e6ef00] Decoding VUI
[h264 @ 000001f5d4e6ef00] Format yuv420p chosen by get_format().
[h264 @ 000001f5d4e6ef00] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 000001f5d4e6ef00] no picture
[h264 @ 000001f5d4e6ef00] Decoding VUI
    Last message repeated 1 times
[mpegts @ 000001f5d4e4b180] Probe buffer size limit of 5000000 bytes reached
../src/libbluray/bluray.c:299: 00003.m2ts: no timestamp for SPN 0 (got 0). clip 27000000-56420625.
[mpegts @ 000001f5d4e4b180] After avformat_find_stream_info() pos: 0 bytes read:6832768 seeks:2 frames:420
Input #0, mpegts, from 'bluray:G:\TestClips&Co\discs\Blu-ray\x264 BR-Demo':
  Duration: 00:10:53.79, start: 600.000000, bitrate: 11392 kb/s
  Program 1
  Stream #0:0[0x1011], 98, 1/90000: Video: h264 (High), 1 reference frame (HDMV / 0x564D4448), yuv420p(tv, bt709, progressive, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 0/1, 24 fps, 24 tbr, 90k tbn
  Stream #0:1[0x1100], 322, 1/90000: Audio: dts (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, 5.1(side), s16p
Successfully opened the file.
Correcting start time of Input #0 by 9223372036254775807 us.
At least one output file must be specified
[AVIOContext @ 000001f5d4e6b480] Statistics: 6832768 bytes read, 2 seeks

the call properly.
Using ffmpeg build with MBAS, fails:

f:\media-autobuild_suite\local64\bin-video>ffmpeg.exe -loglevel debug -i "bluray:G:\TestClips&Co\discs\Blu-ray\x264 BR-Demo"
ffmpeg version N-114546-g720b532afd-g199c479b9a+1 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 13.2.0 (Rev5, 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 --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 --disable-doc --enable-gmp --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libdav1d --enable-libaom --disable-debug --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-libsvtav1 --enable-gnutls --extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++ --extra-cflags=-DLIBXML_STATIC --extra-libs=-liconv --disable-w32threads
  libavutil      59. 10.100 / 59. 10.100
  libavcodec     61.  4.100 / 61.  4.100
  libavformat    61.  2.100 / 61.  2.100
  libavdevice    61.  2.100 / 61.  2.100
  libavfilter    10.  2.100 / 10.  2.100
  libswscale      8.  2.100 /  8.  2.100
  libswresample   5.  2.100 /  5.  2.100
  libpostproc    58.  2.100 / 58.  2.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as input url with argument 'bluray:G:\TestClips&Co\discs\Blu-ray\x264 BR-Demo'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url bluray:G:\TestClips&Co\discs\Blu-ray\x264 BR-Demo.
Successfully parsed a group of options.
Opening an input file: bluray:G:\TestClips&Co\discs\Blu-ray\x264 BR-Demo.
[AVFormatContext @ 0000023b9e47e1c0] Opening 'bluray:G:\TestClips&Co\discs\Blu-ray\x264 BR-Demo' for reading
[bluray @ 0000023b9e47e840] No default whitelist set

=> no clue what 'No default whitelist set' really means, but seems like it has to be set when building ffmpeg with libbluray.
(I doubt this is related to using a different gcc version than gyanet)

In canse it helps, link to x264 BR-Demo and my ffmpeg_options.txt file.

Would be nice if this could be fixed.
Thanks!

Cu Selur

@L4cache
Copy link

L4cache commented Apr 1, 2024

The message "No default whitelist set" is present in works properly sample as well.
So what actually happened is more than that, I did very simple (skill issues) debug by opening crash dump with windbg and found some thing related to INVALID_POINTER_READ_c0000005 or gme_open_data, but generally I don't know what I'm doing.

And your properly working build is release build which is released 2023-12-31, I checked my old build by m-ab-s around that time and... it works as well. When testing gyan's 2024-03-28 git build which is currently the latest, it crashes as well.
The problem is more likely in the library(ies) and its(their) integration with ffmpeg.

Possibly related?: shinchiro/mpv-winbuild-cmake#633

@Selur
Copy link
Author

Selur commented Apr 1, 2024

Possibly related?: shinchiro/mpv-winbuild-cmake#633

I don't think so, linking does work (also adding '-Wl,--allow-multiple-definition' doesn't help)
Thanks for looking into it. (Happy to know that this is not something just on my setup,)

@L4cache
Copy link

L4cache commented Apr 1, 2024

I found the crashes start to appear around the time that ffmpeg commit happens.
I'm trying to apply the fix there (commit 6a9eefd) to somewhere in the suite to see if it helps.

@L4cache
Copy link

L4cache commented Apr 1, 2024

This helps.

diff --git a/build/media-suite_compile.sh b/build/media-suite_compile.sh
index 94adc16c..4ed37e16 100644
--- a/build/media-suite_compile.sh
+++ b/build/media-suite_compile.sh
@@ -1327,7 +1327,7 @@ if { { [[ $ffmpeg != no ]] && enabled libbluray; } || ! mpv_disabled libbluray;
     else
         extracommands+=(--without-libxml2)
     fi
-    CFLAGS+=" $(enabled libxml2 && echo "-DLIBXML_STATIC")" \
+    CFLAGS+=" -Ddec_init=libbluray_dec_init $(enabled libxml2 && echo "-DLIBXML_STATIC")" \
         do_separate_confmakeinstall --disable-{examples,doxygen-doc} \
         --without-{fontconfig,freetype} "${extracommands[@]}"
     do_checkIfExist

@Selur
Copy link
Author

Selur commented Apr 1, 2024

I applied the change, deleted my ffmpeg-git folder and ran the script.
Sadly, that didn't fix the problem.

@Selur
Copy link
Author

Selur commented Apr 1, 2024

Deleting ffmpeg-git and libbluray-git and then running the script seems to do the job. :)
hopefully this fix can be added to the script permanently.

@L4cache
Copy link

L4cache commented Apr 1, 2024

Or wait a library that haven't been updated for a long time to update, why I have some kind of deja vu here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants