From patchwork Thu Dec 9 12:12:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soft Works X-Patchwork-Id: 32222 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp273539iog; Thu, 9 Dec 2021 04:12:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHuGx+O+FSvXRzvZDcIgVTWIGiYCyTTjmj8huJQaMA5uM/OxFGLeEQDjrbICRvmsd0vBox X-Received: by 2002:a17:906:3085:: with SMTP id 5mr14838267ejv.365.1639051955722; Thu, 09 Dec 2021 04:12:35 -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 v8si9946869edr.518.2021.12.09.04.12.35; Thu, 09 Dec 2021 04:12:35 -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=M9vA01Ui; 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 CF09768AF0A; Thu, 9 Dec 2021 14:12:32 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10olkn2041.outbound.protection.outlook.com [40.92.40.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1AADD689988 for ; Thu, 9 Dec 2021 14:12:26 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fTmlOAAFB6JWEyTQqJkmlEJIQarpup1LiGcXgM6AdnsyITnougYEWpKnugvdz3Fk5FptgWNadJKxk9x2C/J++necxqm8KHuSbAw3ssLoGNXkQO8ngRdykwuICBva4av5+RYFDpRkgLqW9DhRT5KsZwJBCqQtjrdRC3WOaNjrk4F5D0H5I/nJFi9BBhdb5JCi2H/llBKwwYIhg0L8QkerUK4D/mc24U06qgLzRpWGG63Ua+RoRipROmRON2m8zE+ok0khcKdy10Hh9iyzJbOBVmZfGCmJWKmDqF92s2KM0RIe/M7/9GFhJJGTuwbDt9dvtqwpKsrqIEUGcdTRoh/7Zw== 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=Brg227f659DRpv9xqM61bUEubfjlo8GUiPMjuTReGUg=; b=ZNKWWwQP/0wKQaacJ+AvVtwKysn3xs57uzU7u5Aq2qIceMTOunmdNF9V/INGKAQt4/eqHMCnqdi1RJyKpOMUeWzwIMYMCXUdu2BUWiscqFLJrd11nIfrm74B1+nClD/jYYADkLotW8MuT+nt3Nz0w2WKgmQpSWkMwp9YWuUl/CiyQuMWl7YrIs8b4RSMztobOSGPvhUaP2Q1S0Ma2s+qnQhDgtkNUtnyhtlRLQ4zZlelPOwX9ueasNCUcEDhNSzto+JmHGSzTAnv4UASvRst72UKe7ivjDDGRtD20Axutj8T82woGZAsfLRCtt86ZkUHZ3cMUnrCkAYbzOmf8WhRmw== 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=Brg227f659DRpv9xqM61bUEubfjlo8GUiPMjuTReGUg=; b=M9vA01Uigv+FiPhbh4Jy9vkxgBProeSwV+bz0OHNnCkXVOky8b1JfPvrHXbj6pGpmuuH33v0NO+aubSwpVudkhbLSXrBoUfWzDFHxIfCxmF5UTtbqPSS8sdtCe0j3gJ6PBXpMSncrmJ61H/WZgZorWsiA2ViAkVeXaoesArIJZ3x7rCvtxq4K5O4TTHsW54apw45uiQm/greHnG0cV8DIUIEfuilRne8aS9v0gGEGIGcdG0M8iKAh9j+DUoHxXfoCWHq0DH+r2KZfZ7wIObl/3lto0vTW6x6MNrnxxkK3WCC+hRAdNw1QLKu/yP7VC79GrTRDo3ipTQeF7kinkCkoA== Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:b::20) by DM8P223MB0399.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.21; Thu, 9 Dec 2021 12:12:23 +0000 Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::9c8d:fc63:9488:9775]) by DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::9c8d:fc63:9488:9775%8]) with mapi id 15.20.4755.025; Thu, 9 Dec 2021 12:12:23 +0000 From: Soft Works To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH v22 00/23] Subtitle Filtering Thread-Index: AQJNETUYsv/xrKDpfJRXFuxGLIyQ1g== Date: Thu, 9 Dec 2021 12:12:23 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [koPVTVvpqERU4p9+w4r+mxa0y5lb9hir] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d5e8d07b-8f71-4cf8-f1ba-08d9bb0d2870 x-ms-traffictypediagnostic: DM8P223MB0399:EE_ x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Aoc7H4eVVPXx9u5LlDWozZ5OhtKKH1BMnR45KU4v4vBlq79a+lYnjQSV+E75ylRVcnR9qsmm7kjIWk5fCyCXEjuZM6nKlN+iWNTaWLoyPhL13vGYHntV5+Jvm/kUBdE8YX1qjOALlQDe7q9u3h2l8K2oKM0igUEmNdzsGBpSEpr6VA0TyEsHwJHD6IYR/axmO4Edle2QGazbpCdc80FxpiT+6DjKK+kxTIoZ+i6aJmimSHNyEhvksLAPUOEftQ62dazbr44qsjgfm/GbjYRw0I8Mxwy2ifmUbGMPfqr6nz7CJse049TdH4GaUNDTWoIK5ZaEcgHoGLdHIhVMkq5p6Mt3qbxy/EDBndf7UTS2enViOMUbPZ/BbRR/8CkTzq62yo6J/cHBYqstfL5kFHwW+i9h9TEMWQ8xSaPrlB7MC8nJtgWiiL9VTXDgMCxJ9jLdrZv/9CTz/2fjacp47bgxHfEV/wPBH+AWmT0D7HxBQ72jLqDh7c2wPh0Zo36OEgY4hW5PWJq24Omem/eD3ASc7XWIWq+vorbOYC0TMDt/MiRoBgCKv/WIZF+QBj22yHIhBAnk1LQBqmqrHFA3CqJjYA== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?A4L4/2jL/0+vZDf3KO3HFJAqdhV+?= =?utf-8?q?H2qeYw0XF/Cxcgwv8+8nwl494RHMSL3hK4elOPgjcJnLgwlUAytEqoh8MRudXPcp9?= =?utf-8?q?aow5Hx+ECd64uQi+BbcvZ9KBrN34sWCDb9QM3kJ+sOA2KhOcE9YLgjYMlWxJBYOf4?= =?utf-8?q?KE25b+mtQZfMqwJqqjLgwjci/yF8uZ214p2PI+iEvTkoHFNBN9kE9+CxGy95R5zc3?= =?utf-8?q?oPb58dtV3Y9V3vMel3intVKeHo4rCeLRRf9lniiqgeQwsFdl8jodnW9/Y63Vcqmq1?= =?utf-8?q?2mGtpCNvXTMJrvr09IHaaQjv/1uQxTO9CwWz03rFU2mIigTJ4VIUya/z4/HZTjjB8?= =?utf-8?q?5dkVsS7DPDLDcSukMgNVfxs9YEOm8qWhluLbnYZfWXMuED66NRZbbo3zx9Mn297n4?= =?utf-8?q?I1wS2u0EBPUBn4f3JU/SZbrJF8z/5uoY3JigfIyYGdWmjhcjQqUgNrfKJgRnEtHGy?= =?utf-8?q?xSVWoJw+VO0SXduLCwlLgD/0kn7WAAxQgnkYgLuUFR+UahkJ7cdrtIOTRT8bZR423?= =?utf-8?q?a4LW/j2nsDm6ObNxHMVRgBaVTWr9fp3O4cwDEBHP7Rx1v9oeTNTbUUDldjjEQoFF1?= =?utf-8?q?O/BNdm0L2AhEddcz8v/ya3XBGdoRrZLpKGpzTHCbXFFEsewhZSLWvkyAeRvtiLfXV?= =?utf-8?q?R8v6ueEiXo8hxikNN0OwBPmlje7D0qDW5cTL5rWd1uHyeaJVq8GAd2SHwuDiDI+/E?= =?utf-8?q?MUu4rTix2D7yL4iPYQZCEYJ14Wwdk5jGbcJxWs50EkK52QZyAtXfn6Sl1ce0cNV16?= =?utf-8?q?k8/1zNzuMxnC+Jvn4GWfvHHcHcDcn43nna+p4tYhOi4/PNy2PLkZPeHOoI1srio21?= =?utf-8?q?E40wcd+nBvGlz4PItygElofdPUMxfGrcF+pYJqLrBYjvfpiOU7TwBeYAOq6zCf9mK?= =?utf-8?q?QdxywtA+/zMbvN6HUmDsw8KoTrWWDSoIRG2QY3kzIfuA=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: d5e8d07b-8f71-4cf8-f1ba-08d9bb0d2870 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Dec 2021 12:12:23.5761 (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: DM8P223MB0399 Subject: [FFmpeg-devel] [PATCH v22 00/23] 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: mI/DV8JgzzyW 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 (23): 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 avutil/ass_split: Add parsing of hard-space tags (\h) avcodec/webvttenc: convert hard-space tags to   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 | 96 +- 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 | 37 +- .../ass_split_internal.h | 25 +- libavutil/frame.c | 211 ++++- libavutil/frame.h | 78 +- libavutil/subfmt.c | 50 + libavutil/subfmt.h | 114 +++ libavutil/version.h | 5 +- tests/ref/fate/filter-overlay-dvdsub-2397 | 181 ++-- tests/ref/fate/mov-mp4-ttml-dfxp | 8 +- tests/ref/fate/mov-mp4-ttml-stpp | 8 +- tests/ref/fate/sub-dvb | 162 ++-- tests/ref/fate/sub-textenc | 10 +- tests/ref/fate/sub-ttmlenc | 8 +- tests/ref/fate/sub-webvttenc | 10 +- tests/ref/fate/sub2video | 116 +-- tests/ref/fate/sub2video_basic | 135 +-- tests/ref/fate/sub2video_time_limited | 4 +- 89 files changed, 7526 insertions(+), 1387 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 (93%) rename libavcodec/ass_split.h => libavutil/ass_split_internal.h (88%) create mode 100644 libavutil/subfmt.c create mode 100644 libavutil/subfmt.h