1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

avformat/movenc: write hvcE box for Dolby Vision enhancement layer

When AV_PKT_DATA_HEVC_CONF is present on a MODE_MP4 HEVC
track, write it as an hvcE box alongside hvcC and dvcC. Like dvcC,
writing requires -strict unofficial.
This commit is contained in:
Romain Beauxis
2026-04-22 10:00:47 -05:00
committed by toots
parent 2c74d197ee
commit 199e49d9b6
2 changed files with 22 additions and 2 deletions

View File

@@ -2537,6 +2537,14 @@ static int mov_write_dvcc_dvvc_tag(AVFormatContext *s, AVIOContext *pb, AVDOVIDe
return 32; /* 8 + 24 */
}
static int mov_write_hvce_tag(AVIOContext *pb, const AVPacketSideData *sd)
{
avio_wb32(pb, 8 + sd->size);
ffio_wfourcc(pb, "hvcE");
avio_write(pb, sd->data, sd->size);
return 8 + sd->size;
}
static int mov_write_clap_tag(AVIOContext *pb, MOVTrack *track,
uint32_t top, uint32_t bottom,
uint32_t left, uint32_t right)
@@ -3004,6 +3012,15 @@ static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
} else if (dovi) {
av_log(mov->fc, AV_LOG_WARNING, "Not writing 'dvcC'/'dvvC' box. Requires -strict unofficial.\n");
}
const AVPacketSideData *hvce = av_packet_side_data_get(track->st->codecpar->coded_side_data,
track->st->codecpar->nb_coded_side_data,
AV_PKT_DATA_HEVC_CONF);
if (hvce && mov->fc->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
mov_write_hvce_tag(pb, hvce);
} else if (hvce) {
av_log(mov->fc, AV_LOG_WARNING, "Not writing 'hvcE' box. Requires -strict unofficial.\n");
}
}
if (track->par->sample_aspect_ratio.den && track->par->sample_aspect_ratio.num) {

View File

@@ -1,5 +1,5 @@
cf2732a0d8f93e0a8695c1a1c7979b01 *tests/data/fate/mov-dovi-hvce-mp4-to-mp4.mp4
667954 tests/data/fate/mov-dovi-hvce-mp4-to-mp4.mp4
1d9ac9b893ed7e990b06fa13ebd97901 *tests/data/fate/mov-dovi-hvce-mp4-to-mp4.mp4
668149 tests/data/fate/mov-dovi-hvce-mp4-to-mp4.mp4
#extradata 0: 187, 0x34a930cb
#tb 0: 1/16000
#media_type 0: video
@@ -20,4 +20,7 @@ bl_present_flag=1
dv_bl_signal_compatibility_id=6
dv_md_compression=none
[/SIDE_DATA]
[SIDE_DATA]
side_data_type=HEVC enhancement-layer decoder configuration
[/SIDE_DATA]
[/STREAM]