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

Skipping NAL unit 63 #514

Open
jriker1 opened this issue Jul 28, 2023 · 4 comments
Open

Skipping NAL unit 63 #514

jriker1 opened this issue Jul 28, 2023 · 4 comments

Comments

@jriker1
Copy link

jriker1 commented Jul 28, 2023

I am trying to re-encode a 4k HDR10/Dolby Vision show.

This is the info from mediainfo:

colour_description_present               : Yes
colour_description_present_Source        : Stream
Color range                              : Limited
colour_range_Source                      : Stream
Color primaries                          : BT.2020
colour_primaries_Source                  : Stream
Transfer characteristics                 : PQ
transfer_characteristics_Source          : Stream
Matrix coefficients                      : BT.2020 non-constant
matrix_coefficients_Source               : Stream
Mastering display color primaries        : Display P3
MasteringDisplay_ColorPrimaries_Source   : Stream
Mastering display luminance              : min: 0.0001 cd/m2, max: 1000 cd/m2
MasteringDisplay_Luminance_Source        : Stream
Maximum Content Light Level              : 1000 cd/m2
MaxCLL_Source                            : Stream
Maximum Frame-Average Light Level        : 719 cd/m2
MaxFALL_Source                           : Stream
Original source medium                   : Blu-ray

This is the info from ffprobe:

    "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",
            "pkt_duration": 41,
            "pkt_duration_time": "0.041000",
            "duration": 41,
            "duration_time": "0.041000",
            "pkt_pos": "8497",
            "pkt_size": "3325",
            "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",
            "coded_picture_number": 0,
            "display_picture_number": 0,
            "interlaced_frame": 0,
            "top_field_first": 0,
            "repeat_pict": 0,
            "color_range": "tv",
            "color_space": "bt2020nc",
            "color_primaries": "bt2020",
            "color_transfer": "smpte2084",
            "chroma_location": "topleft",
            "tags": {
                "timecode": "00:59:58:08"
            },
            "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": 1000,
                    "max_average": 719
                },
                {
                    "side_data_type": "SMPTE 12-1 timecode",
                    "timecodes": [
                        {
                            "value": "00:59:58:08"
                        }
                    ]
                },
                {
                    "side_data_type": "Dolby Vision RPU Data"
                },
                {
                    "side_data_type": "Dolby Vision Metadata",
                    "rpu_type": 2,
                    "rpu_format": 18,
                    "vdr_rpu_profile": 1,
                    "vdr_rpu_level": 0,
                    "chroma_resampling_explicit_filter_flag": 0,
                    "coef_data_type": 0,
                    "coef_log2_denom": 23,
                    "vdr_rpu_normalized_idc": 1,
                    "bl_video_full_range_flag": 0,
                    "bl_bit_depth": 10,
                    "el_bit_depth": 10,
                    "vdr_bit_depth": 12,
                    "spatial_resampling_filter_flag": 0,
                    "el_spatial_resampling_filter_flag": 1,
                    "disable_residual_flag": 0,
                    "vdr_rpu_id": 0,
                    "mapping_color_space": 0,
                    "mapping_chroma_format_idc": 0,
                    "nlq_method_idc": 0,
                    "nlq_method_idc_name": "linear_dz",
                    "num_x_partitions": 2047,
                    "num_y_partitions": 1,
                    "components": [
                        {
                            "pivots": "0 128 256 384 512 640 768 896 1023",
                            "pieces": [
                                {
                                    "mapping_idc": 0,
                                    "mapping_idc_name": "polynomial",
                                    "poly_order": 1,
                                    "poly_coef": "0 8388608"
                                },
                                {
                                    "mapping_idc": 0,
                                    "mapping_idc_name": "polynomial",
                                    "poly_order": 1,
                                    "poly_coef": "0 8388608"
                                },
                                {
                                    "mapping_idc": 0,
                                    "mapping_idc_name": "polynomial",
                                    "poly_order": 1,
                                    "poly_coef": "0 8388608"
                                },
                                {
                                    "mapping_idc": 0,
                                    "mapping_idc_name": "polynomial",
                                    "poly_order": 1,
                                    "poly_coef": "0 8388608"
                                },
                                {
                                    "mapping_idc": 0,
                                    "mapping_idc_name": "polynomial",
                                    "poly_order": 1,
                                    "poly_coef": "0 8388608"
                                },
                                {
                                    "mapping_idc": 0,
                                    "mapping_idc_name": "polynomial",
                                    "poly_order": 1,
                                    "poly_coef": "0 8388608"
                                },
                                {
                                    "mapping_idc": 0,
                                    "mapping_idc_name": "polynomial",
                                    "poly_order": 1,
                                    "poly_coef": "0 8388608"
                                },
                                {
                                    "mapping_idc": 0,
                                    "mapping_idc_name": "polynomial",
                                    "poly_order": 1,
                                    "poly_coef": "0 8388608"
                                }
                            ],
                            "nlq_offset": 512,
                            "vdr_in_max": 1048576,
                            "linear_deadzone_slope": 2048,
                            "linear_deadzone_threshold": 0
                        },
                        {
                            "pivots": "0 1023",
                            "pieces": [
                                {
                                    "mapping_idc": 1,
                                    "mapping_idc_name": "mmr",
                                    "mmr_order": 3,
                                    "mmr_constant": 0,
                                    "mmr_coef": "0 6391320 0 0 0 0 0 0 3195660 0 0 0 0 0 0 1597830 0 0 0 0 0"
                                }
                            ],
                            "nlq_offset": 512,
                            "vdr_in_max": 1048576,
                            "linear_deadzone_slope": 2048,
                            "linear_deadzone_threshold": 0
                        },
                        {
                            "pivots": "0 1023",
                            "pieces": [
                                {
                                    "mapping_idc": 1,
                                    "mapping_idc_name": "mmr",
                                    "mmr_order": 3,
                                    "mmr_constant": 0,
                                    "mmr_coef": "0 0 6391320 0 0 0 0 0 0 3195660 0 0 0 0 0 0 1597830 0 0 0 0"
                                }
                            ],
                            "nlq_offset": 512,
                            "vdr_in_max": 1048576,
                            "linear_deadzone_slope": 2048,
                            "linear_deadzone_threshold": 0
                        }
                    ],
                    "dm_metadata_id": 0,
                    "scene_refresh_flag": 1,
                    "ycc_to_rgb_matrix": "9574/8192 0/8192 13802/8192 9574/8192 -1540/8192 -5348/8192 9574/8192 17610/8192 0/8192",
                    "ycc_to_rgb_offset": "16777216/268435456 134217728/268435456 134217728/268435456",
                    "rgb_to_lms_matrix": "7222/16384 8771/16384 390/16384 2654/16384 12430/16384 1300/16384 0/16384 422/16384 15962/16384",
                    "signal_eotf": 65535,
                    "signal_eotf_param0": 0,
                    "signal_eotf_param1": 0,
                    "signal_eotf_param2": 0,
                    "signal_bit_depth": 12,
                    "signal_color_space": 0,
                    "signal_chroma_format": 0,
                    "signal_full_range_flag": 1,
                    "source_min_pq": 62,
                    "source_max_pq": 3696,
                    "source_diagonal": 42
                }

