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 ED144471AC for ; Tue, 25 Jun 2024 12:38:51 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9BF4C68D592; Tue, 25 Jun 2024 15:38:50 +0300 (EEST) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DC00068CFA2 for ; Tue, 25 Jun 2024 15:38:43 +0300 (EEST) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-7067435d376so1718443b3a.0 for ; Tue, 25 Jun 2024 05:38:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719319121; x=1719923921; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=kPyoUzPIyTYD0LDjbosLF5VBAq8Aaod6weyrKS5GUIM=; b=adA+LZTqjhEm8jojKYawWNlcaQVNbKBPBS2Glv4tEzpHBar60W5j/wdTDixWBQbs1N B0REGbGMi3ehpeunzAwrjb5hn4mRq+f3FkYY2rHocIsCVoaQXeDZ5s5yK6+b9rmoTe+z a87Vad4L9J+uZl429Loqt256PQUKffIjHYk47fJ9/TqVElxpZYzSlXAlfHXJrv/2Kywn 7KgfcRtWbGgxq1zbUZbqpbqd+pz3iNZAkr4vqPGO1G3xgJJe9hCUGuyi4qi4K0pgkjOT yFAjs0QlaiP62T590mY15JF2r68XjSBDJu4bYD04brJFxPZMhtHdrMU8dv4DO29vYE2d vEaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719319121; x=1719923921; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kPyoUzPIyTYD0LDjbosLF5VBAq8Aaod6weyrKS5GUIM=; b=Cp+gEivy5kQ2u/tWIBeUePN8L2i8KQ4UGWVte4uooDKp/ExTeUYU7RptL//xpiLB2e Ga0t6JPMGGorL0vxlmPfOaaG2GKHZjArN/gVObpuDcUAW3qG+6oZSmXuw4HvB6c8iYB4 sBEToSAiIB0gocW+Fbaj5I2+gOBSKNv+QSPJZAzbcr8P3uDZHmpENl0oLtQvcCV0ei/y kW2QGHB+3zPxi3mwT0aScTvz4FQWF2CIplpOhB/6ssoi75w6o05kDw7nXOfD2QdaqkRD CUjU7C8S/8OcrIoFEb8HPrlhaFIPlqMV4U61YTLxygMljNDAUtmVW26BdIc7dtGVFB/N 3XrQ== X-Gm-Message-State: AOJu0YwMV6ar2dKz4EwgqW2Mjyf9qX382t5YPQ4avDWsbwyM2yHnqC4j SPuDtBum47NXFPytWfeSR2Gbtu+a3eXSt0VUSA0jD+pNp3MkB9BrIh32vA== X-Google-Smtp-Source: AGHT+IFnkDmvJB05pemW9K99S3NdLLx3I+wljv2LEji1QzxT1K+frp+LewCmKQYz5sjboNslu6H8bA== X-Received: by 2002:a05:6a00:2d4:b0:706:1bb3:fb1d with SMTP id d2e1a72fcca58-70669d4247fmr10372430b3a.7.1719319120877; Tue, 25 Jun 2024 05:38:40 -0700 (PDT) Received: from [192.168.0.16] ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7068248ffbdsm3946773b3a.19.2024.06.25.05.38.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Jun 2024 05:38:40 -0700 (PDT) Message-ID: Date: Tue, 25 Jun 2024 09:38:58 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <20240530225757.GG2821752@pb2> <20240530232251.3538-1-jamrial@gmail.com> <171931112129.21847.16787893012767512029@lain.khirnov.net> Content-Language: en-US From: James Almer In-Reply-To: <171931112129.21847.16787893012767512029@lain.khirnov.net> Subject: Re: [FFmpeg-devel] [PATCH 1/2 v2] fftools/ffmpeg: support applying container level cropping 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 6/25/2024 7:25 AM, Anton Khirnov wrote: > Quoting James Almer (2024-05-31 01:22:51) >> @@ -1000,11 +1001,21 @@ int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple, >> ist->filters[ist->nb_filters - 1] = ifilter; >> >> if (ist->par->codec_type == AVMEDIA_TYPE_VIDEO) { >> + const AVPacketSideData *sd = av_packet_side_data_get(ist->par->coded_side_data, >> + ist->par->nb_coded_side_data, >> + AV_PKT_DATA_FRAME_CROPPING); >> if (ist->framerate.num > 0 && ist->framerate.den > 0) { >> opts->framerate = ist->framerate; >> opts->flags |= IFILTER_FLAG_CFR; >> } else >> opts->framerate = av_guess_frame_rate(d->f.ctx, ist->st, NULL); >> + if (sd && sd->size == sizeof(uint32_t) * 4) { >> + opts->crop_top = AV_RL32(sd->data + 0); >> + opts->crop_bottom = AV_RL32(sd->data + 4); >> + opts->crop_left = AV_RL32(sd->data + 8); >> + opts->crop_right = AV_RL32(sd->data + 12); >> + opts->flags |= IFILTER_FLAG_CROP; >> + } >> } else if (ist->par->codec_type == AVMEDIA_TYPE_SUBTITLE) { >> /* Compute the size of the canvas for the subtitles stream. >> If the subtitles codecpar has set a size, use it. Otherwise use the >> @@ -1241,6 +1252,9 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st) >> ds->autorotate = 1; >> MATCH_PER_STREAM_OPT(autorotate, i, ds->autorotate, ic, st); >> >> + ds->apply_cropping = 1; >> + MATCH_PER_STREAM_OPT(apply_cropping, i, ds->apply_cropping, ic, st); >> + >> MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, ic, st); >> if (codec_tag) { >> uint32_t tag = strtol(codec_tag, &next, 0); >> @@ -1362,6 +1376,8 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st) >> >> ds->dec_opts.flags |= DECODER_FLAG_BITEXACT * !!o->bitexact; >> >> + av_dict_set_int(&ds->decoder_opts, "apply_cropping", ds->apply_cropping, 0); > > If I'm reading it right, this new option now applies only to decoder > cropping (breaking syntax, because AVOptions always take an argument), > while container cropping is always applied unconditionally. > > That seems wrong. Yeah, for some reason i missed a "* !!ds->apply_cropping" next to the IFILTER_FLAG_CROP above. With it container cropping is applied depending on the value of apply_cropping. And how can i work around the ffmpeg option shadowing the avcodec one of the same name? Using a different name for container cropping option exclusively in ffmpeg is not really nice for the user. They either care about cropping no matter the source, or no cropping. _______________________________________________ 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".