[FFmpeg-devel] [PATCH v1 5/8] avformat/mov_muxer: Extended MOV muxer to handle APV video content

James Almer jamrial at gmail.com
Wed Apr 23 17:43:59 EEST 2025


On 4/23/2025 11:13 AM, Dawid Kozinski wrote:
> @@ -2757,6 +2789,8 @@ static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
>       }
>       else if (track->par->codec_id ==AV_CODEC_ID_EVC) {
>           mov_write_evcc_tag(pb, track);
> +    } else if (track->par->codec_id ==AV_CODEC_ID_APV) {
> +        mov_write_apvc_tag(pb, track);
>       } else if (track->par->codec_id == AV_CODEC_ID_VP9) {
>           mov_write_vpcc_tag(mov->fc, pb, track);
>       } else if (track->par->codec_id == AV_CODEC_ID_AV1) {
> @@ -6713,6 +6747,18 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
>           memset(trk->vos_data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
>       }
>   
> +    if (par->codec_id == AV_CODEC_ID_APV && !trk->vos_len) {
> +            ret = ff_isom_create_apv_dconf_record(&trk->vos_data, &trk->vos_len);
> +            if (!trk->vos_data) {
> +                ret = AVERROR(ENOMEM);
> +                goto err;
> +            }
> +    }
> +
> +    if (par->codec_id == AV_CODEC_ID_APV && trk->vos_len) {
> +        ret = ff_isom_fill_apv_dconf_record(trk->vos_data, pkt->data, size);
> +    }
> +
>       if (par->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 &&
>           (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) {
>           if (!trk->st->nb_frames) {

Instead of this, add APV to the list in 
https://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/movenc.c;h=4bc8bd1b2ab765c2b9f5f5dfc2dcb77361f2b944;hb=HEAD#l6697 
so the first packet is always copied to trk->vos_data in case 
par->extradata is not set.

After that, ff_isom_write_apvc() can either write the extradata as is if 
it's already a configuration record, or generate it if it's just a 
packet of PBUs (See ff_isom_write_hvcc()).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250423/669d4997/attachment.sig>


More information about the ffmpeg-devel mailing list