`ZeroDivisionError` when inspecting HDR metadata from source file
Closed this issue · 2 comments
noelleleigh commented
FastFlix Version: 5.8.1
FFmpeg details:
> ffprobe
ffprobe version 2024-09-12-git-504c1ffcd8-full_build-www.gyan.dev Copyright (c) 2007-2024 the FFmpeg developers
built with gcc 13.2.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --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-libopenjpeg --enable-libquirc --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-libqrencode --enable-librav1e --enable-libsvtav1 --enable-libvvenc --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --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-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --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-liblc3 --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 59. 36.100 / 59. 36.100
libavcodec 61. 13.100 / 61. 13.100
libavformat 61. 5.101 / 61. 5.101
libavdevice 61. 2.101 / 61. 2.101
libavfilter 10. 2.102 / 10. 2.102
libswscale 8. 2.100 / 8. 2.100
libswresample 5. 2.100 / 5. 2.100
libpostproc 58. 2.100 / 58. 2.100
Operating System: Windows 10 22H2 (19045.4894)
Describe the bug:
Tried to load a 4K UHD Blu-ray rip source to convert to 1080p and SDR colorspace, but got a "division by zero" error in the logs when the app tried to inspect the HDR metadata of the file.
To Reproduce
Add source file, observe application logs.
Source file frame data
Click to view JSON
> ffprobe -loglevel panic -select_streams 0 -print_format json -show_frames -read_intervals %+#1 '.\[source file name].mkv'
{
"frames": [
{
"media_type": "video",
"stream_index": 0,
"key_frame": 1,
"pts": 0,
"pts_time": "0.000000",
"best_effort_timestamp": 0,
"best_effort_timestamp_time": "0.000000",
"duration": 41,
"duration_time": "0.041000",
"pkt_pos": "39518",
"pkt_size": "3077",
"width": 3840,
"height": 2160,
"crop_top": 0,
"crop_bottom": 0,
"crop_left": 0,
"crop_right": 0,
"pix_fmt": "yuv420p10le",
"sample_aspect_ratio": "1:1",
"pict_type": "I",
"interlaced_frame": 0,
"top_field_first": 0,
"repeat_pict": 0,
"color_range": "tv",
"color_space": "bt709",
"color_primaries": "bt709",
"color_transfer": "bt709",
"chroma_location": "left",
"side_data_list": [
{
"side_data_type": "Mastering display metadata"
},
{
"side_data_type": "Content light level metadata",
"max_content": 0,
"max_average": 0
}
]
}
]
}
Application Logs
Click to view logs
2024-09-14 11:08:54,205 - fastflix DEBUG Using config file fastflix.yaml
2024-09-14 11:08:54,451 - fastflix INFO Running task Gather FFmpeg version
2024-09-14 11:08:54,458 - fastflix INFO Running command: C:\Program Files\ffmpeg\bin\ffmpeg.EXE -version
2024-09-14 11:08:54,519 - fastflix INFO Running task Gather FFprobe version
2024-09-14 11:08:54,519 - fastflix INFO Running command: C:\Program Files\ffmpeg\bin\ffprobe.EXE -version
2024-09-14 11:08:54,549 - fastflix INFO Running task Gather FFmpeg audio encoders
2024-09-14 11:08:54,564 - fastflix INFO Running command: C:\Program Files\ffmpeg\bin\ffmpeg.EXE -hide_banner -encoders
2024-09-14 11:08:54,595 - fastflix INFO Running task Determine OpenCL Support
2024-09-14 11:08:54,595 - fastflix INFO Running command: C:\Program Files\ffmpeg\bin\ffmpeg.EXE -hide_banner -log_level error -init_hw_device opencl:0.0 -h
2024-09-14 11:08:54,950 - fastflix INFO Running task Initialize Encoders
2024-09-14 11:08:56,021 - fastflix DEBUG Checking for newer versions of FastFlix
2024-09-14 11:08:56,367 - fastflix DEBUG FastFlix is up tp date
2024-09-14 11:09:08,691 - fastflix INFO Running task Parse Video details
2024-09-14 11:09:08,699 - fastflix INFO Running command: C:\Program Files\ffmpeg\bin\ffprobe.EXE -v quiet -loglevel panic -print_format json -show_format -show_streams D:\[username]\Downloads\[source file name].mkv
2024-09-14 11:09:08,742 - fastflix INFO Running task Extract covers
2024-09-14 11:09:08,765 - fastflix INFO Running command: C:\Program Files\ffmpeg\bin\ffmpeg.EXE -y -i D:\[username]\Downloads\[source file name].mkv -map 0:3 -c copy -vframes 1 cover.jpg
2024-09-14 11:09:09,375 - fastflix INFO Running task Detecting Interlace
2024-09-14 11:09:09,383 - fastflix INFO Running command: C:\Program Files\ffmpeg\bin\ffmpeg.EXE -hide_banner -i D:\[username]\Downloads\[source file name].mkv -vf idet -frames:v 100 -an -sn -dn -f rawvideo NUL -y
2024-09-14 11:09:12,037 - fastflix INFO Running task Determine HDR details
2024-09-14 11:09:12,037 - fastflix INFO Running command: C:\Program Files\ffmpeg\bin\ffprobe.EXE -loglevel panic -select_streams 0 -print_format json -show_frames -read_intervals %+#1 -show_entries frame=color_space,color_primaries,color_transfer,side_data_list,pix_fmt D:\[username]\Downloads\[source file name].mkv
2024-09-14 11:09:12,109 - fastflix ERROR Unexpected error while processing master-display from {'index': 0, 'codec_name': 'hevc', 'codec_long_name': 'H.265 / HEVC (High Efficiency Video Coding)', 'profile': 'Main 10', 'codec_type': 'video', 'codec_tag_string': '[0][0][0][0]', 'codec_tag': '0x0000', 'width': 3840, 'height': 2160, 'coded_width': 3840, 'coded_height': 2160, 'closed_captions': 0, 'film_grain': 0, 'has_b_frames': 1, 'sample_aspect_ratio': '1:1', 'display_aspect_ratio': '16:9', 'pix_fmt': 'yuv420p10le', 'level': 153, 'color_range': 'tv', 'color_space': 'bt709', 'color_transfer': 'bt709', 'color_primaries': 'bt709', 'chroma_location': 'left', 'refs': 1, 'r_frame_rate': '24000/1001', 'avg_frame_rate': '24000/1001', 'time_base': '1/1000', 'start_pts': 0, 'start_time': '0.000000', 'extradata_size': 806, 'disposition': {'default': 0, 'dub': 0, 'original': 0, 'comment': 0, 'lyrics': 0, 'karaoke': 0, 'forced': 0, 'hearing_impaired': 0, 'visual_impaired': 0, 'clean_effects': 0, 'attached_pic': 0, 'timed_thumbnails': 0, 'non_diegetic': 0, 'captions': 0, 'descriptions': 0, 'metadata': 0, 'dependent': 0, 'still_image': 0, 'multilayer': 0}, 'tags': {'language': 'eng', 'BPS-eng': '34278165', 'DURATION-eng': '00:05:30.955625000', 'NUMBER_OF_FRAMES-eng': '7935', 'NUMBER_OF_BYTES-eng': '1418066287', 'SOURCE_ID-eng': '001011', '_STATISTICS_WRITING_APP-eng': 'MakeMKV v1.17.7 win(x64-release)', '_STATISTICS_WRITING_DATE_UTC-eng': '2024-09-14 00:26:53', '_STATISTICS_TAGS-eng': 'BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID'}, 'bit_depth': 10}
Traceback (most recent call last):
File "fastflix\flix.py", line 565, in parse_hdr_details
master_display, cll = convert_mastering_display(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "fastflix\flix.py", line 501, in convert_mastering_display
red=f"({s(item, 'red_x')},{s(item, 'red_y')})",
^^^^^^^^^^^^^^^^
File "fastflix\flix.py", line 491, in s
upper *= base / lower
~~~~~^~~~~~~
ZeroDivisionError: division by zero
2024-09-14 11:09:12,109 - fastflix INFO Running task Detect HDR10+
2024-09-14 11:09:12,121 - fastflix DEBUG 1 video tracks found
2024-09-14 11:09:12,121 - fastflix DEBUG 1 audio tracks found
2024-09-14 11:09:12,121 - fastflix DEBUG 1 subtitle tracks found
2024-09-14 11:09:12,125 - fastflix DEBUG 1 attachment tracks found
2024-09-14 11:09:12,125 - fastflix INFO Updating video info
2024-09-14 11:09:12,609 - fastflix DEBUG Generating thumbnail: ['C:\\Program Files\\ffmpeg\\bin\\ffmpeg.EXE', '-ss', '33.0976', '-loglevel', 'warning', '-i', 'D:\\[username]\\Downloads\\[source file name].mkv', '-init_hw_device', 'opencl:0.0=ocl', '-filter_hw_device', 'ocl', '-filter_complex', "[0:0]scale='min(440\\,iw):-8'[v]", '-map', '[v]', '-an', '-y', '-map_metadata', '-1', '-frames:v', '1', 'D:\\[username]\\Downloads\\FastFlix_5.8.1_win64\\fastflix_workspace\\thumbnail_preview.jpg']
2024-09-14 11:09:12,960 - fastflix WARNING ERROR trying to use OpenCL for thumbnail generation
2024-09-14 11:09:12,964 - fastflix DEBUG Generating thumbnail: ['C:\\Program Files\\ffmpeg\\bin\\ffmpeg.EXE', '-ss', '33.0976', '-loglevel', 'warning', '-i', 'D:\\[username]\\Downloads\\[source file name].mkv', '-filter_complex', "[0:0]scale='min(440\\,iw):-8'[v]", '-map', '[v]', '-an', '-y', '-map_metadata', '-1', '-frames:v', '1', 'D:\\[username]\\Downloads\\FastFlix_5.8.1_win64\\fastflix_workspace\\thumbnail_preview.jpg']
cdgriffith commented
"max_content": 0,
"max_average": 0
Would not have expected them to provide invalid metadata, will work on workaround for bad data, thanks for reporting!
cdgriffith commented
Should be fixed in https://github.com/cdgriffith/FastFlix/releases/tag/5.8.2