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

Colors look washed out #34

Closed cdgriffith closed 3 years ago

cdgriffith commented 3 years ago

Original issue raised in https://github.com/cdgriffith/FastFlix/issues/30 by @schlotkins

Converted video details looked good, but the colors still look washed out.

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

Example from handbrake:

87595356-40f52d00-c6a3-11ea-945f-ec7f150189be

Example from ffmpeg output: 87595359-42265a00-c6a3-11ea-8792-c68767050c2e

cdgriffith commented 3 years ago

The video file looks good from a metadata persecptive, but obviously something is going on to cause the issue. First lets just go from the other direction to make sure we don't overlook the basics, are you playing it a player that handles HDR correctly?

For example, here is a crop from VLC of a 10-bit movie, that you can see looks right when playing, but their snapshots are still 8-bit (top left). So similarly if you have a player that can't color map correctly that can happen. (Can even happen in VLC itself)

Screenshot from 2020-07-18 17-54-19

File I converted with FastFlix to download to test and make sure is showing reds correctly: GlassBlowing-flix.zip

Using GlassBlowing video from Dolby Vision demo files. You can try the conversion with your copy of FastFlix / FFmpeg to make sure it works as well. (I just did first 10 seconds or so at ultrafast preset with no audio for this test).

schlotkins commented 3 years ago

OK, so here are screen shots from the original MKV outputed from MakeMKV in VLC and the file from FastFix 2.2.0. So I don't think it is a player issue at this point. (I also followed the link to make sure my settings in VLC were right. I can confirm it looks the same if I view it on my LG OLED TV streamed from my Roku.

I'll post the MediaInfo for the original and encoded next! (This is the one with all of the NL errors)

original mkv screenshot ff220 screenshot

schlotkins commented 3 years ago

Source Info:

General Unique ID : 32776466653221233893332587999978076080 (0x18A8849276CF6CD7BED10204E7B437B0) Complete name : F:\Days of Thunder_t00.mkv Format : Matroska Format version : Version 2 File size : 50.1 GiB Duration : 1 h 47 min Overall bit rate mode : Variable Overall bit rate : 66.9 Mb/s Movie name : Days of Thunder Encoded date : UTC 2020-07-13 01:10:12 Writing application : MakeMKV v1.15.1 win(x64-release) Writing library : libmakemkv v1.15.1 (1.3.5/1.4.7) win(x64-release)

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 47 min Bit rate : 62.9 Mb/s Width : 3 840 pixels Height : 2 160 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 23.976 (24000/1001) FPS Color space : YUV Chroma subsampling : 4:2:0 (Type 2) Bit depth : 10 bits Bits/(Pixel*Frame) : 0.316 Stream size : 47.1 GiB (94%) 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 : Display P3 Mastering display luminance : min: 0.0001 cd/m2, max: 1000 cd/m2 Original source medium : Blu-ray

schlotkins commented 3 years ago

This is the info on the FastFix 2.2.0 encoded file. I just did 1 minute

General Unique ID : 238497588397105805506035477021053902966 (0xB36CF6F79D91D893844199B75F636076) Complete name : F:\Days of Thunder_t00-flix-1595092471.mkv Format : Matroska Format version : Version 4 File size : 691 MiB Duration : 1 min 1 s Overall bit rate : 94.4 Mb/s Movie name : Days of Thunder Writing application : Lavf58.48.100 Writing library : Lavf58.48.100 ErrorDetectionType : Per level 1

Video ID : 1 ID in the original source medium : 4113 (0x1011) Format : HEVC Format/Info : High Efficiency Video Coding Format profile : Main 10@L5@Main Codec ID : V_MPEGH/ISO/HEVC Duration : 1 min 0 s Bit rate : 62.9 Mb/s Width : 3 840 pixels Height : 2 160 pixels Display aspect ratio : 16:9 Frame rate mode : Variable Frame rate : 2 571.452 FPS Original frame rate : 23.976 (24000/1001) FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 10 bits Bits/(Pixel*Frame) : 0.003 Stream size : 47.1 GiB Writing library : x265 3.4+2-73ca1d7be377:[Windows][GCC 9.3.1][64 bit] 10bit Encoding settings : cpuid=1111039 / frame-threads=4 / numa-pools=24 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=3840x2160 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=4 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=23 / keyint=250 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=25 / lookahead-slices=4 / scenecut=40 / hist-scenecut=0 / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=3 / limit-refs=3 / limit-modes / me=3 / subme=3 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=4 / selective-sao=4 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=20.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=2 / transfer=2 / colormatrix=2 / chromaloc=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / hist-threshold=0.01 / no-opt-cu-delta-qp / no-aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / no-scenecut-aware-qpconformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 Language : English Default : Yes Forced : No Color range : Limited Original source medium : Blu-ray

cdgriffith commented 3 years ago

Yeah, FastFlix is screwing up somehow, missing all hdr info that time. Can you paste the command it's generating?

For any tests run, feel free to just do a few seconds at ultrafast. I apprecaite you working with me on this issue and sorry it's causing such problems, don't want to waste any extra time!

schlotkins commented 3 years ago

