Opened 3 hours ago

Closed 2 hours ago

#11425 closed defect (fixed)

5813e5a (fix for hevc regression from a696b28) has not been backported to 7.1

Reported by: Sebastian Meyer Owned by:
Priority: normal Component: avformat
Version: 7.1 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
See https://github.com/streamlink/streamlink/issues/6410#issuecomment-2603369602

The Streamlink project implements a DASH client in Python and uses FFmpeg to remux the resulting video/audio streams into its output.

In the linked thread above, a user ran into an issue with FFmpeg n7.1 that doesn't occur on n7.0 or recent builds from master.

After running git bisect start 'n7.1' 'n7.0.2' and rebuilding FFmpeg, I found commit a696b288861a09403e316f4eb33bbc7cb6c03e5c to be the culprit. And after checking the master branch, I found that commit 5813e5aa344b8c03c83bf62e729be0f447944ed1 already fixed the regression introduced by the other commit.

However, the fix was never backported to the release/7.1 branch:
https://git.ffmpeg.org/gitweb/ffmpeg.git/history/refs/heads/release/7.1:/libavformat/hevc.c

I'm therefore asking for a quick backport. Thank you!

Also, since I'm not aware, what's the patch release policy of FFmpeg? Will there be another patch release (n7.0.3), or do we have to wait for n7.2/n8.0 to be released? Thanks.

How to reproduce:
The user who reported the issue has shared the video file here:
https://drive.google.com/file/d/1g87o8wA0mwvgRNTrwTM36o-4ZnJIEMIv/view?usp=sharing

Bad commit (a696b288861a09403e316f4eb33bbc7cb6c03e5c):

$ ./ffmpeg-N-116167-ga696b28886-linux64-gpl-7.0/bin/ffmpeg -hide_banner -i video.mp4 -c copy -y video.mkv
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : iso9
    minor_version   : 0
    compatible_brands: iso9avc1cmf2cmfcdashclg1
    creation_time   : 2024-05-29T15:34:35.000000Z
  Duration: 482612:01:28.00, start: 1737403256.020000, bitrate: N/A
  Stream #0:0[0x1](und): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv, bt2020nc/bt2020/arib-std-b67), 3840x2160 [SAR 1:1 DAR 16:9], 24007 kb/s, 50 fps, 50 tbr, 200 tbn (default)
      Metadata:
        creation_time   : 2024-05-29T15:34:35.000000Z
        handler_name    : BBC Video
        vendor_id       : [0][0][0][0]
        encoder         : HEVC Coding
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
[out#0/matroska @ 0x5e6173ef4100] Could not write header (incorrect codec parameters ?): Invalid data found when processing input
Conversion failed!

Good commit (a696b288861a09403e316f4eb33bbc7cb6c03e5c~1 or current HEAD of master):

$ ./ffmpeg-N-116166-g46f7ea4456-linux64-gpl-7.0/bin/ffmpeg -hide_banner -i video.mp4 -c copy -y video.mkv
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : iso9
    minor_version   : 0
    compatible_brands: iso9avc1cmf2cmfcdashclg1
    creation_time   : 2024-05-29T15:34:35.000000Z
  Duration: 482612:01:28.00, start: 1737403256.020000, bitrate: N/A
  Stream #0:0[0x1](und): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv, bt2020nc/bt2020/arib-std-b67), 3840x2160 [SAR 1:1 DAR 16:9], 24007 kb/s, 50 fps, 50 tbr, 200 tbn (default)
      Metadata:
        creation_time   : 2024-05-29T15:34:35.000000Z
        handler_name    : BBC Video
        vendor_id       : [0][0][0][0]
        encoder         : HEVC Coding
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Output #0, matroska, to 'video.mkv':
  Metadata:
    major_brand     : iso9
    minor_version   : 0
    compatible_brands: iso9avc1cmf2cmfcdashclg1
    encoder         : Lavf61.5.100
  Stream #0:0(und): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv, bt2020nc/bt2020/arib-std-b67), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 24007 kb/s, 50 fps, 50 tbr, 1k tbn (default)
      Metadata:
        creation_time   : 2024-05-29T15:34:35.000000Z
        handler_name    : BBC Video
        vendor_id       : [0][0][0][0]
        encoder         : HEVC Coding
Press [q] to stop, [?] for help
[out#0/matroska @ 0x5cb72bda8100] video:93778KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.032008%
size=   93808KiB time=00:00:31.96 bitrate=24041.2kbits/s speed= 184x

container + stream data:

$ ffprobe -v error -of json -show_format -show_streams video.mp4 | jq
{
  "streams": [
    {
      "index": 0,
      "codec_name": "hevc",
      "codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)",
      "profile": "Main 10",
      "codec_type": "video",
      "codec_tag_string": "hev1",
      "codec_tag": "0x31766568",
      "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": "bt2020nc",
      "color_transfer": "arib-std-b67",
      "color_primaries": "bt2020",
      "chroma_location": "topleft",
      "refs": 1,
      "view_ids_available": "",
      "view_pos_available": "",
      "id": "0x1",
      "r_frame_rate": "50/1",
      "avg_frame_rate": "50/1",
      "time_base": "1/200",
      "start_pts": 347480651204,
      "start_time": "1737403256.020000",
      "duration_ts": 347480657600,
      "duration": "1737403288.000000",
      "bit_rate": "24007198",
      "extradata_size": 23,
      "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,
        "non_diegetic": 0,
        "captions": 0,
        "descriptions": 0,
        "metadata": 0,
        "dependent": 0,
        "still_image": 0,
        "multilayer": 0
      },
      "tags": {
        "creation_time": "2024-05-29T15:34:35.000000Z",
        "language": "und",
        "handler_name": "BBC Video",
        "vendor_id": "[0][0][0][0]",
        "encoder": "HEVC Coding"
      }
    }
  ],
  "format": {
    "filename": "video.mp4",
    "nb_streams": 1,
    "nb_programs": 0,
    "nb_stream_groups": 0,
    "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
    "format_long_name": "QuickTime / MOV",
    "start_time": "1737403256.020000",
    "duration": "1737403288.000000",
    "size": "96049545",
    "probe_score": 100,
    "tags": {
      "major_brand": "iso9",
      "minor_version": "0",
      "compatible_brands": "iso9avc1cmf2cmfcdashclg1",
      "creation_time": "2024-05-29T15:34:35.000000Z"
    }
  }
}

Change History (1)

comment:1 by James, 2 hours ago

Resolution: fixed
Status: newclosed

Backported as aeb86310480382138a9046d5a427f4a8c1b866ea in branch release/7.1, which will be in n7.1.1.

Note: See TracTickets for help on using tickets.