From patchwork Sun Dec 5 19:41:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soft Works X-Patchwork-Id: 32030 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp3627045iog; Sun, 5 Dec 2021 11:41:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFRuR4Sh+KxwyHYGCjkulGXyPu5a3J0eLHFJJ3YxTwh4YQlXioegOydm7Ke3yDa8i8hzbX X-Received: by 2002:a05:6402:1e93:: with SMTP id f19mr48167725edf.60.1638733295027; Sun, 05 Dec 2021 11:41: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 qf15si17709739ejc.553.2021.12.05.11.41.34; Sun, 05 Dec 2021 11:41: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=Vz5KYqZ0; 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 9E7AE68AEA3; Sun, 5 Dec 2021 21:41:30 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10olkn2076.outbound.protection.outlook.com [40.92.41.76]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 142DF68ADF6 for ; Sun, 5 Dec 2021 21:41:24 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l15+nL+L0iG1/H7FbcwNm48x1Rk5acs6m9sYmgqOUsol+ld/XlsajS29CBH0ZbzXsiI1G5eOnXynlxU+6HOyRDIRuTF9ozx3VIX653yMftp8BJf6liC3vjrEtCu93e4Z1P1TqsIzfZAcIa/IAwbSJFHpkGzVPgLW5HtmT4XtTaFPjWmeNNFbao+aT011kD/tU6FrWvhinzuXp0ewe7T7S3O9x9N6PO8qVbcXvPC8mjHhQH0EVf7Qc+QJF9F1qGVDpHFOeM5+1kOLRe5sWz0ouUYl+6JZ7YY3xVAwU4Pp9ZU10uuw8D6r8YZdnikrlo2axohj9fy8kmxd3dZHkf0+9g== 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=YZF7uJH29YOh1NiEJs9CP9veM+E1X8NvQ5QqeP+zyxg=; b=iBq3Q2hIk8Bfo5IjbBgXltNY5CvEEPiAoQi6Ahdeje8sPiiFnWgvgU+khII6iHSNPCXbFlmu68WuaPY5CPtD1i2AoaRSTegZkokmSPwkYC4sROMsyqYERyVybEhDmNx9bSZ6FXRJKTZtlHmSHDO6M9ybnNxpMgmA599tGXsEj5MRA9M84oONv4Gnn3k7s8XpP6Yp+j9e5kI/sKwKlgg/6xo/KTBKp2+cfU/FzedjUonjXFSma+ocqwXn9Wh6d31Dxldl6SfP4Ek8ULDg/TLSj1w8d3tNJpw3mugdF8Swehdgh64nYfQxGDAeFw0SQ5Fyf8+h8sxSQzxmmdsKTHXrwQ== 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=YZF7uJH29YOh1NiEJs9CP9veM+E1X8NvQ5QqeP+zyxg=; b=Vz5KYqZ0LxgSgMD83yh0lRRTN5P12IIbi+kk37/xh+lrt6CQ5wL4evX5aRVjmiSUAKoPQqv3VMrsZLyCAqAH/qVXg0ntaiamYG3GrQvPnY287UVn5+vSB9+Dwyv8UYBlcfrraGnFv6ujFYXGJIuCh5SyfMNQ8sh0+jpy/LWaePhSS3gQZJNm3AFjywwILEVD9TRg5fpOXJ6p9OkeDU/4QWi1kUxUUKXp8HuyrpFST1l3neYrbrLHxYSvc++zJTW7z69CO/D4bQbK0CoGewpSMVoBOakAK4yQRcVF/qITkAfUqEjo4k+x1dpjjk9hKstkfZXoJL4OS16eWDEaP/gKMw== Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:b::20) by DM8P223MB0381.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.21; Sun, 5 Dec 2021 19:41:21 +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.021; Sun, 5 Dec 2021 19:41:21 +0000 From: Soft Works To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH v21 00/20] Subtitle Filtering Thread-Index: AQJSUv2C24H0B2G2t20IkZxGvRbHeA== Date: Sun, 5 Dec 2021 19:41:21 +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: [JP91OLSkxOKFkOxEODZi0bfir7/poOSThqCUEO1HAbeVXjkVKln/hgTiqOIVERN4] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1bb2c45e-12a9-44f7-9f8b-08d9b82736ef x-ms-traffictypediagnostic: DM8P223MB0381: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pwaeUERfwgn9E/KK3h0W6QB0xsqw6nfLDJXnSmdVdSZOorUbLq9qNf+N7NKl4ENT2gAPaFX+jgxIWiQ7fFNLRnnqJnAb5Zl1BiNmjnTEFL710svQ5Xz8bkwT26XTeVol4BrzoGsWLkq0O5sBRTKToNGtdpN5p9UtW8KDX/C2IwVmJLNfzNRU+QIhklig50Yes0kPHXxm4n5gz4THdz5nQFGV0oC7C/Ae1VsR8+hxqDykXZeDaQOUVs4PrG206i0ZjWR8QdxpGAGCZz3uYdPKnZr3nRnT67yn69RgII4uEWa2zv4c+5V67x0/DZ45ycBu1ifVuSsrKWeKc6yNoV2SEYqG8JecgVlWRrsbeMrKULj4/I6v39evAfWYpqrYfpK4MeP8sAzdKLX0WmkIuFJbUarMMPrhS4ggbhOMU/+2KlN39e2/4/CWQNnWttPK/3QM6hd88oQ/l2P2HLqPLh5OHlEsg7az0tPcQAQQOc4ahGO47QIxj8b6OTpNSSaMybFcBiWs6HPEzCoIZYAKhBijc5rlKDczQ0Kpjn54VLye1+sBKMmO2yXpCsiCVYyiEQxPYoPxmzHizuwFlKuxH563zw== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?ALDTy1NuIBq1MoEJWjLd1P48GyWX?= =?utf-8?q?NKRA5095q3CxJKy3TkS00qbLhc+RIz764vcb1acI+ZA1Ix8zRT/HHQopnD3XtQIvi?= =?utf-8?q?5gBFX0DnBHv8JBYiEkG29wYRWPc8I4z+XvrRI59nji0gfZmvn1byaxW066L9AQxzQ?= =?utf-8?q?y8R9i8RLILe0PhkgK+S1QJKaPh9RFQRxTUdou7RDsVlAtjiMTZCYOH4xPzCg/jTmG?= =?utf-8?q?YRyZUYrvQBZTuX7TuDtFxm7BOw1dxuNOT3925I4fHlEeJzoYAOnub4CQ3zkNjM98y?= =?utf-8?q?UnoNL/jsJSvZwbfBv66XG0khrl1MYiVQ54V4bmmzVePNqpw7n5tefybq7fJsYZitO?= =?utf-8?q?7BgdefiTZWJIJ5dWdD6Z2CDLOCQU8zxx+QPXtfKMYIXOFPIQcEvsYwgZzwzCFiRpB?= =?utf-8?q?eefufYiUn1/gQoNRzcPfC+ivW2p9Qw8sqSIWBwqI5YWqrZ9dreAdf69muhPX/O7ZE?= =?utf-8?q?Afza87Fa3KwRrQ0lWSc7QauUoDK7ddYC1sY3Ku96P4XzopD3aWkJULo+HdmrmXQyx?= =?utf-8?q?q4Idjg8ILg6BWyZD6jH649w96uHHtNaSiYTUHenU52ILJEGP8NDuyZs7obMs8B+oq?= =?utf-8?q?V1N//5F4c952K4uvbdDY+YRmnWbV8zGcJA4GzxGeMfi9fHXZ8KLugB97uSb5yLH4i?= =?utf-8?q?SbJyLwOuJQZiYtKB0Z1LBXdURPrY6+dmsMUuaS5VhR3wkKuoOgfVJC3nuzvV3sqNi?= =?utf-8?q?3BSfa0khFxX2YInNFCGY7lJzCzHXVLsYifSGhbxiR5MXlCmbUkcIkdvtK/fzawGw6?= =?utf-8?q?0LbmyhkH52q64VxCG5njs4TtiwvVxj3+JxSLkUSKweR6/UeSHz9toyYjku3wetxYQ?= =?utf-8?q?p+fsAoYM70DrLlFu2Q+kQCSvbIvN7697MHanCxey9feVc2aszQV0S/C9AIMcZ06Rl?= =?utf-8?q?hn4WO/6z/9L4ftWJrMwoO8YCIZyXde/Lh4XJzlelQ0GIiUMGmlnn4LWIPWn87T2gS?= =?utf-8?q?Vm1hGAAGJMHQpgn6W3gqtGeJnifvjL8dwhfWSblNxnQ=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: 1bb2c45e-12a9-44f7-9f8b-08d9b82736ef X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2021 19:41:21.3081 (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: DM8P223MB0381 Subject: [FFmpeg-devel] [PATCH v21 00/20] 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: M78qX0psLOks 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 (20): 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 configure | 7 +- doc/APIchanges | 26 + 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/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 | 24 +- libavutil/frame.c | 211 ++++- libavutil/frame.h | 77 +- libavutil/subfmt.c | 50 + libavutil/subfmt.h | 114 +++ libavutil/version.h | 1 + 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 +- 83 files changed, 7489 insertions(+), 1362 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 (89%) create mode 100644 libavutil/subfmt.c create mode 100644 libavutil/subfmt.h