From patchwork Fri Dec 10 21:36:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soft Works X-Patchwork-Id: 32263 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp2371976iog; Fri, 10 Dec 2021 13:37:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvGTtTk603hGclqDtPfz3EkWFPNExGJwsXpB6qWzkEI00vL81zTbdOZtSx7+iboik7tmGS X-Received: by 2002:a05:6402:1e8b:: with SMTP id f11mr42692179edf.304.1639172236812; Fri, 10 Dec 2021 13:37:16 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dr22si8110646ejc.562.2021.12.10.13.37.15; Fri, 10 Dec 2021 13:37:16 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@hotmail.com header.s=selector1 header.b=nsrGhh57; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hotmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 38E5C68AF13; Fri, 10 Dec 2021 23:37:11 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07olkn2070.outbound.protection.outlook.com [40.92.43.70]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 58E2668AD86 for ; Fri, 10 Dec 2021 23:37:04 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fjZMRpdPFK8FmCMzeQj/8rSFS17p8ovmz6cOh8diQqHJK2uiEfOsZul5SYX6BUpmUnUe+cTHwJUTX/IvQM/XswJcnS3yJQ6cYleB9Fly4p1CxdFBrDLheawOFM96cLE3h/6spP80aSLoIOcpV7VuC8JteAcblcXNL3RyFiy/yqdQktLkSX9xpPZQEVujc2KV4cnu1QucZAeBvDp+IURn6YDOx/+nWxBIKbluG8YAkVq5Ft3DfZZ7wUflAk4rFBt+4xf7lagy8UByneBE1JPxfA9M0Qj9nyA7ipoJimsY+MQOq3+BX/PHV2/tPJ70rcK/EJhflsNsVrDRdvt61D0b9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1qCdnbEuR8Uj1wjMbn0Lx48/3cTwtpzZMbFAIeAk6nk=; b=GkNOR5JbaeFlO0LlcNCzud3II5bWZN9Jic1i5+A6d9hQnCX5Ow3Ds2Y0loMXyff5rHdmIKEuitlMBewiDhKiPFQhz89wf1YLadH7OpXxK0FQpoywsnHmL97Oxj21XgtoCguKz3ZRFthjr9hC+lpi10I2aO8NTxYdiw8RaI6ECDeP5InLDzkRYRkir5fbFdSwF6TW30OLBKFT/Jf3f4zGm6JsAhLggwKSxrFQ8U9VzD/PgES1YdXeHnxCO6p+3J2e0/lVC5mdl19EQuvuNaFux21tpq70WsGoKkrH7gRZr7pZ8m68xZw6i6KM/HNlWAYESxtqgdd4xxHl/vzFkg3NCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1qCdnbEuR8Uj1wjMbn0Lx48/3cTwtpzZMbFAIeAk6nk=; b=nsrGhh57tdA/4DY/ZCdprx102siy3qAUcUNKI+dW+l4IAK6zsYHkFyHzrf9IDgNK4LTpLlFXJVTujSc6YZ1hX4/+HkSl/I9LzEHLS91klqVJ4sF+8f26E92ls0muGxHpSz5bStUcpUnXEMw9ayeGiHrMWbiO1Nix//lwbIxH0ReVII3/VRQXNVRJ/h9ezD9DlhASzxkCo5kcWJrytDI6NHsioSQepR3J+iuCW48a87LoUsN7ZoGhc/1oh+yMNlf5YZnmILw06CtsLT+Dfy0KtFVZ8hF5kBXeUpte1UP8OtUmgfTnnnQVcw9Umr5jPHISn8dKCVaDCX2rjmGTbgZf0Q== Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:b::20) by DM8P223MB0240.NAMP223.PROD.OUTLOOK.COM (2603:10b6:5:316::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Fri, 10 Dec 2021 21:36:56 +0000 Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::9c8d:fc63:9488:9775]) by DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::9c8d:fc63:9488:9775%7]) with mapi id 15.20.4778.015; Fri, 10 Dec 2021 21:36:56 +0000 From: Soft Works To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH v23 00/21] Subtitle Filtering Thread-Index: AQFtriecOYyoxwFRDEBNTMdTNzEa1AE5VPU2 Date: Fri, 10 Dec 2021 21:36:56 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [hfi+HKGPfgxj5miqpidp9grZ8ShmABTH] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 194c287d-8ceb-441d-9fa3-08d9bc2530ad x-ms-traffictypediagnostic: DM8P223MB0240:EE_ x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: sM4R0NN0RTu6ExhNkWFM6fSAVmefCYiIKkACeXGhUZAssct5eFWi3ljncDUJI7bM5sy3RV/s+Tu0Yykbizi7h8fESlfN11DAhZG/xTvdUxPnNAUO375Ga74GAgktbuo8RI16xsdwB86g6iCqzQCgff/T3BBxV5K7cKNbljAPEy7aHaKQlTVRE7QZdrIVWa0ggFQ/TbTabZJiNCHGELgC8x4ttnFNqJH7WY9qaEiSoE/6G2LFXMVDHOqf4b1Il9K6xHfJhOG8jSvn+CWT4qnX26zW35ZvWbOHspPfxKdj3fT08G55KgJG96ogfwUj9L0/k/XRqcx7d0iUbHh7QHVUKFvQdNGFTKloQSDfMjmiW+M5/V3HnK+f64cM1DDa9mq8lnt69uz/tnO8+TAJZfdHXes0UyUgEvb/AMMrrjoDpUapLciH3Veb871L3N9I8RAy6O5+v05CBi2q3OnFGPCCcHjQJ8Xw/CRwD6NOAkjVj3pu3yBRMrvP/s7LlndehWEnGqCsCk7PHYLjH+KHUgAZxdOXwyNfbcVt3caKOojajb78BJ2hwUaYpPUsD1vTsYiVlf8EUm+kdoonRwOYYpBwng== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?7JU32q/mHh3eSkjq1Icj+eOmuBtQ?= =?utf-8?q?VOX2U/jVuIrOs9FBpDoAwI8k4IPJ171zNWMgXe62qLobb5y4oK8PF3OHxGSvks/Gm?= =?utf-8?q?YvCoqIBfZu8P33sT7pZNJRvexdp/pi05wAtIj+DHn2JwmqhFFveSLFrM/ogVWnTs4?= =?utf-8?q?2nGCqWLrLwoTo8HeD75/y+fAKOD8J1xu295Wyrt3ZGjrb0cGVW5u3SSrL2efps8Tb?= =?utf-8?q?RnRE5+m+sWo8SKU+wp1KNSyYzkFrYDZE3/fWfBJRqHRdyzUr82e+VauuayVtPCxsg?= =?utf-8?q?vIWeG7H2lWPYmFa4LJg3JmntZ+rWYKxs+oMGetNAz2X6cK3WXX1ru7blFLF9tL16s?= =?utf-8?q?J+7H+swYo9lWSjJj1YZFKqxVpMK3wc0BPHu3MBwgEYKP6F8wWvxIFgPaJdp4BhNDv?= =?utf-8?q?Pc8Wwcy1OeQNb3Er5fO2CMI6VouJbacbTw01dXCeLOtZK5FGIeG1+hAzR0Om+7iBl?= =?utf-8?q?ELdQCpS+xxX91joI+VP7WkVlbz/7ScsI0sGWLIY8pW2C303SE8sWbnK5UQhRU/4sb?= =?utf-8?q?D932NSRIWmBPtY/xfO5rwWdhJa30HohP4cEDbgwaraUr7q3BJTiqnU3y8KQmEXBlA?= =?utf-8?q?MH7cMD1NiBolu5kTenKhXmT28h4da7S1PIDD/5syoNy/Z1yj67qFXh15FNJBnNqD9?= =?utf-8?q?owwseY/ofQdazFI+qjv8dPHlRub1K5aoleNiFW1Kf1kFCOIyXJfsn0sL177IigGu4?= =?utf-8?q?t/VUEV4ZLi6nEQto8uuU+jCeRIna4Gm5Pfcv/VHJG6aK1NS0gejqlSwHu5yLMJCTO?= =?utf-8?q?4TwCU9yFyIyLIf3/guQgkxRHm4dycAptDcZIDj7QZrvKZVXOofwAPodC0oJmc/5QF?= =?utf-8?q?IxczoeFceIViFnpShktbgRocD29pbWRbJnQdkpEjvrOtkYTHVzF2+sftyBMHH0Wo5?= =?utf-8?q?xhVx2biWmEQdAIVjxlUZdpCzV4FrHP8LAVEq0GkyiPag=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-1ff67.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 194c287d-8ceb-441d-9fa3-08d9bc2530ad X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Dec 2021 21:36:56.5137 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8P223MB0240 Subject: [FFmpeg-devel] [PATCH v23 00/21] Subtitle Filtering 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: BSCx7JOIMdDD New in V22 - subfmt.h: Fix includes, use #if rather than #ifdef - subfmt.c: Remove unused struct - move addition of ass hard_space callback to commit 5 - also add ass extensibility callback - remove bugfix commits regarding ass hard-space due to being incompatible with GIT e-mail workflow New in V22 - Two new commits, implementing parsing of hard-space ASS tags (\h} The ccaption_dec decoder emits a lot of \h tags via splitcc which the encoders (all using ass_split) didn't handle properly - Combined APIchanges and version bumps into a single commit at the end - Moved new fields to end of AVFrame - Changed version bumps as suggested => no more major bumps now! New in V21 - Rebased. Patchset was broken again. - Don't declare AVFrame.subtitle_pts as deprecated and clarify doc text - Remove AVFilter.subs_list and AVFilter.sub_fmt from APIchanges - Change include in formats.c New in V20 - Rebased. V19 didn't apply cleanly anymore New in V19 - Document API changes in all relevant commits - Move enum AVSubtitleType: Improved commit message - Put deprecated enum values under removal guards - Document AV_SUBTITLE_FMT_NB - Fixed all trailing whitespace - splitcc: Add scatter_realtime_output option - splitcc: Emit empty subtitle frames instead of repeating - New commit: Replace deprecated enum values New in V18 - rebased to latest head (to fix merge conflict in allfilters.c) - textmod: Removed two trailing blanks from sf_textmod.c - xsubdec: fix xsubdec regression found by Michael; packet size estimation as flawed - splitcc: Fix uninitialzed locals - splitcc: Do not propagate hwcontext on secondary output - testsub2video: fix output timeing, re-add mutex locking and implement render_latest_only parameter New in V17 - Applied almost all suggestions that were made (thanks everybody!) - Split the initial commit, no longer moving the legacy structs (AVSubtitle..) - Use the regular encoding API for subtitles - Updated subtitle encoders to handle packet allocation - Removed compatibility layer for accessing legacy encoders - Updated the compatibility implementation for the legacy subtitle encode api - Reordered commits and merged ffmpeg.c changes into a single commit New in V16 - Added missing reference to subfmt.h iun libzvbi-teletextdec.c - Fixed Fate error in patch 15/16 - Removed all trsiling whitespace in tilers.texi New in V15 - Rebased to upstream changes - avcodec/subtitles: Migrate subtitle encoders to frame-based API and provide compatibility shim for legacy api - fftools/ffmpeg: Use new frame-based subtitle encoding API - AVSubtitleArea: copy flags field, make params const - graphicsubs2text: Don't emit duplicate frames - graphicsubs2text: Combined OCR output into a single AVSubtitleArea (I have a prototype for detecting text colors and positions, but it's not ready at this point) - splitcc: cleanup local subtitle_header ref - stripstyles: add parameter for ass layer selection - avcodec/subtitles: deferred loading of ass header for text subtitle encoders - verified all example command lines in the docs are working, added somre more Kind regards, softworkz softworkz (21): avcodec,avutil: Move enum AVSubtitleType to avutil, add new and deprecate old values avutil/frame: Prepare AVFrame for subtitle handling avcodec/subtitles: Introduce new frame-based subtitle decoding API avfilter/subtitles: Update vf_subtitles to use new decoding api avcodec,avutil: Move ass helper functions to avutil as avpriv_ and extend ass dialog parsing avcodec/subtitles: Migrate subtitle encoders to frame-based API and provide a compatibility shim for the legacy api avcodec/subtitles: Replace deprecated enum values fftools/play,probe: Adjust for subtitle changes avfilter/subtitles: Add subtitles.c for subtitle frame allocation avfilter/avfilter: Handle subtitle frames avfilter/sbuffer: Add sbuffersrc and sbuffersink filters avfilter/overlaygraphicsubs: Add overlaygraphicsubs and graphicsub2video filters fftools/ffmpeg: Replace sub2video with subtitle frame filtering and use new frame-based subtitle encoding API avfilter/avfilter: Fix hardcoded input index avfilter/overlaytextsubs: Add overlaytextsubs and textsubs2video filters avfilter/textmod: Add textmod, censor and show_speaker filters avfilter/stripstyles: Add stripstyles filter avfilter/splitcc: Add splitcc filter for closed caption handling avfilter/graphicsub2text: Add new graphicsub2text filter (OCR) avfilter/subscale: Add filter for scaling and/or re-arranging graphical subtitles doc/APIchanges: update for subtitle filtering changes configure | 7 +- doc/APIchanges | 23 + doc/filters.texi | 756 +++++++++++++++ fftools/ffmpeg.c | 584 ++++++------ fftools/ffmpeg.h | 15 +- fftools/ffmpeg_filter.c | 217 +++-- fftools/ffmpeg_hw.c | 2 +- fftools/ffmpeg_opt.c | 3 +- fftools/ffplay.c | 102 +- fftools/ffprobe.c | 48 +- libavcodec/Makefile | 56 +- libavcodec/ass.h | 147 +-- libavcodec/assdec.c | 4 +- libavcodec/assenc.c | 92 +- libavcodec/avcodec.h | 32 +- libavcodec/ccaption_dec.c | 19 +- libavcodec/codec_desc.c | 11 + libavcodec/codec_desc.h | 8 + libavcodec/decode.c | 54 +- libavcodec/dvbsubdec.c | 2 +- libavcodec/dvbsubenc.c | 96 +- libavcodec/dvdsubdec.c | 2 +- libavcodec/dvdsubenc.c | 100 +- libavcodec/encode.c | 63 +- libavcodec/internal.h | 16 + libavcodec/jacosubdec.c | 2 +- libavcodec/libaribb24.c | 2 +- libavcodec/libzvbi-teletextdec.c | 14 +- libavcodec/microdvddec.c | 7 +- libavcodec/movtextdec.c | 3 +- libavcodec/movtextenc.c | 124 ++- libavcodec/mpl2dec.c | 2 +- libavcodec/pgssubdec.c | 2 +- libavcodec/realtextdec.c | 2 +- libavcodec/samidec.c | 2 +- libavcodec/srtdec.c | 2 +- libavcodec/srtenc.c | 112 ++- libavcodec/subviewerdec.c | 2 +- libavcodec/tests/avcodec.c | 2 - libavcodec/textdec.c | 4 +- libavcodec/ttmlenc.c | 111 ++- libavcodec/utils.c | 182 ++++ libavcodec/version.h | 2 +- libavcodec/webvttdec.c | 2 +- libavcodec/webvttenc.c | 90 +- libavcodec/xsubdec.c | 2 +- libavcodec/xsubenc.c | 87 +- libavfilter/Makefile | 15 + libavfilter/allfilters.c | 13 + libavfilter/avfilter.c | 30 +- libavfilter/avfilter.h | 11 + libavfilter/avfiltergraph.c | 5 + libavfilter/buffersink.c | 54 ++ libavfilter/buffersink.h | 7 + libavfilter/buffersrc.c | 72 ++ libavfilter/buffersrc.h | 1 + libavfilter/formats.c | 22 + libavfilter/formats.h | 3 + libavfilter/internal.h | 19 +- libavfilter/sf_graphicsub2text.c | 354 +++++++ libavfilter/sf_splitcc.c | 378 ++++++++ libavfilter/sf_stripstyles.c | 196 ++++ libavfilter/sf_subscale.c | 883 ++++++++++++++++++ libavfilter/sf_textmod.c | 697 ++++++++++++++ libavfilter/subtitles.c | 63 ++ libavfilter/subtitles.h | 44 + libavfilter/vf_overlaygraphicsubs.c | 737 +++++++++++++++ libavfilter/vf_overlaytextsubs.c | 646 +++++++++++++ libavfilter/vf_subtitles.c | 54 +- libavutil/Makefile | 4 + {libavcodec => libavutil}/ass.c | 87 +- libavutil/ass_internal.h | 133 +++ {libavcodec => libavutil}/ass_split.c | 30 +- .../ass_split_internal.h | 32 +- libavutil/frame.c | 211 ++++- libavutil/frame.h | 78 +- libavutil/subfmt.c | 45 + libavutil/subfmt.h | 115 +++ libavutil/version.h | 5 +- tests/ref/fate/filter-overlay-dvdsub-2397 | 181 ++-- tests/ref/fate/sub-dvb | 162 ++-- tests/ref/fate/sub2video | 116 +-- tests/ref/fate/sub2video_basic | 135 +-- tests/ref/fate/sub2video_time_limited | 4 +- 84 files changed, 7494 insertions(+), 1365 deletions(-) create mode 100644 libavfilter/sf_graphicsub2text.c create mode 100644 libavfilter/sf_splitcc.c create mode 100644 libavfilter/sf_stripstyles.c create mode 100644 libavfilter/sf_subscale.c create mode 100644 libavfilter/sf_textmod.c create mode 100644 libavfilter/subtitles.c create mode 100644 libavfilter/subtitles.h create mode 100644 libavfilter/vf_overlaygraphicsubs.c create mode 100644 libavfilter/vf_overlaytextsubs.c rename {libavcodec => libavutil}/ass.c (65%) create mode 100644 libavutil/ass_internal.h rename {libavcodec => libavutil}/ass_split.c (94%) rename libavcodec/ass_split.h => libavutil/ass_split_internal.h (86%) create mode 100644 libavutil/subfmt.c create mode 100644 libavutil/subfmt.h