Oh please, no need to apologize - you are doing ME (and others a huge favor) by making this program! Thank YOU!

Here's the command (I didn't change the times for the 1 min but doesn't matter):

"{ffmpeg}" -y -i "F:/Days of Thunder_t00.mkv" -to 6437.9 -map 0:0 -c:v libx265 -crf 20 -preset slow -map 0:2 -metadata:s:1 title="Surround 5.1" -metadata:s:1 handler="Surround 5.1" -c:1 copy -map 0:3 -c:2 copy -disposition:s:2 0 -metadata:s:2 language=eng -map_chapters 0 "{output}"

(If I helps I can drop a little of the stream to you privately somewhere or share with you via dropbox)

schlotkins commented 3 years ago

In case it helps, this is the DEBUG string right before it generates the command in the CMD window:

DEBUG - 2020-07-18 18:10:58,191 - Settings gathered: {'crop': None, 'scale': None, 'source': 'F:/Days of Thunder_t00.mkv', 'start_time': 0.0, 'duration': 6437.9, 'video_track': 0, 'rotate': None, 'v_flip': False, 'h_flip': False, 'streams': {'video': [{'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'}}], 'audio': [{'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'}}], 'subtitle': [{'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'}}], 'attachment': [], 'data': []}, 'format_info': {'filename': 'F:/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'}}, 'work_dir': WindowsPath('C:/Users/Chris Schwarz/AppData/Roaming/FastFlix'), 'side_data': None, 'disable_hdr': False, 'preset': 'slow', 'intra_encoding': False, 'max_mux': 'default', 'extra': '', 'crf': 20, 'audio_tracks': [{'index': 2, 'outdex': 1, 'conversion': {'codec': 'none', 'bitrate': '768k'}, 'codec': 'ac3', 'downmix': 0, 'title': 'Surround 5.1'}], 'subtitle_tracks': [{'index': 3, 'outdex': 2, 'disposition': 0, 'language': 'eng'}]}

cdgriffith commented 3 years ago

For some reason it must be still blorking grabbing the HDR details, because it seems as if it can't find them at all. I wonder if ffprobe isn't giving back proper json or something and may just have to parse another way.

This build has some extra debug info for trying to figure this out. It also has a "bug" that it allows all audio to passthrough. https://ci.appveyor.com/project/cdgriffith/fastflix/build/artifacts

There should be an error message as soon as you open the source that starts with "COULD NOT PARSE FFPROBE HDR METADATA" please copy the next two lines of STDOUT and STDERR.

schlotkins commented 3 years ago

Here's what it gives:

ERROR - 2020-07-18 19:08:57,455 - COULD NOT PARSE FFPROBE HDR METADATA, PLEASE OPEN ISSUE WITH THESE DETAILS: STDOUT: STDERR: 'C:\Users\Chris' is not recognized as an internal or external command, operable program or batch file.

Thanks!

cdgriffith commented 3 years ago

bangs head against table repeatedly

Good news, I'm an idiot and forgot the quote the path to ffprobe, so because there was spaces in the path to it, it croaked.

https://ci.appveyor.com/project/cdgriffith/fastflix/build/artifacts

schlotkins commented 3 years ago

You nailed it! It works - no washed out colors now!! Thank you! I also tried the ac3 conversion from DTS and it works with my roku so this is great! I will say the only weird thing is the mediainfo reports really weird info for the video. The frame rate is messed up and the bitrate isn't right. This file is only 57.6MB so that is 7.68Mbits/second. Probably a FFMPEG issue, but I thought I'd mention it. Here's what I mean:

GeneralUnique ID                                : 181275038171992097963923575827981492467 (0x88604D6B4D21E5D155B2A56CDDC560F3)
Complete name                            : F:\RAMBO II_t00-flix-1595133626.mkv
Format                                   : Matroska
Format version                           : Version 4
File size                                : 57.7 MiB
Duration                                 : 1 min 0 s
Overall bit rate                         : 8 063 kb/s
Movie name                               : RAMBO II
Writing application                      : Lavf58.48.100
Writing library                          : Lavf58.48.100
ErrorDetectionType                       : Per level 1
VideoID                                       : 1
ID in the original source medium         : 4113 (0x1011)
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5@Main
HDR format                               : SMPTE ST 2086, HDR10 compatible
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 1 min 0 s
Bit rate                                 : 63.3 Mb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 2 299.675 FPS
Original frame rate                      : 24.000 FPS
cdgriffith commented 3 years ago

I've seen weirdness for mediainfos bitrates when cutting down videos into smaller duration, but never seen that wrong of a frame rate being listed. Does it play fine or act weird?

schlotkins commented 3 years ago

Plays ok but just making sure! Got Rambo ok going here. The 1 min I made looks great!

Sent from my iPhone

On Jul 18, 2020, at 10:25 PM, Chris Griffith notifications@github.com wrote:

I've seen weirdness for mediainfos bitrates when cutting down videos into smaller duration, but never seen that wrong of a frame rate being listed. Does it play fine or act weird?

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

cdgriffith commented 3 years ago

Fixed in 2.3.0 https://github.com/cdgriffith/FastFlix/releases/tag/2.3.0