I ran dovi_tool with -m 2 against the HEVC source. When I ran the ffmpeg encode with:

ffmpeg -i .mkv -sn -an -f yuv4mpegpipe -strict -1 -pix_fmt yuv420p10le - | x265-10b - --input-depth 10 --output-depth 10 --y4m --preset slow --hdr10 --hdr10-opt --high-tier --repeat-headers --crf 20 --master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)" --max-cll "1000,719" --chromaloc 2 --no-sao --range limited --keyint 24 --colormatrix bt2020nc --colorprim bt2020 --transfer smpte2084 --dolby-vision-rpu RPU.bin --dolby-vision-profile 8.1 --vbv-bufsize 160000 --vbv-maxrate 160000 .hevc

It started screaming constantly with

[hevc @ 0000027f5cdb7380] Skipping NAL unit 63
    Last message repeated 9 times
[hevc @ 0000027f5cdb3780] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb5780] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb5f80] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb3380] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb9f80] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb7780] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb8f80] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb9780] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb4f80] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb3b80] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb6380] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb4b80] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb5b80] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb8380] Skipping NAL unit 63
    Last message repeated 2 times
[hevc @ 0000027f5cdb7b80] Skipping NAL unit 63
    Last message repeated 2 times

Have discussed DolbyVision in general here before however any thoughts on this? Would nvenc be able to handle this with my RTX 4090 or do I need to encode without it and inject it in with dovi_tool after? Never ran into this before with ffmpeg and cpu encoding until now so apparently this source has "more" DolbyVision data then any other I've dealt with.

@Shanghai-Tom
Copy link

Shanghai-Tom commented Sep 9, 2023

I see these same warnings with NVEncc to, I just use log level fatal on ffmpeg, and --log-level error on nvencc, for both of them I send the log to a file to prevent my screen filling with these errors.
I have also tried to filter these unit out using ffmpeg bsf filter, sadly it doesn't remove them, but maybe ffmpeg 5 will.
-bsf:v 'filter_units=remove_types=63'

@MChrisp
Copy link

MChrisp commented Nov 15, 2023

Hi, I am encountering this issue as well. I can make the log pretty, but my problem is, that it takes for ages to finish the ffmpeg command. I am unsure why. with the high log level I see the Skipping NAL for a very long time and then it finishes. The actual transcode is done. So if I press q for stopping ffmpeg it finishes and all is good. But for my use case pressing q is not practical. Any Idea, what I could do? (I am grasping straws, as I find nothing helpfull anywhere about this.)

@rigaya
Copy link
Owner

rigaya commented Nov 19, 2023

I'm not sure how I should handle this NAL unit 63, at this time just tried to avoid showing too much log messages. NVEnc 7.37 might suppress too many "Skipping NAL" messages, might help speeding up the encoding.

@MChrisp
Copy link

MChrisp commented Nov 26, 2023

I'm not sure how I should handle this NAL unit 63, at this time just tried to avoid showing too much log messages. NVEnc 7.37 might suppress too many "Skipping NAL" messages, might help speeding up the encoding.

The problem does not seem to be the log. It takes very long even without log messages. Not sure why. Irritating is also, that if I use dovi-tool (https://github.com/quietvoid/dovi_tool) to get the baselayer and the enhancment layer with ffmpeg filter hevc - | dovi-tool demux (well, not the exact command, but you get the point) I do not have this issue, even though it practially is doing the same thing in ffmpeg, right?

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

4 participants