cdgriffith / FastFlix

FastFlix is a free GUI for HEVC and AV1 encoding, GIF/WebP/AVIF creation, and more!
MIT License
1.08k stars 54 forks source link

Selecting a source file throws an error #30

Closed temesinko closed 3 years ago

temesinko commented 3 years ago

@cdgriffith Nice work. This will become really handy.

Unfortunately I was not able to try it out yet, because it's throwing an error when I try to select a source file.

Log:

2020-07-13 20:18:06,727 - flix    DEBUG    running probe command: "C:\Program Files\ffmpeg\bin\ffprobe.EXE" -v quiet -print_format json -show_format -show_streams "N:/source.mkv"
2020-07-13 20:18:07,727 - flix    DEBUG    running command: "C:\Program Files\ffmpeg\bin\ffprobe.EXE" -v quiet -print_format json -show_format -show_streams "N:/source.mkv"
2020-07-13 20:18:07,896 - flix    ERROR    Exception in 'update_video_info': from_json requires a string or filename - args: (<flix.widgets.main.Main(0x28b51d44ce0) at 0x0000028B5281DB48>,)
2020-07-13 20:18:07,897 - flix    ERROR    Exception in 'open_file': from_json requires a string or filename - args: (<flix.widgets.main.Main(0x28b51d44ce0) at 0x0000028B5281DB48>,)
Traceback (most recent call last):
  File "flix\widgets\main.py", line 167, in <lambda>
  File "site-packages\reusables\wrappers.py", line 270, in wrapper
  File "site-packages\reusables\wrappers.py", line 262, in wrapper
  File "flix\widgets\main.py", line 472, in open_file
  File "site-packages\reusables\wrappers.py", line 270, in wrapper
  File "site-packages\reusables\wrappers.py", line 262, in wrapper
  File "flix\widgets\main.py", line 579, in update_video_info
  File "flix\flix.py", line 381, in parse_hdr_details
  File "site-packages\box\box.py", line 613, in from_json
  File "site-packages\box\converters.py", line 65, in _from_json
box.exceptions.BoxError: from_json requires a string or filename
schlotkins commented 3 years ago

I have the same issue. Thanks! Here's my log:

2020-07-14 07:35:16,050 - flix DEBUG running probe command: "C:\Users\Chris Schwarz\AppData\Roaming\FFmpeg\bin\ffprobe.exe" -v quiet -print_format json -show_format -show_streams "F:/Days of Thunder_t00.mkv" 2020-07-14 07:35:17,052 - flix DEBUG running command: "C:\Users\Chris Schwarz\AppData\Roaming\FFmpeg\bin\ffprobe.exe" -v quiet -print_format json -show_format -show_streams "F:/Days of Thunder_t00.mkv" 2020-07-14 07:35:17,373 - flix ERROR Exception in 'update_video_info': from_json requires a string or filename - args: (<flix.widgets.main.Main(0x220a8676920) at 0x00000220A8FDEF88>,) 2020-07-14 07:35:17,373 - flix ERROR Exception in 'open_file': from_json requires a string or filename - args: (<flix.widgets.main.Main(0x220a8676920) at 0x00000220A8FDEF88>,) Traceback (most recent call last): File "flix\widgets\main.py", line 167, in File "site-packages\reusables\wrappers.py", line 270, in wrapper File "site-packages\reusables\wrappers.py", line 262, in wrapper File "flix\widgets\main.py", line 472, in open_file File "site-packages\reusables\wrappers.py", line 270, in wrapper File "site-packages\reusables\wrappers.py", line 262, in wrapper File "flix\widgets\main.py", line 579, in update_video_info File "flix\flix.py", line 381, in parse_hdr_details File "site-packages\box\box.py", line 613, in from_json File "site-packages\box\converters.py", line 65, in _from_json box.exceptions.BoxError: from_json requires a string or filename

cdgriffith commented 3 years ago

Just making sure, the videos you guys were using did not have HDR details when this bug occurred?

I think it's just that ffmpeg did not give back proper JSON formatting when there wasn't HDR details, so I am pushing a fix shortly. But if it didn't return anything with a HDR video there is a deeper issue.

temesinko commented 3 years ago

Mine had HDR details.

