diff mbox

[FFmpeg-devel] lavf/matroska: Allow AV1 in WebM

Message ID 73f13fac-b954-2154-7cb2-881ab90915d0@genshiken.org
State New
Headers show

Commit Message

Kagami Hiiragi Aug. 20, 2018, 4:44 p.m. UTC
Nothing prevents it to work except this check. AV1 is already supported
by Matroska muxer and aomenc produces WebM/AV1 files as well.

Signed-off-by: Kagami Hiiragi <kagami@genshiken.org>

Comments

James Almer Aug. 20, 2018, 5:09 p.m. UTC | #1
On 8/20/2018 1:44 PM, Kagami Hiiragi wrote:
> Nothing prevents it to work except this check. AV1 is already supported
> by Matroska muxer and aomenc produces WebM/AV1 files as well.
> 
> Signed-off-by: Kagami Hiiragi <kagami@genshiken.org>
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 09a62e1922..76cb124221 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -1296,11 +1296,12 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
>  
>      if (mkv->mode == MODE_WEBM && !(par->codec_id == AV_CODEC_ID_VP8 ||
>                                      par->codec_id == AV_CODEC_ID_VP9 ||
> +                                    par->codec_id == AV_CODEC_ID_AV1 ||
>                                      par->codec_id == AV_CODEC_ID_OPUS ||
>                                      par->codec_id == AV_CODEC_ID_VORBIS ||
>                                      par->codec_id == AV_CODEC_ID_WEBVTT)) {
>          av_log(s, AV_LOG_ERROR,
> -               "Only VP8 or VP9 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.\n");
> +               "Only VP8 or VP9 or AV1 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.\n");
>          return AVERROR(EINVAL);
>      }

I'm not against this, but i was thinking on at least waiting for libaom
and libwebm to produce complaint files first. Right now, they are not
writing anything in CodecPrivate.

See https://bugs.chromium.org/p/aomedia/issues/detail?id=2027
Hendrik Leppkes Aug. 20, 2018, 5:12 p.m. UTC | #2
On Mon, Aug 20, 2018 at 7:09 PM James Almer <jamrial@gmail.com> wrote:
>
> On 8/20/2018 1:44 PM, Kagami Hiiragi wrote:
> > Nothing prevents it to work except this check. AV1 is already supported
> > by Matroska muxer and aomenc produces WebM/AV1 files as well.
> >
> > Signed-off-by: Kagami Hiiragi <kagami@genshiken.org>
> >
> > diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> > index 09a62e1922..76cb124221 100644
> > --- a/libavformat/matroskaenc.c
> > +++ b/libavformat/matroskaenc.c
> > @@ -1296,11 +1296,12 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
> >
> >      if (mkv->mode == MODE_WEBM && !(par->codec_id == AV_CODEC_ID_VP8 ||
> >                                      par->codec_id == AV_CODEC_ID_VP9 ||
> > +                                    par->codec_id == AV_CODEC_ID_AV1 ||
> >                                      par->codec_id == AV_CODEC_ID_OPUS ||
> >                                      par->codec_id == AV_CODEC_ID_VORBIS ||
> >                                      par->codec_id == AV_CODEC_ID_WEBVTT)) {
> >          av_log(s, AV_LOG_ERROR,
> > -               "Only VP8 or VP9 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.\n");
> > +               "Only VP8 or VP9 or AV1 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.\n");
> >          return AVERROR(EINVAL);
> >      }
>
> I'm not against this, but i was thinking on at least waiting for libaom
> and libwebm to produce complaint files first. Right now, they are not
> writing anything in CodecPrivate.
>
> See https://bugs.chromium.org/p/aomedia/issues/detail?id=2027

Should definitely wait for the spec to be finalized before allowing
this, and only generate fully compliant files then.

- Hendrik
James Almer Sept. 21, 2018, 3:40 p.m. UTC | #3
On 8/20/2018 2:12 PM, Hendrik Leppkes wrote:
> On Mon, Aug 20, 2018 at 7:09 PM James Almer <jamrial@gmail.com> wrote:
>>
>> On 8/20/2018 1:44 PM, Kagami Hiiragi wrote:
>>> Nothing prevents it to work except this check. AV1 is already supported
>>> by Matroska muxer and aomenc produces WebM/AV1 files as well.
>>>
>>> Signed-off-by: Kagami Hiiragi <kagami@genshiken.org>
>>>
>>> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
>>> index 09a62e1922..76cb124221 100644
>>> --- a/libavformat/matroskaenc.c
>>> +++ b/libavformat/matroskaenc.c
>>> @@ -1296,11 +1296,12 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
>>>
>>>      if (mkv->mode == MODE_WEBM && !(par->codec_id == AV_CODEC_ID_VP8 ||
>>>                                      par->codec_id == AV_CODEC_ID_VP9 ||
>>> +                                    par->codec_id == AV_CODEC_ID_AV1 ||
>>>                                      par->codec_id == AV_CODEC_ID_OPUS ||
>>>                                      par->codec_id == AV_CODEC_ID_VORBIS ||
>>>                                      par->codec_id == AV_CODEC_ID_WEBVTT)) {
>>>          av_log(s, AV_LOG_ERROR,
>>> -               "Only VP8 or VP9 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.\n");
>>> +               "Only VP8 or VP9 or AV1 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.\n");
>>>          return AVERROR(EINVAL);
>>>      }
>>
>> I'm not against this, but i was thinking on at least waiting for libaom
>> and libwebm to produce complaint files first. Right now, they are not
>> writing anything in CodecPrivate.
>>
>> See https://bugs.chromium.org/p/aomedia/issues/detail?id=2027
> 
> Should definitely wait for the spec to be finalized before allowing
> this, and only generate fully compliant files then.
> 
> - Hendrik

libaom was updated to produce files compliant with the Matroska spec, so
i just applied this patch.

https://aomedia.googlesource.com/aom/+/ec0833fc9df73c0dc283e803881a121c395c4c5e
https://github.com/Matroska-Org/matroska-specification/blob/master/codec/av1.md
diff mbox

Patch

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 09a62e1922..76cb124221 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1296,11 +1296,12 @@  static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
 
     if (mkv->mode == MODE_WEBM && !(par->codec_id == AV_CODEC_ID_VP8 ||
                                     par->codec_id == AV_CODEC_ID_VP9 ||
+                                    par->codec_id == AV_CODEC_ID_AV1 ||
                                     par->codec_id == AV_CODEC_ID_OPUS ||
                                     par->codec_id == AV_CODEC_ID_VORBIS ||
                                     par->codec_id == AV_CODEC_ID_WEBVTT)) {
         av_log(s, AV_LOG_ERROR,
-               "Only VP8 or VP9 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.\n");
+               "Only VP8 or VP9 or AV1 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.\n");
         return AVERROR(EINVAL);
     }