[FFmpeg-devel] [PATCH 1/3] avcodec/proresenc: switch default prores encoder to prores_ks

Paul B Mahol onemda at gmail.com
Tue Jun 27 11:38:47 EEST 2017


On 6/27/17, Michael Niedermayer <michael at niedermayer.cc> wrote:
> On Tue, Jun 27, 2017 at 12:20:05AM +0200, Paul B Mahol wrote:
>> On 6/27/17, Michael Niedermayer <michael at niedermayer.cc> wrote:
>> > On Mon, Jun 26, 2017 at 11:55:35PM +0200, Paul B Mahol wrote:
>> >> Rationale:
>> >> prores_ks have more features and is faster for qscale > 0
>> >> and gives better quality output.
>> >>
>> >> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>> >> ---
>> >>  libavcodec/Makefile             |  2 +-
>> >>  libavcodec/proresenc_anatoliy.c | 14 --------------
>> >>  libavcodec/proresenc_kostya.c   | 24 ++++++++++++++++++++++++
>> >>  tests/fate/vcodec.mak           |  1 +
>> >>  tests/ref/vsynth/vsynth1-prores |  8 ++++----
>> >>  tests/ref/vsynth/vsynth2-prores |  8 ++++----
>> >>  tests/ref/vsynth/vsynth3-prores |  8 ++++----
>> >>  7 files changed, 38 insertions(+), 27 deletions(-)
>> >>
>> >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>> >> index f0cba88..16dce40 100644
>> >> --- a/libavcodec/Makefile
>> >> +++ b/libavcodec/Makefile
>> >> @@ -477,7 +477,7 @@ OBJS-$(CONFIG_PPM_DECODER)             += pnmdec.o
>> >> pnm.o
>> >>  OBJS-$(CONFIG_PPM_ENCODER)             += pnmenc.o
>> >>  OBJS-$(CONFIG_PRORES_DECODER)          += proresdec2.o proresdsp.o
>> >> proresdata.o
>> >>  OBJS-$(CONFIG_PRORES_LGPL_DECODER)     += proresdec_lgpl.o
>> >> proresdsp.o
>> >> proresdata.o
>> >> -OBJS-$(CONFIG_PRORES_ENCODER)          += proresenc_anatoliy.o
>> >> +OBJS-$(CONFIG_PRORES_ENCODER)          += proresenc_kostya.o
>> >> proresdata.o
>> >>  OBJS-$(CONFIG_PRORES_AW_ENCODER)       += proresenc_anatoliy.o
>> >>  OBJS-$(CONFIG_PRORES_KS_ENCODER)       += proresenc_kostya.o
>> >> proresdata.o
>> >>  OBJS-$(CONFIG_PSD_DECODER)             += psd.o
>> >> diff --git a/libavcodec/proresenc_anatoliy.c
>> >> b/libavcodec/proresenc_anatoliy.c
>> >> index 0516066..7ff6ff7 100644
>> >> --- a/libavcodec/proresenc_anatoliy.c
>> >> +++ b/libavcodec/proresenc_anatoliy.c
>> >> @@ -614,17 +614,3 @@ AVCodec ff_prores_aw_encoder = {
>> >>      .capabilities   = AV_CODEC_CAP_FRAME_THREADS |
>> >> AV_CODEC_CAP_INTRA_ONLY,
>> >>      .profiles       = profiles
>> >>  };
>> >> -
>> >> -AVCodec ff_prores_encoder = {
>> >> -    .name           = "prores",
>> >> -    .long_name      = NULL_IF_CONFIG_SMALL("Apple ProRes"),
>> >> -    .type           = AVMEDIA_TYPE_VIDEO,
>> >> -    .id             = AV_CODEC_ID_PRORES,
>> >> -    .priv_data_size = sizeof(ProresContext),
>> >> -    .init           = prores_encode_init,
>> >> -    .close          = prores_encode_close,
>> >> -    .encode2        = prores_encode_frame,
>> >> -    .pix_fmts       = (const enum
>> >> AVPixelFormat[]){AV_PIX_FMT_YUV422P10,
>> >> AV_PIX_FMT_NONE},
>> >> -    .capabilities   = AV_CODEC_CAP_FRAME_THREADS |
>> >> AV_CODEC_CAP_INTRA_ONLY,
>> >> -    .profiles       = profiles
>> >> -};
>> >> diff --git a/libavcodec/proresenc_kostya.c
>> >> b/libavcodec/proresenc_kostya.c
>> >> index 09bb611..ad979c2 100644
>> >> --- a/libavcodec/proresenc_kostya.c
>> >> +++ b/libavcodec/proresenc_kostya.c
>> >> @@ -1341,6 +1341,13 @@ static const AVClass proresenc_class = {
>> >>      .version    = LIBAVUTIL_VERSION_INT,
>> >>  };
>> >>
>> >> +static const AVClass prores_class = {
>> >> +    .class_name = "ProRes",
>> >> +    .item_name  = av_default_item_name,
>> >> +    .option     = options,
>> >> +    .version    = LIBAVUTIL_VERSION_INT,
>> >> +};
>> >> +
>> >>  AVCodec ff_prores_ks_encoder = {
>> >>      .name           = "prores_ks",
>> >>      .long_name      = NULL_IF_CONFIG_SMALL("Apple ProRes (iCodec
>> >> Pro)"),
>> >> @@ -1357,3 +1364,20 @@ AVCodec ff_prores_ks_encoder = {
>> >>                        },
>> >>      .priv_class     = &proresenc_class,
>> >>  };
>> >> +
>> >> +AVCodec ff_prores_encoder = {
>> >> +    .name           = "prores",
>> >> +    .long_name      = NULL_IF_CONFIG_SMALL("Apple ProRes (iCodec
>> >> Pro)"),
>> >> +    .type           = AVMEDIA_TYPE_VIDEO,
>> >> +    .id             = AV_CODEC_ID_PRORES,
>> >> +    .priv_data_size = sizeof(ProresContext),
>> >> +    .init           = encode_init,
>> >> +    .close          = encode_close,
>> >> +    .encode2        = encode_frame,
>> >> +    .capabilities   = AV_CODEC_CAP_SLICE_THREADS |
>> >> AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_INTRA_ONLY,
>> >> +    .pix_fmts       = (const enum AVPixelFormat[]) {
>> >> +                          AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
>> >> +                          AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_NONE
>> >> +                      },
>> >> +    .priv_class     = &prores_class,
>> >> +};
>> >> diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak
>> >> index 8c24510..3e92f3c 100644
>> >> --- a/tests/fate/vcodec.mak
>> >> +++ b/tests/fate/vcodec.mak
>> >> @@ -329,6 +329,7 @@ fate-vsynth%-mpng:               CODEC   = png
>> >>  FATE_VCODEC-$(call ENCDEC, MSVIDEO1, AVI) += msvideo1
>> >>
>> >>  FATE_VCODEC-$(call ENCDEC, PRORES, MOV) += prores prores_ks
>> >> +fate-vsynth%-prores:             ENCOPTS = -qscale:v 1
>> >>  fate-vsynth%-prores:             FMT     = mov
>> >>
>> >>  fate-vsynth%-prores_ks:          ENCOPTS = -profile hq
>> >
>> >> diff --git a/tests/ref/vsynth/vsynth1-prores
>> >> b/tests/ref/vsynth/vsynth1-prores
>> >> index 14de8b9..bf7adaa 100644
>> >> --- a/tests/ref/vsynth/vsynth1-prores
>> >> +++ b/tests/ref/vsynth/vsynth1-prores
>> >> @@ -1,4 +1,4 @@
>> >> -7ca7d2f9f5d8ac2ead691b1b6a70d409 *tests/data/fate/vsynth1-prores.mov
>> >> -5022821 tests/data/fate/vsynth1-prores.mov
>> >> -fb4a9e025d12afc0dbbca8d82831858f
>> >> *tests/data/fate/vsynth1-prores.out.rawvideo
>> >> -stddev:    2.47 PSNR: 40.27 MAXDIFF:   31 bytes:  7603200/  7603200
>> >> +58d0065f5a67a7fa70e7443ac82c336d *tests/data/fate/vsynth1-prores.mov
>> >> +10690091 tests/data/fate/vsynth1-prores.mov
>> >> +b059fbb85caccfb6e5ad7fe402e2539b
>> >> *tests/data/fate/vsynth1-prores.out.rawvideo
>> >> +stddev:    1.88 PSNR: 42.64 MAXDIFF:   29 bytes:  7603200/  7603200
>> >> diff --git a/tests/ref/vsynth/vsynth2-prores
>> >> b/tests/ref/vsynth/vsynth2-prores
>> >> index a1b4bb7..6e9a397 100644
>> >> --- a/tests/ref/vsynth/vsynth2-prores
>> >> +++ b/tests/ref/vsynth/vsynth2-prores
>> >> @@ -1,4 +1,4 @@
>> >> -aa57fd1221b7eefaf1f34f9d57d6a7cb *tests/data/fate/vsynth2-prores.mov
>> >> -3265056 tests/data/fate/vsynth2-prores.mov
>> >> -537b0ff66d7c8c3c12faa89d042e6a49
>> >> *tests/data/fate/vsynth2-prores.out.rawvideo
>> >> -stddev:    1.38 PSNR: 45.29 MAXDIFF:   12 bytes:  7603200/  7603200
>> >> +4240da05dc68221a36071cbe3a846877 *tests/data/fate/vsynth2-prores.mov
>> >> +8463884 tests/data/fate/vsynth2-prores.mov
>> >> +0ed1c1b659beb23928388a34a988786b
>> >> *tests/data/fate/vsynth2-prores.out.rawvideo
>> >> +stddev:    0.47 PSNR: 54.57 MAXDIFF:    9 bytes:  7603200/  7603200
>> >> diff --git a/tests/ref/vsynth/vsynth3-prores
>> >> b/tests/ref/vsynth/vsynth3-prores
>> >> index f63a7a7..f772805 100644
>> >> --- a/tests/ref/vsynth/vsynth3-prores
>> >> +++ b/tests/ref/vsynth/vsynth3-prores
>> >> @@ -1,4 +1,4 @@
>> >> -b060c59be88b4b089ece5ee8dc4f1c58 *tests/data/fate/vsynth3-prores.mov
>> >> -105367 tests/data/fate/vsynth3-prores.mov
>> >> -fff5e7ad21d78501c8fa4749bf4bf289
>> >> *tests/data/fate/vsynth3-prores.out.rawvideo
>> >> -stddev:    2.80 PSNR: 39.17 MAXDIFF:   27 bytes:    86700/    86700
>> >> +5919b3ca66dd7b5f37fd30e82e033fad *tests/data/fate/vsynth3-prores.mov
>> >> +196893 tests/data/fate/vsynth3-prores.mov
>> >> +81df91f1f0fd6693ff89c7743df631ea
>> >> *tests/data/fate/vsynth3-prores.out.rawvideo
>> >> +stddev:    2.15 PSNR: 41.46 MAXDIFF:   26 bytes:    86700/    86700
>> >
>> > The new files from these tests are higher quality but they are also
>> > much higher bitrate and larger
>> >
>> > does prores_ks produce higher quality at the same bitrate ?
>>
>> How you can claim anything with those synthetic videos?
>
> you claimed its higher quality:
> "and gives better quality output."

Yes. It supports yuv(a)444p10, is that better quality or what?

>
> Id like to reproduce this to ensure we keep the encoder with better
> quality
> I did not mean the synthetic videos in particular, that was just what
> i saw in the commit. There were no other quality statistics
>
> allthough it seems strange to me if one encoder was better quality on
> real life videos but worse on synthetic ones.

When I match profile, pixel format and bitrate very small win goes to
aw encoder.
I see no reason to keep it even in that case as aw one does not
support any bitrate
control besides its profiles. So using -qscale gives always same output.


More information about the ffmpeg-devel mailing list