PR #24556 opened by superuser404
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24556
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24556.patch

MP4RA registers `dav1` as a variant of `av01` that signals Dolby Vision. Dolby 
Vision Profile 10.0 uses it: the AV1 counterpart of HEVC Profile 5, an 
IPT-PQ-c2 signal with no compatible base layer, so `av01` is not an alternative 
there. The cross-compatible profiles (10.1, 10.2, 10.4) keep an `av01` entry 
and are unaffected.

Two tables are involved and each covers one direction.

Without the `isom_tags.c` entry the sample entry is not recognized, so a file a 
conforming muxer writes cannot be read. GPAC writes it, and the whole file can 
be built from public tools:

```sh
ffmpeg -f lavfi -i testsrc=size=640x360:rate=24:duration=2 \
  -c:v libsvtav1 -pix_fmt yuv420p10le -color_primaries bt2020 \
  -color_trc smpte2084 -colorspace bt2020nc -f obu av1.obu
MP4Box -add "av1.obu:dvp=f10:stype=dav1" -new dv100.mp4
ffprobe dv100.mp4
# Video: none (dav1 / 0x31766164), none, 640x360
# Could not find codec parameters for stream 0: unknown codec
```

Without the `codec_mp4_tags` entry in `movenc.c`, `validate_codec_tag()` finds 
no match for a requested tag and `mov_init()` bails:

```sh
ffmpeg -i av1.mp4 -c copy -tag:v dav1 out.mp4
# Tag dav1 incompatible with output codec id '225' (av01)
# Could not write header (incorrect codec parameters ?)
```

`dvh1` sits in that second table for the HEVC side already, which is what makes 
the Profile 5 remux work today.

With both entries the GPAC file probes as `av1`, and a remux with `-tag:v dav1` 
writes a `dav1` sample entry whose `av1C` parses back to `yuv420p10le`. The 
`av01` path is unchanged in both directions.

The `isom_tags.c` half was proposed in 2023 as 
[[email protected]](https://patchwork.ffmpeg.org/project/ffmpeg/patch/[email protected]/)
 and not applied. The `movenc.c` half, which is what a remuxing player needs, 
was not part of it.



>From 420ca92b4d495077b57d57a38ec29b0f504a326e Mon Sep 17 00:00:00 2001
From: Vincent Herbst <[email protected]>
Date: Fri, 18 Sep 2026 08:50:03 +0200
Subject: [PATCH] avformat/mov, movenc: add the dav1 sample entry for AV1 Dolby
 Vision

MP4RA registers 'dav1' as a variant of 'av01' that signals Dolby Vision.
Dolby Vision Profile 10.0 uses it: the AV1 counterpart of HEVC Profile 5,
an IPT-PQ-c2 signal with no compatible base layer, so 'av01' is not an
alternative there. The cross-compatible profiles (10.1, 10.2, 10.4) keep
an 'av01' entry and are unaffected.

Two tables are involved and each covers one direction.

Without the isom_tags.c entry the sample entry is not recognized, so a
file a conforming muxer writes cannot be read. GPAC writes it, and the
whole file can be built from public tools:

  $ ffmpeg -f lavfi -i testsrc=size=640x360:rate=24:duration=2 \
      -c:v libsvtav1 -pix_fmt yuv420p10le -color_primaries bt2020 \
      -color_trc smpte2084 -colorspace bt2020nc -f obu av1.obu
  $ MP4Box -add "av1.obu:dvp=f10:stype=dav1" -new dv100.mp4
  $ ffprobe dv100.mp4
  Video: none (dav1 / 0x31766164), none, 640x360
  Could not find codec parameters for stream 0: unknown codec

Without the codec_mp4_tags entry in movenc.c, validate_codec_tag() finds
no match for a requested tag and mov_init() bails:

  $ ffmpeg -i av1.mp4 -c copy -tag:v dav1 out.mp4
  Tag dav1 incompatible with output codec id '225' (av01)
  Could not write header (incorrect codec parameters ?)

'dvh1' sits in that second table for the HEVC side already, which is what
makes the Profile 5 remux work today.

With both entries the GPAC file probes as av1, and a remux with
-tag:v dav1 writes a 'dav1' sample entry whose av1C parses back to
yuv420p10le. The 'av01' path is unchanged.

The isom_tags.c half was proposed in 2023 as
[email protected] and not applied.
---
 libavformat/isom_tags.c | 1 +
 libavformat/movenc.c    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c
index c0c239d393..06166c0fa8 100644
--- a/libavformat/isom_tags.c
+++ b/libavformat/isom_tags.c
@@ -155,6 +155,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
     { AV_CODEC_ID_VP8,  MKTAG('v', 'p', '0', '8') }, /* VP8 */
     { AV_CODEC_ID_VP9,  MKTAG('v', 'p', '0', '9') }, /* VP9 */
     { AV_CODEC_ID_AV1,  MKTAG('a', 'v', '0', '1') }, /* AV1 */
+    { AV_CODEC_ID_AV1,  MKTAG('d', 'a', 'v', '1') }, /* AV1-related Dolby 
Vision */
 
     { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', ' ') },
     { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 
Camcorder */
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index ecc6544bad..b43ad655b4 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -9359,6 +9359,7 @@ static const AVCodecTag codec_mp4_tags[] = {
     { AV_CODEC_ID_TSCC2,           MKTAG('m', 'p', '4', 'v') },
     { AV_CODEC_ID_VP9,             MKTAG('v', 'p', '0', '9') },
     { AV_CODEC_ID_AV1,             MKTAG('a', 'v', '0', '1') },
+    { AV_CODEC_ID_AV1,             MKTAG('d', 'a', 'v', '1') },
     { AV_CODEC_ID_AAC,             MKTAG('m', 'p', '4', 'a') },
     { AV_CODEC_ID_APPLE_APAC,      MKTAG('a', 'p', 'a', 'c') },
     { AV_CODEC_ID_ALAC,            MKTAG('a', 'l', 'a', 'c') },
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to