From patchwork Fri Dec 3 19:31:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soft Works X-Patchwork-Id: 31923 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp1096392iog; Fri, 3 Dec 2021 11:31:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwYenJQ2/ny0NK6gfhxSARWDbiwaetIBxI1omNnbi8r5tQfc0/6TYQNtvcnTOt9W7qJnPG1 X-Received: by 2002:a05:6402:4382:: with SMTP id o2mr28447319edc.143.1638559879737; Fri, 03 Dec 2021 11:31:19 -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 u23si4489995eda.143.2021.12.03.11.31.18; Fri, 03 Dec 2021 11:31:19 -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=IJKTS1d3; 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 8258A68ADCE; Fri, 3 Dec 2021 21:31:14 +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-dm6nam10olkn2068.outbound.protection.outlook.com [40.92.41.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9B6736899AB for ; Fri, 3 Dec 2021 21:31:07 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oeQWspyAL9d1d1V2GIb4H1W5jJeg/kKyhwWHp2hezu2VyF1fCbcLUhFLeMKcgWQ15pgcWOCvezWwbiBooFqtUBotP3t5CzqcDFo5bD0s1kcy2Uyza7TdHnSRNsrWHY2AX3w+tGWrEMvuzdU7QPLBhe1FJ8NArfNIWLEMkJzeyKtQ0Aw5/b4lAY+EjU+FrO9Z4QsZhZURJFdrHQwIfbeVzqFxGKohZUoM8pDi/Uy8TPW7ynM8/jyzAhf7CvrYDnOky2j7SrhhbXDuAXRrELAhHFL5OhR1DxXT+5DCkWxqeyzXg5vkeq4LepbDY3hK4LgFFYq1rn8/koJWT/vJVHRiXQ== 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=VBrjSOsJsX/3U8vTTJ5Q7HRoa/GkOpYbB/r2T1H+B88=; b=cuAjIFY8GOlmFlqGRuuWjckd3nEEoVGOlybgsU2IV7C72zfdVnIO4VIQ9E/o6YLsxD7FD91z857SQqnX3Br1RDQ5eZT8Z+J6fuO4FdPztmpsaYVWTZKlVgue7jcSW6sHn3vMjSr/xXu61EySDLgy0GxysCuwbIkPyRyvvH8u+rdJNmsGnL1IAPcsY0eIp0viXEc+De4HL8bVDXHm4wCnyMzdM4hTkG64Mg5GJ9j1aukmVtRixCZllw/buY46y6vTIpkcXAMLuth8Vd4WLUA01GssD8fQMYAA9Kw1vGVzGHYHd3VVbNBV1vQtydxouknDW7wBc3oLwgc1SOHvMXSMPg== 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=VBrjSOsJsX/3U8vTTJ5Q7HRoa/GkOpYbB/r2T1H+B88=; b=IJKTS1d3Vvf5eyCCBnXKaQU0E0kFfQGcWosud1rxZbdpcB75YaiElaTAVz1w23RvhYvWsCgyF8P28V4Ml52NvB+p+d9mf9J04NXMKldI6SmxrR82iVLpgFQ4J/ph3mtwPv8xU+3qn6tdNLgkMuSRSvPiMxGeVInbVQz/EMDHJN6v381KptVEwQoMHHQSeyRguqyTjyF0XifVNRMTdo93+VjikXSobWVXLYIAhqy9LEkafUroSdC1cXVkTyOXJQm2cIlYJ3/9xzv+yu/+s46ekWVzKIcoJ+/a62IntxTZgNOBLjKoFnDMriWOCGdhuIx30/2zzVbRylu6hNKTN0gglw== Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:b::20) by DM8P223MB0333.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:8::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Fri, 3 Dec 2021 19:31:04 +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.016; Fri, 3 Dec 2021 19:31:04 +0000 From: Soft Works To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH v19 00/20] Subtitle Filtering Thread-Index: Adfoe9MKPgjiV744StqjO/fAR6x/0w== Date: Fri, 3 Dec 2021 19:31:04 +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: [f1UOv24nPLqx6LI7LZaV6yUs/RF0nzWP] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4c345fe5-1844-40be-da39-08d9b6937276 x-ms-traffictypediagnostic: DM8P223MB0333: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: H+gqhmhv8mpqX20THFcDMFRd3nI4b+VqDpVmH6v4a+CiMALocdChrn6HFxhATWftw+ck7ia+XrT4WMFP79uAN+mRm2s7gMJrqdgx4NDQK7K38H9c7xwGDiuSeY/HvpyM2rS84cuYG2PCwMIbDd2TfAeI1Ze3Y5YYJqqmTJsvWBhh4hFlLhgUWE4Vgmz3U97+6ogO+KNbshfsi7LprRJBRehrUBH78BguQV5RWUOQ8loGRSCELrGRG0AYcBnns/gCRpJbzpjDPh4PZn6Rc/3FD/Im2Gv/EZaM3VMhJqPz1enW5l6GXh03GBce/Rs5iv9O9F5WZNzMRMinoGlvc/mkx/3jms/VR56higmXYY1NMt+UtCNU9PwlkHpfZl/OM9JQ1hmot6V0/cRwaCD0pEVHq/Zx703UFCAv0jxY8LtwRIZnE3FpnA/PyJTOJaWs9anJkseRlksn7oLmqTIsrhnJFwGmvug2RgSho1seJ+d8Gu8xeU3UjarbyeWY7VVxkz7qUxW4jiXhOO5nDuxSE9tWsOnkA75nUj4p6QRS25y50OgMYtcSgB7LJ7Ui7OPk9BJoNvEldfe0rad4MfThl4u+Sw== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?1UWJkPwgdtBLMEPsKo9jrJSv+vCw?= =?utf-8?q?hN52QbsF/3896cm3XtTvxCwRiFKoB+csdxx8lTL56gkU64ZH1ziyD5CWseFwZEKTm?= =?utf-8?q?XcMttiB9Svbyq0fqZh9hDx+FT7RVWeW46XxJ++1Z/CnvblM4DEJPEIh4+RhOm787I?= =?utf-8?q?Xghw64rgi0viFrR6/Kb2WyXjFaG+EW4Bch3IPAn53JPPEs7IsF4rM2aLSQvdFHfZ9?= =?utf-8?q?E/eqEU5yDEVI6qX/52/nLV13GA4zrl8p3kWXqJnw/dBEpa66hLnj/EoPDJ3ImUA+T?= =?utf-8?q?EIFHzcrZzOH7jXYuXr4kgKg3Iin5hXqBk70ooAF+gVot/ezzTViAqUE7OmoOhn5Sy?= =?utf-8?q?9J5b8fYUj3hGdZPsYeSQtJFQgkUZjC9gvEAX65o8PzZ/26lbLB4YgKEAdRQFVgsXi?= =?utf-8?q?DiBGbGlzCObIPCs8IDDwsg8F0FXpRejVvF2nhi/89L70+KPJ3QohTEvVYYpflqTmm?= =?utf-8?q?k/pOOK76ggMSz8GIdwn8svgVOHGDhC4/PTurUzA/WqEqoV9MDWwGGYFXXmRI0neun?= =?utf-8?q?XrUUIdaVldj1sQGuME1KChTVg7w0h619ENP4l7vvYt5819SkfOLbT/wl18076HsdS?= =?utf-8?q?BBEoNgnLpxyJ7J4dJCW1O2IugDhOVD/4KE+9aVHyH7zKrYl62y9L+at5RxyPX9P2V?= =?utf-8?q?KmnPDHoxCe7NZoW8oozveZpGDVNBR3BbxuVx8ibARX0yXc7+alj1m0Yb8MWltCETl?= =?utf-8?q?YPwV1C2VAvc7+v6+A/XOWOlkRZxbdGjh1SHTgjs7GG/khcG4bn1HXBDegUq+ylkXj?= =?utf-8?q?Sq7+vOl+gZ0lqUCXsCAo9dXoIkp30lU+9TIBO4wYs1sd8FxV24siufKph3LjNhEGc?= =?utf-8?q?Y55tcjQO/vSTiWbB2PQlcFZFUpAHBEwgc1Fd9Umm0tlyeHvhNla5Xi6LLFLDiEMV8?= =?utf-8?q?Yaj8FvlGIRLNiIWpR2Y5W/FiOe02WOdkICmOwh0P+fJA=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: 4c345fe5-1844-40be-da39-08d9b6937276 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2021 19:31:04.5399 (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: DM8P223MB0333 Subject: [FFmpeg-devel] [PATCH v19 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: xOqv7DKs9dXL 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 | 29 + 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, 7492 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