cdgriffith commented 3 years ago

Could you paste the output of the command:

"C:\Program Files\ffmpeg\bin\ffprobe.EXE" -v quiet -print_format json -show_format -show_streams "N:/source.mkv"

Sorry wrong command, one sec.

"C:\Program Files\ffmpeg\bin\ffprobe.EXE" -select_streams v:0 -print_format json -show_frames -read_intervals "%+#1" -show_entries "frame=color_space,color_primaries,color_transfer,side_data_list,pix_fmt -i "N:/source.mkv"

If it has more than one video track (can be tested via first command, then using -select_stream v:1 or so on) that may be part of the issue, if the HDR details are on a separate track than the source video.

temesinko commented 3 years ago

I'm gonna do this tonight and paste the output here.

schlotkins commented 3 years ago

They should have hdr. As you can probably tell from the title it is from a 4K Blu-ray. (No encryption encodes fine in handbrake)

I’ll run that command line tonight. Thanks for Putting this together! Love to get some hdr encoding for my roku and OlEd tv.

Chris

Sent from my iPhone

On Jul 14, 2020, at 7:58 AM, Chris Griffith notifications@github.com wrote:

Just making sure, the videos you guys were using did not have HDR details when this bug occurred?

I think it's just that ffmpeg did not give back proper JSON formatting when there wasn't HDR details, so I am pushing a fix shortly. But if it didn't return anything with a HDR video there is a deeper issue.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

schlotkins commented 3 years ago

here's my output. Note I had to change the path to ffprobe.exe but I think your program sees the right location. Thanks!

