avio_write(pb, "DKIF", 4);
avio_wl16(pb, 0); // version
avio_wl16(pb, 32); // header length
- avio_wl32(pb, par->codec_tag ? par->codec_tag :
+ avio_wl32(pb,
par->codec_id == AV_CODEC_ID_VP9 ? AV_RL32("VP90") :
par->codec_id == AV_CODEC_ID_VP8 ? AV_RL32("VP80") : AV_RL32("AV01"));
avio_wl16(pb, par->width);
avio_wl16(pb, par->height);
avio_wl32(pb, s->streams[0]->time_base.den);
avio_wl32(pb, s->streams[0]->time_base.num);
- avio_wl64(pb, 0xFFFFFFFFFFFFFFFFULL);
+ avio_wl64(pb, 0xFFFFFFFFFFFFFFFFULL); // length is overwritten at the end of muxing
return 0;
}
IVFEncContext *ctx = s->priv_data;
if ((pb->seekable & AVIO_SEEKABLE_NORMAL) && ctx->frame_cnt > 1) {
- size_t end = avio_tell(pb);
+ int64_t end = avio_tell(pb);
avio_seek(pb, 24, SEEK_SET);
- avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 1));
+ // overwrite the "length" field (duration)
+ avio_wl32(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 1));
+ avio_wl32(pb, 0); // zero out unused bytes
avio_seek(pb, end, SEEK_SET);
}
if (st->codecpar->codec_id == AV_CODEC_ID_VP9)
ret = ff_stream_add_bitstream_filter(st, "vp9_superframe", NULL);
+ else if (st->codecpar->codec_id == AV_CODEC_ID_AV1)
+ ret = ff_stream_add_bitstream_filter(st, "av1_metadata", "td=insert");
return ret;
}