From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id C6D7140B79 for ; Tue, 28 Dec 2021 01:29:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 611EC68B0C4; Tue, 28 Dec 2021 03:29:44 +0200 (EET) Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F2A8C68AFD4 for ; Tue, 28 Dec 2021 03:29:38 +0200 (EET) Received: by mail-pj1-f45.google.com with SMTP id v13-20020a17090a088d00b001b0e3a74cf7so12014975pjc.1 for ; Mon, 27 Dec 2021 17:29:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=uxNu5zWQvJxWoEEoAWJLwVw78uxrtTzq5KFLMbGbNsw=; b=GT0QuFvMEw8ilvtDMiapUmp6HSyuSqeb7JWUUFAvBTMlt55zBtGQw5k3SPl5j/bMYN qeRiUyfsGn6GLIDycmEVnHDgd0pCYD1GWTtueJeaZ32XgxtFaBNoJ+GfQmWuHs7bHT0O tn5VD8qG4H2se8OXzrj5ex4PTfykIgeZGNaaUCbC2QAZNF2nansSK80iQ086MlnEXFqv jWjEnBvlZ4iiafmjZan/1uGx7W/RPk0qlJGkS7Q7IPzDdo2KPBtdFu8Ga5PlvetDFi+D oK2pX43cSWTBrSKtWobEEeKbf4Nn746oA3A+faqfaCxFJ616muDQOgrzHovRRtLoC/4F fgrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to; bh=uxNu5zWQvJxWoEEoAWJLwVw78uxrtTzq5KFLMbGbNsw=; b=vfuOh4X400Thvw2QrKt9Lv6vlOnqdrdhBs5W57LAtgFE+FqQR8yPyzJ3WjH2JwJ9B5 ePGJnqy0nYiiUH8kmDJNkN6dIj3f0VkL+MTTW3BEF3yjMOkedSSbRaaF8nuf77qtxOAb LMDHlZ9uspIsdmx/8NNSAv5RumGFs1J7CggcyiA/a84GtEAaSRFd00myr6XcEUXx9K3w BXNxfD1J6mrkty+Fa7Tef1Wo3MUKsSlGbJdad/j4XrT+U2YOUjRypofSpleOCKS8ztRP w/yaLQDP7TO3nmZQxcJz5K6ldNwk8BEMMeKcWUPGIAydeQM3tLGqt5lcYT7SzYe+LfnG D+TQ== X-Gm-Message-State: AOAM532q4AZ2PdvgoPS0EkRXkGmiMyysDAhp1fPGrhN7xiIWLm4eMsYU 4KDaKTpgV57Ndd1nvV1Ygaws9CZU1HA= X-Google-Smtp-Source: ABdhPJyBFcNWrV2XHUfgSi1BqZJ/EThRDHLKdxsLX1js2V6gchY/hJgzMoeiVIE9IEjY4yeBURgRNQ== X-Received: by 2002:a17:90a:4987:: with SMTP id d7mr23330341pjh.22.1640654976907; Mon, 27 Dec 2021 17:29:36 -0800 (PST) Received: from gmail.com ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id y37sm15072611pga.78.2021.12.27.17.29.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Dec 2021 17:29:36 -0800 (PST) Date: Tue, 28 Dec 2021 09:29:31 +0800 From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Message-ID: <20211228012931.GA1764@gmail.com> Mail-Followup-To: ffmpeg-devel@ffmpeg.org References: <1640247094-9784-1-git-send-email-lance.lmwang@gmail.com> <1640443613-26238-1-git-send-email-lance.lmwang@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1640443613-26238-1-git-send-email-lance.lmwang@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH v2 1/2] avcodec/libx26[45]: add udu_sei option to import user data unregistered SEIs X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Sat, Dec 25, 2021 at 10:46:52PM +0800, lance.lmwang@gmail.com wrote: > From: Limin Wang > > Most of user data unregistered SEIs are privated data which defined by user/ > encoder. currently, the user data unregistered SEIs found in input are forwarded > as side-data to encoders directly, it'll cause the reencoded output including some > useless UDU SEIs. > > I prefer to add one option to enable/disable it and default is off after I saw > the patch by Andreas Rheinhardt: > > https://patchwork.ffmpeg.org/project/ffmpeg/patch/AM7PR03MB66607C2DB65E1AD49D975CF18F7B9@AM7PR03MB6660.eurprd03.prod.outlook.com/ > > How to test by cli: > ffmpeg -y -f lavfi -i testsrc -c:v libx264 -frames:v 1 a.ts > ffmpeg -y -i a.ts -c:v libx264 -udu_sei 1 b.ts > ffmpeg -y -i a.ts -c:v libx264 -udu_sei 0 c.ts > > # check the user data unregistered SEIs, you'll see two UDU SEIs for b.ts. > # and mediainfo will show with wrong encoding setting info > ffmpeg -i b.ts -vf showinfo -f null - > ffmpeg -i c.ts -vf showinfo -f null - > > This fixes tickets #9500 and #9557. > --- > doc/encoders.texi | 6 ++++++ > libavcodec/libx264.c | 5 ++++- > libavcodec/libx265.c | 4 ++++ > libavcodec/version.h | 2 +- > 4 files changed, 15 insertions(+), 2 deletions(-) > > diff --git a/doc/encoders.texi b/doc/encoders.texi > index 8a7589c..e3b61de 100644 > --- a/doc/encoders.texi > +++ b/doc/encoders.texi > @@ -2660,6 +2660,9 @@ ffmpeg -i foo.mpg -c:v libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv > Import closed captions (which must be ATSC compatible format) into output. > Only the mpeg2 and h264 decoders provide these. Default is 1 (on). > > +@item udu_sei @var{boolean} > +Import user data unregistered SEI if available into output. Default is 0 (off). > + > @item x264-params (N.A.) > Override the x264 configuration using a :-separated list of key=value > parameters. > @@ -2741,6 +2744,9 @@ Quantizer curve compression factor > Normally, when forcing a I-frame type, the encoder can select any type > of I-frame. This option forces it to choose an IDR-frame. > > +@item udu_sei @var{boolean} > +Import user data unregistered SEI if available into output. Default is 0 (off). > + > @item x265-params > Set x265 options using a list of @var{key}=@var{value} couples separated > by ":". See @command{x265 --help} for a list of options. > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > index 2b680ab..9836818 100644 > --- a/libavcodec/libx264.c > +++ b/libavcodec/libx264.c > @@ -104,6 +104,7 @@ typedef struct X264Context { > int chroma_offset; > int scenechange_threshold; > int noise_reduction; > + int udu_sei; > > AVDictionary *x264_params; > > @@ -464,6 +465,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, > } > } > > + if (x4->udu_sei) { > for (int j = 0; j < frame->nb_side_data; j++) { > AVFrameSideData *side_data = frame->side_data[j]; > void *tmp; > @@ -487,6 +489,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, > sei_payload->payload_type = SEI_TYPE_USER_DATA_UNREGISTERED; > sei->num_payloads++; > } > + } > } > > do { > @@ -1168,7 +1171,7 @@ static const AVOption options[] = { > { "chromaoffset", "QP difference between chroma and luma", OFFSET(chroma_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, VE }, > { "sc_threshold", "Scene change threshold", OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX, VE }, > { "noise_reduction", "Noise reduction", OFFSET(noise_reduction), AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX, VE }, > - > + { "udu_sei", "Use user data unregistered SEI if available", OFFSET(udu_sei), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, > { "x264-params", "Override the x264 configuration using a :-separated list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE }, > { NULL }, > }; > diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c > index 7dd70a3..47d0103 100644 > --- a/libavcodec/libx265.c > +++ b/libavcodec/libx265.c > @@ -54,6 +54,7 @@ typedef struct libx265Context { > > void *sei_data; > int sei_data_size; > + int udu_sei; > > /** > * If the encoder does not support ROI then warn the first time we > @@ -543,6 +544,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, > memcpy(x265pic.userData, &pic->reordered_opaque, sizeof(pic->reordered_opaque)); > } > > + if (ctx->udu_sei) { > for (i = 0; i < pic->nb_side_data; i++) { > AVFrameSideData *side_data = pic->side_data[i]; > void *tmp; > @@ -568,6 +570,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, > sei_payload->payloadType = SEI_TYPE_USER_DATA_UNREGISTERED; > sei->numPayloads++; > } > + } > } > > ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal, > @@ -708,6 +711,7 @@ static const AVOption options[] = { > { "preset", "set the x265 preset", OFFSET(preset), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, > { "tune", "set the x265 tune parameter", OFFSET(tune), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, > { "profile", "set the x265 profile", OFFSET(profile), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, > + { "udu_sei", "Use user data unregistered SEI if available", OFFSET(udu_sei), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, > { "x265-params", "set the x265 configuration using a :-separated list of key=value parameters", OFFSET(x265_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE }, > { NULL } > }; > diff --git a/libavcodec/version.h b/libavcodec/version.h > index 580b099..45c6d13 100644 > --- a/libavcodec/version.h > +++ b/libavcodec/version.h > @@ -29,7 +29,7 @@ > > #define LIBAVCODEC_VERSION_MAJOR 59 > #define LIBAVCODEC_VERSION_MINOR 15 > -#define LIBAVCODEC_VERSION_MICRO 101 > +#define LIBAVCODEC_VERSION_MICRO 102 > > #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ > LIBAVCODEC_VERSION_MINOR, \ > -- > 1.8.3.1 > plan to apply tomorrow unless there are objections. -- Thanks, Limin Wang _______________________________________________ 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".