"streams": [ { "index": 0, "codec_name": "hevc", "codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)", "profile": "Main 10", "codec_type": "video", "codec_time_base": "1001/24000", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "width": 3840, "height": 2160, "coded_width": 3840, "coded_height": 2160, "closed_captions": 0, "has_b_frames": 3, "sample_aspect_ratio": "1:1", "display_aspect_ratio": "16:9", "pix_fmt": "yuv420p10le", "level": 153, "color_range": "tv", "color_space": "bt2020nc", "color_transfer": "smpte2084", "color_primaries": "bt2020", "chroma_location": "topleft", "refs": 1, "r_frame_rate": "24000/1001", "avg_frame_rate": "24000/1001", "time_base": "1/1000", "start_pts": 0, "start_time": "0.000000", "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 }, "tags": { "language": "eng", "BPS-eng": "62879059", "DURATION-eng": "01:47:17.097333333", "NUMBER_OF_FRAMES-eng": "154336", "NUMBER_OF_BYTES-eng": "50594826039", "SOURCE_ID-eng": "001011", "_STATISTICS_WRITING_APP-eng": "MakeMKV v1.15.1 win(x64-release)", "_STATISTICS_WRITING_DATE_UTC-eng": "2020-07-13 01:10:12", "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID" } }, { "index": 1, "codec_name": "truehd", "codec_long_name": "TrueHD", "codec_type": "audio", "codec_time_base": "1/48000", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "sample_fmt": "s32", "sample_rate": "48000", "channels": 6, "channel_layout": "5.1(side)", "bits_per_sample": 0, "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/1000", "start_pts": 0, "start_time": "0.000000", "bits_per_raw_sample": "24", "disposition": { "default": 1, "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 }, "tags": { "language": "eng", "title": "Surround 5.1", "BPS-eng": "3333585", "DURATION-eng": "01:47:17.097500000", "NUMBER_OF_FRAMES-eng": "7724517", "NUMBER_OF_BYTES-eng": "2682326580", "SOURCE_ID-eng": "001100", "_STATISTICS_WRITING_APP-eng": "MakeMKV v1.15.1 win(x64-release)", "_STATISTICS_WRITING_DATE_UTC-eng": "2020-07-13 01:10:12", "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID" } }, { "index": 2, "codec_name": "ac3", "codec_long_name": "ATSC A/52A (AC-3)", "codec_type": "audio", "codec_time_base": "1/48000", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "sample_fmt": "fltp", "sample_rate": "48000", "channels": 6, "channel_layout": "5.1(side)", "bits_per_sample": 0, "dmix_mode": "-1", "ltrt_cmixlev": "-1.000000", "ltrt_surmixlev": "-1.000000", "loro_cmixlev": "-1.000000", "loro_surmixlev": "-1.000000", "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/1000", "start_pts": 0, "start_time": "0.000000", "bit_rate": "640000", "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 }, "tags": { "language": "eng", "title": "Surround 5.1", "BPS-eng": "640000", "DURATION-eng": "01:47:17.120000000", "NUMBER_OF_FRAMES-eng": "201160", "NUMBER_OF_BYTES-eng": "514969600", "SOURCE_ID-eng": "001100", "_STATISTICS_WRITING_APP-eng": "MakeMKV v1.15.1 win(x64-release)", "_STATISTICS_WRITING_DATE_UTC-eng": "2020-07-13 01:10:12", "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID" } }, { "index": 3, "codec_name": "hdmv_pgs_subtitle", "codec_long_name": "HDMV Presentation Graphic Stream subtitles", "codec_type": "subtitle", "codec_time_base": "0/1", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/1000", "start_pts": 0, "start_time": "0.000000", "duration_ts": 6437097, "duration": "6437.097000", "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 }, "tags": { "language": "eng", "BPS-eng": "40176", "DURATION-eng": "01:40:46.978437500", "NUMBER_OF_FRAMES-eng": "2442", "NUMBER_OF_BYTES-eng": "30368203", "SOURCE_ID-eng": "0012A0", "_STATISTICS_WRITING_APP-eng": "MakeMKV v1.15.1 win(x64-release)", "_STATISTICS_WRITING_DATE_UTC-eng": "2020-07-13 01:10:12", "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID" } } ], "format": { "filename": "Days of Thunder_t00.mkv", "nb_streams": 4, "nb_programs": 0, "format_name": "matroska,webm", "format_long_name": "Matroska / WebM", "start_time": "0.000000", "duration": "6437.097000", "size": "53833067012", "bit_rate": "66903533", "probe_score": 100, "tags": { "title": "Days of Thunder", "encoder": "libmakemkv v1.15.1 (1.3.5/1.4.7) win(x64-release)", "creation_time": "2020-07-13T01:10:12.000000Z" } } }

temesinko commented 3 years ago

I added the missing double quotes after pix_fmt and added -v quiet to get proper JSON. I assume this is what you are looking for:

{
    "frames": [
        {
            "pix_fmt": "yuv420p10le",
            "color_space": "bt2020nc",
            "color_primaries": "bt2020",
            "color_transfer": "smpte2084",
            "side_data_list": [
                {
                    "side_data_type": "Mastering display metadata",
                    "red_x": "34000/50000",
                    "red_y": "16000/50000",
                    "green_x": "13250/50000",
                    "green_y": "34500/50000",
                    "blue_x": "7500/50000",
                    "blue_y": "3000/50000",
                    "white_point_x": "15635/50000",
                    "white_point_y": "16450/50000",
                    "min_luminance": "50/10000",
                    "max_luminance": "10000000/10000"
                },
                {
                    "side_data_type": "Content light level metadata",
                    "max_content": 910,
                    "max_average": 101
                }
            ]
        }
    ]
}
schlotkins commented 3 years ago

I just did the exact same command as temesinko on the same file I posted before. Here's my data:

{ "frames": [ { "pix_fmt": "yuv420p10le", "color_space": "bt2020nc", "color_primaries": "bt2020", "color_transfer": "smpte2084", "side_data_list": [ { "side_data_type": "Mastering display metadata", "red_x": "34000/50000", "red_y": "16000/50000", "green_x": "13250/50000", "green_y": "34500/50000", "blue_x": "7500/50000", "blue_y": "3000/50000", "white_point_x": "15635/50000", "white_point_y": "16450/50000", "min_luminance": "1/10000", "max_luminance": "10000000/10000" }, { "side_data_type": "Content light level metadata", "max_content": 0, "max_average": 0 } ] } ] }

temesinko commented 3 years ago

@cdgriffith Just updated to the latest release and now it's working for files with HDR and without.

@schlotkins Can you confirm that updating to 2.1.1 fixes the problem for you too?

schlotkins commented 3 years ago

OK good news it opens the same file and I can see the preview!! Thank you so much.

However, when I go to convert, it doesn't work. Embarrassingly, I don't know how to install x265 so I think that's why it is erroring out if I try to do a HEVC convert... any help there?

cdgriffith commented 3 years ago

I just had an error while trying to convert myself, not sure if the bug fix somehow messed that up or a deeper issue. Will try to look at that later today. Thank you guys for the outputs!

schlotkins commented 3 years ago

I posted a new issue about DTS. It has something to do with the DTS streams. If I unselect the DTS and only leave the AC3 streams it works. (Of course, the AC3 stream is the commentary and not the movie audio)

With that said, my output seems REALLY washed out compared to handbrake output so I am not sure FFMpeg is getting the colorspace information still.

Thanks so much for this tool - it's awesome!

schlotkins commented 3 years ago

just to show you handbrake vs. the HDR encode from FastFix hb rambo HDR rambo

cdgriffith commented 3 years ago

@schlotkins The HDR details must not have been copied correctly as you suspect to get that washed out look. If you could look at the copy of Media Info what does the Video section say? (I ususally use View->Text)

Specifically looking for the HDR format lines, should be:

HDR format                               : SMPTE ST 2086, HDR10 compatible
Color range                              : Limited
Color primaries                          : BT.2020
Matrix coefficients                      : BT.2020 non-constant
Mastering display color primaries        : BT.2020
schlotkins commented 3 years ago

Hope this helps - thanks again for making this tool!

Video ID : 1 ID in the original source medium : 4113 (0x1011) Format : HEVC Format/Info : High Efficiency Video Coding Format profile : Main 10@L5.1@High HDR format : SMPTE ST 2086, HDR10 compatible Codec ID : V_MPEGH/ISO/HEVC Duration : 1 h 35 min Bit rate : 63.3 Mb/s Width : 3 840 pixels Height : 2 160 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 24.000 FPS Color space : YUV Chroma subsampling : 4:2:0 (Type 2) Bit depth : 10 bits Bits/(Pixel*Frame) : 0.318 Stream size : 42.4 GiB (91%) Writing library : x265 1.9+205-dcd65c5ff838:[Windows][GCC 4.8.2][64 bit] 10bit Encoding settings : wpp / ctu=64 / min-cu-size=8 / max-tu-size=32 / tu-intra-depth=1 / tu-inter-depth=1 / me=1 / subme=2 / merange=57 / no-rect / no-amp / max-merge=2 / temporal-mvp / no-early-skip / no-recursion-skip / rdpenalty=0 / no-tskip / no-tskip-fast / strong-intra-smoothing / no-lossless / no-cu-lossless / no-constrained-intra / no-fast-intra / no-open-gop / no-temporal-layers / interlace=0 / keyint=24 / min-keyint=1 / scenecut=40 / rc-lookahead=20 / lookahead-slices=8 / bframes=4 / bframe-bias=0 / b-adapt=2 / ref=3 / limit-refs=3 / no-limit-modes / weightp / no-weightb / aq-mode=0 / qg-size=32 / aq-strength=0.00 / cbqpoffs=0 / crqpoffs=0 / rd=1 / psy-rd=0.00 / rdoq-level=0 / psy-rdoq=0.00 / no-rd-refine / signhide / deblock=0:0 / no-sao / no-sao-non-deblock / no-b-pyramid / no-cutree / no-intra-refresh / rc=crf / crf=13.0 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=1 / vbv-maxrate=65000 / vbv-bufsize=50000 / crf-max=0.0 / ipratio=1.10 / pbratio=1.00 Language : English Default : No Forced : No Color range : Limited Color primaries : BT.2020 Transfer characteristics : PQ Matrix coefficients : BT.2020 non-constant Mastering display color primaries : BT.2020 Mastering display luminance : min: 0.0001 cd/m2, max: 1000 cd/m2 Maximum Content Light Level : 1000 cd/m2 Maximum Frame-Average Light Level : 400 cd/m2 Original source medium : Blu-ray

cdgriffith commented 3 years ago

As hopefully the program at minimum no longer crashes while loading a video, closing this ticket out to focus on @schlotkins color issues in https://github.com/cdgriffith/FastFlix/issues/34