[FFmpeg-devel] [PATCH v2] avformat/movenc: Write 'av01' as a compatible brand when muxing AV1

James Almer jamrial at gmail.com
Wed Jun 17 17:45:19 EEST 2020


On 6/17/2020 11:41 AM, Derek Buitenhuis wrote:
> This is a requirement of the AV1-ISOBMFF spec. Section 2.1.
> General Requirements & Brands states:
> 
>     * It SHALL have the av01 brand among the compatible brands array of the FileTypeBox
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
> Changes
>     * Updated FATE refs.
>     * Moved the write to be for all mode == mp4.
> ---
>  libavformat/movenc.c        | 6 +++++-
>  tests/ref/lavf-fate/av1.mp4 | 4 ++--
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 520aaafb74..60e20bcacc 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -4875,7 +4875,7 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
>  {
>      MOVMuxContext *mov = s->priv_data;
>      int64_t pos = avio_tell(pb);
> -    int has_h264 = 0, has_video = 0;
> +    int has_h264 = 0, has_av1 = 0, has_video = 0;
>      int i;
>  
>      for (i = 0; i < s->nb_streams; i++) {
> @@ -4886,6 +4886,8 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
>              has_video = 1;
>          if (st->codecpar->codec_id == AV_CODEC_ID_H264)
>              has_h264 = 1;
> +        if (st->codecpar->codec_id == AV_CODEC_ID_AV1)
> +            has_av1 = 1;
>      }
>  
>      avio_wb32(pb, 0); /* size */
> @@ -4905,6 +4907,8 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
>          // brand, if not already the major brand. This is compatible with users that
>          // don't understand tfdt.
>          if (mov->mode == MODE_MP4) {
> +            if (has_av1)
> +                ffio_wfourcc(pb, "av01");

nit: I'd prefer it after the cmfc and iso6 compat brands instead.

LGTM either way.

>              if (mov->flags & FF_MOV_FLAG_CMAF)
>                  ffio_wfourcc(pb, "cmfc");
>              if (mov->flags & FF_MOV_FLAG_FRAGMENT && !(mov->flags & FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS))
> diff --git a/tests/ref/lavf-fate/av1.mp4 b/tests/ref/lavf-fate/av1.mp4
> index 38d2a80afe..c8dc8e9a1a 100644
> --- a/tests/ref/lavf-fate/av1.mp4
> +++ b/tests/ref/lavf-fate/av1.mp4
> @@ -1,3 +1,3 @@
> -0388467214421a19ba65d10a74dc35c0 *tests/data/lavf-fate/lavf.av1.mp4
> -55936 tests/data/lavf-fate/lavf.av1.mp4
> +4eed679a1d3e18edfd95b268167d8060 *tests/data/lavf-fate/lavf.av1.mp4
> +55940 tests/data/lavf-fate/lavf.av1.mp4
>  tests/data/lavf-fate/lavf.av1.mp4 CRC=0x7c27cc15
> 



More information about the ffmpeg-devel mailing list