diff mbox series

[FFmpeg-devel,1/2] avformat/movenc: Add movie_timescale option to AVIF

Message ID 20230104221619.919110-1-vigneshv@google.com
State Accepted
Commit f2b175087197e983ac13e4c8c554b1b2f42612e0
Headers show
Series [FFmpeg-devel,1/2] avformat/movenc: Add movie_timescale option to AVIF | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Vignesh Venkat Jan. 4, 2023, 10:16 p.m. UTC
Allow specifying the movie_timescale options to AVIF ouptut.

This also makes sure that when movie_timescale is not specified,
the default value of 1000 is used instead of 0. Animated AVIF
files which don't specify the movie_timescale will have the
correct duration written in the track and movie headers after this
change (instead of writing 0).

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
---
 libavformat/movenc.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Zhao Zhili Jan. 5, 2023, 9:34 a.m. UTC | #1
> On Jan 5, 2023, at 06:16, Vignesh Venkatasubramanian <vigneshv-at-google.com@ffmpeg.org> wrote:
> 
> Allow specifying the movie_timescale options to AVIF ouptut.
> 
> This also makes sure that when movie_timescale is not specified,
> the default value of 1000 is used instead of 0. Animated AVIF
> files which don't specify the movie_timescale will have the
> correct duration written in the track and movie headers after this
> change (instead of writing 0).
> 
> Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
> ---
> libavformat/movenc.c | 6 ++++++
> 1 file changed, 6 insertions(+)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 7d49892283..36c76f7f60 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -7758,6 +7758,11 @@ static const AVCodecTag codec_f4v_tags[] = {
> };
> 
> #if CONFIG_AVIF_MUXER
> +
> +static const AVOption avif_options[] = {
> +    { "movie_timescale", "set movie timescale", offsetof(MOVMuxContext, movie_timescale), AV_OPT_TYPE_INT, {.i64 = MOV_TIMESCALE}, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
> +    { NULL },
> +};

If there is a chance to add more options which is shared with
mov_isobmff_muxer_class, define a common option to avoid
duplication. Otherwise keep it as this.

> static const AVCodecTag codec_avif_tags[] = {
>     { AV_CODEC_ID_AV1,     MKTAG('a','v','0','1') },
>     { AV_CODEC_ID_NONE, 0 },
> @@ -7767,6 +7772,7 @@ static const AVCodecTag *const codec_avif_tags_list[] = { codec_avif_tags, NULL
> static const AVClass mov_avif_muxer_class = {
>     .class_name = "avif muxer",
>     .item_name  = av_default_item_name,
> +    .option     = avif_options,
>     .version    = LIBAVUTIL_VERSION_INT,
> };
> #endif
> -- 
> 2.39.0.314.g84b9a713c41-goog
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Vignesh Venkat Jan. 5, 2023, 5:26 p.m. UTC | #2
On Thu, Jan 5, 2023 at 1:34 AM "zhilizhao(赵志立)" <quinkblack@foxmail.com> wrote:
>
>
>
> > On Jan 5, 2023, at 06:16, Vignesh Venkatasubramanian <vigneshv-at-google.com@ffmpeg.org> wrote:
> >
> > Allow specifying the movie_timescale options to AVIF ouptut.
> >
> > This also makes sure that when movie_timescale is not specified,
> > the default value of 1000 is used instead of 0. Animated AVIF
> > files which don't specify the movie_timescale will have the
> > correct duration written in the track and movie headers after this
> > change (instead of writing 0).
> >
> > Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
> > ---
> > libavformat/movenc.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > index 7d49892283..36c76f7f60 100644
> > --- a/libavformat/movenc.c
> > +++ b/libavformat/movenc.c
> > @@ -7758,6 +7758,11 @@ static const AVCodecTag codec_f4v_tags[] = {
> > };
> >
> > #if CONFIG_AVIF_MUXER
> > +
> > +static const AVOption avif_options[] = {
> > +    { "movie_timescale", "set movie timescale", offsetof(MOVMuxContext, movie_timescale), AV_OPT_TYPE_INT, {.i64 = MOV_TIMESCALE}, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
> > +    { NULL },
> > +};
>
> If there is a chance to add more options which is shared with
> mov_isobmff_muxer_class, define a common option to avoid
> duplication. Otherwise keep it as this.
>

As of now, this is the only one that's being repeated. I think we can
make a common option if we decide to copy over more from the
mov_isobmff_muxer_class.

> > static const AVCodecTag codec_avif_tags[] = {
> >     { AV_CODEC_ID_AV1,     MKTAG('a','v','0','1') },
> >     { AV_CODEC_ID_NONE, 0 },
> > @@ -7767,6 +7772,7 @@ static const AVCodecTag *const codec_avif_tags_list[] = { codec_avif_tags, NULL
> > static const AVClass mov_avif_muxer_class = {
> >     .class_name = "avif muxer",
> >     .item_name  = av_default_item_name,
> > +    .option     = avif_options,
> >     .version    = LIBAVUTIL_VERSION_INT,
> > };
> > #endif
> > --
> > 2.39.0.314.g84b9a713c41-goog
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 7d49892283..36c76f7f60 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -7758,6 +7758,11 @@  static const AVCodecTag codec_f4v_tags[] = {
 };
 
 #if CONFIG_AVIF_MUXER
+
+static const AVOption avif_options[] = {
+    { "movie_timescale", "set movie timescale", offsetof(MOVMuxContext, movie_timescale), AV_OPT_TYPE_INT, {.i64 = MOV_TIMESCALE}, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
+    { NULL },
+};
 static const AVCodecTag codec_avif_tags[] = {
     { AV_CODEC_ID_AV1,     MKTAG('a','v','0','1') },
     { AV_CODEC_ID_NONE, 0 },
@@ -7767,6 +7772,7 @@  static const AVCodecTag *const codec_avif_tags_list[] = { codec_avif_tags, NULL
 static const AVClass mov_avif_muxer_class = {
     .class_name = "avif muxer",
     .item_name  = av_default_item_name,
+    .option     = avif_options,
     .version    = LIBAVUTIL_VERSION_INT,
 };
 #endif