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 409F84AED3 for ; Tue, 25 Jun 2024 10:19:58 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A9AB668D3FA; Tue, 25 Jun 2024 13:19:55 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A2CB668C41D for ; Tue, 25 Jun 2024 13:19:49 +0300 (EEST) Authentication-Results: mail0.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=YM3XKsBF; dkim-atps=neutral Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 3B1F5240DAC for ; Tue, 25 Jun 2024 12:19:49 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 6a2ga9j5Rgij for ; Tue, 25 Jun 2024 12:19:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1719310788; bh=mO38CJ6F7T5m2+fUn949SszvexzHnV/NYO3Kyk/000w=; h=Subject:From:To:In-Reply-To:References:Date:From; b=YM3XKsBFe24uEhJt/diE/2lgN2XcK2rY78r4z/L9tSExUnx8PcQqbjcX3uSOBnZbJ ZyEabmfFjWFyidW1pvlfjQaBdwf5cRexIlCpu2y/3E4LDprohN3s3qB/BBn4EguDQk vQZPDhtBr5u8xuXnBMoXDzGHj5BeeRA4PmWFI7oryG7NfIDwl0cmhBguZzJF411/HM xdfcdhRyKLrkt/rNIBXXR+stzhtdW9vujswCslqGTbX6MQ//TQaA7eeMDjSgMV59oo sle+fQM/HkGj2kCJG1GMVnHmAJ71k1cZc8UFMotj+m7NZQmubjDxpZZlZPFsQ0Z8Ho L0JQeCercSY6w== Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 9EAB42404E5 for ; Tue, 25 Jun 2024 12:19:48 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id 705BD1601B9; Tue, 25 Jun 2024 12:19:42 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <20240529214632.9843-5-jamrial@gmail.com> References: <20240529214632.9843-1-jamrial@gmail.com> <20240529214632.9843-5-jamrial@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches Date: Tue, 25 Jun 2024 12:19:42 +0200 Message-ID: <171931078242.21847.5755059493417163903@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 5/6] 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-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: Quoting James Almer (2024-05-29 23:46:31) > @@ -254,6 +256,11 @@ typedef struct InputFilterOptions { > * accurate */ > AVRational framerate; > > + unsigned crop_top; > + unsigned crop_bottom; > + unsigned crop_left; > + unsigned crop_right; breaks vertical alignment > + > int sub2video_width; > int sub2video_height; > > diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c > index 1ca8d804ae..4178b8f840 100644 > --- a/fftools/ffmpeg_demux.c > +++ b/fftools/ffmpeg_demux.c > @@ -66,6 +66,7 @@ typedef struct DemuxStream { > int have_sub2video; > int reinit_filters; > int autorotate; > + int apply_cropping; > > > int wrap_correction_done; > @@ -1000,11 +1001,20 @@ 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->st->codecpar->coded_side_data, > + ist->st->codecpar->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) { better make it <= to account for future extensions, e.g. we might want to add sub-pixel resolution in there > diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c > index 910e4a336b..0c50ce16ba 100644 > --- a/fftools/ffmpeg_opt.c > +++ b/fftools/ffmpeg_opt.c > @@ -1732,6 +1732,9 @@ const OptionDef options[] = { > { "autoscale", OPT_TYPE_BOOL, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT, > { .off = OFFSET(autoscale) }, > "automatically insert a scale filter at the end of the filter graph" }, > + { "apply_cropping", OPT_TYPE_BOOL, OPT_PERSTREAM | OPT_EXPERT | OPT_INPUT, > + { .off = OFFSET(apply_cropping) }, > + "apply frame cropping" }, Apply container-level cropping (in addition to codec-level cropping) Also, missing docs. -- Anton Khirnov _______________________________________________ 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".