From patchwork Mon Nov 29 19:47:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soft Works X-Patchwork-Id: 31800 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp6641113iob; Mon, 29 Nov 2021 11:48:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2a9ofwOu7/GJTRh7hqrpBzLN0Zft8G/UOF0F/lP8ZIZv+kPO1aTsqPUTtI3bnn/C0AEYv X-Received: by 2002:a50:c31c:: with SMTP id a28mr75898552edb.4.1638215281792; Mon, 29 Nov 2021 11:48:01 -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 j8si35616716edw.396.2021.11.29.11.48.01; Mon, 29 Nov 2021 11:48:01 -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=T4dXN9My; 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 E502668AB87; Mon, 29 Nov 2021 21:47:58 +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-dm3nam07olkn2063.outbound.protection.outlook.com [40.92.43.63]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 038E0680C85 for ; Mon, 29 Nov 2021 21:47:52 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L6KIaI04Od0CAQdJ9EBE56A7jGoFMn5IWcPaXocLf03hlvrW9Hxn05NIj14NS6+AZqVXzQoXxZyGq1YFRi9kMb8gmxVJiScRs2CGk5Z4ASC2jJ0l5JesoHUuyRT6TvQLeIDVARzsV9/MVxk2dU3QBZzP/Hw6ap9hx4QpiTgzDZDkgk0BN7Gxvx0AwuyooP1CMRP0hWDeCAixHzALJtNns4p2Ru+t0BMrxNbXZKt4YmpRAFxifuL4ZvkBBGcNZmoao39Ryku90GzBpq+3NGW/idH0Ady+JkDjhibeu+cn89LrW9z9gJtd4PzIbJDqa1a1sPptuw3iHuD+9/4tedym2Q== 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=aZ/H346yQ0z4rzyQZuA506tnyIuDpSmC6TWEsX7od84=; b=AGuZEqyVqg5xAdVW4F8ScYzZwvtVM60gvrsixQL2PNriW4IFEgQOVm1wg+mEu27X1Bt0rDaamdXK1Bc4lt222ob+JdsyKKmP8qZiO/LnsYpga+O49495v3bx1qjRGcev4JwisCQCQpM8nSe4Qj3zs5l8iFIiy14+ZlTMxip/tO3h+ukFVhgobdPHAVvHbRoRfVo/PRd29zqlXtwYFSxPFdy5SUPwLKaImD9HE2QPVs95A8FvC6rwdECWrj+YWu0AdmalC2ud7BZqU2SDachZxTig1tb3nfmYGDpsVZGhJQGbxKKftxhkDYLikJKfpE9c0YRqofacneB859uqCZU7TA== 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=aZ/H346yQ0z4rzyQZuA506tnyIuDpSmC6TWEsX7od84=; b=T4dXN9Myg41JCGXUQPyg/U/zLemY/we/V6uVWI3NSLvaS+y9U90XUDAZrLWI9dt0pDeAbrO9sVx8rmGMEV4vVHOJBonQKn2tr9+uF3PqRqk8gQpXOsg2EHcKjf8XSmFhTMq/4G0bXBQ+bpbxEeLLY4PLcoWOZdb6Z9dKtepIpa/yxnFzcXMTRdQlHSkFeh8DjS7jX7sIYxBydgFb25SPixqm8VrBH4nHOK/CBqF1dL4BmSokzGqyWknAdYGNBdWED52xwUJWDjqGoYUysDPDi4gNwkrMaLPj9nm7JIDwMJ+S7DxYeJp7tTbCHmQudOvok0MIVWJA2fPi9NQCKs0iLg== Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:b::20) by DM8P223MB0336.NAMP223.PROD.OUTLOOK.COM (2603:10b6:5:316::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22; Mon, 29 Nov 2021 19:47:49 +0000 Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::9c8d:fc63:9488:9775]) by DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::9c8d:fc63:9488:9775%5]) with mapi id 15.20.4734.024; Mon, 29 Nov 2021 19:47:49 +0000 From: Soft Works To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH v18 00/19] Subtitle Filtering Thread-Index: AQInKy37Dkn/2nc1o88znnSsuRidyAGnxvC1 Date: Mon, 29 Nov 2021 19:47:49 +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: [oG+SwHLpXi3xxryeaRgXsLrSA9kN8APr] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9bb77066-b842-4f1d-566c-08d9b3711fc5 x-ms-traffictypediagnostic: DM8P223MB0336: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XWAoRC4f0ZanilFdLuw7yfrpJRNujpTfvDf7tY3cXYxRKtVsmaSfcLdTSstPWNQIO9jjwKZeVZ59SK208dj/uO911swXhQhLH6Z5jyuwtMzI+xQdRBQmAOSPZa38cQGRJw/R8gHNNICCfUuK9t5rcbtyEe+bFNDLNdcJvLP43DAgGWUhbp2jSK96pADB0/bSmwQo9RXBqXt/qLVDam3J3FhEwPi8RVqrFLmYB+feuZqVs39IfOpTFgycdfjO5p6/pQ+SnBbxPsAFnt1rRnVrg7M7KhHTL/6zpjbtPgBbr2xEH/YYyzGHB/Kx7UxnLgYQdIZCpskAoGCTQjjCu0c+C3T10aFQ/8MQsrXqsb8ERzboSeyFXZlaYXqJ/jLLOI1uqSSKKRZ3g9jQZ2idM5ZWt8z/voUp2R+WwlSV2VbMDbQikG1FiBCcgP+ueXh77IqKZJmSWtLoA3p3xXxmC6gXdst5JIm/F/0MXvvlSFX8zmz5p5s3n7aFzS9ujEyXw6C2ev8J6c8yCNmSSVWF8yOk2rTXw30vcmm4XbhODkTITtDI5L7dqoxluY+dNqN/LF2YKNDc1uyESPTKQz7G12jwsA== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: CyMs4c7zy9Ql/ow/eWOm1FjS1IV/We2xDEQQ905nvXmZuieIUajg/uoj6oyX/FsO2aZKql7GMU6luT0rF2FvTFwyBEnl4+M08vPIvp4KIRc383zezL9Tu1qHEHlnAdtCeDyTf/jfYLvsDIpo7RvQzQI0op/okFViTn2iGlPXqfZOLgmD2jzF3+Wa/GjeRouCafMio3hCPTdXTczrs98onClePh4Yg07ApvLkGf3ln2Nem8kJ2jhCyB5xaU5a9d1zIf3nGEZf26OSnUJWYlezVV+0yPoHGT7Sh6ub0Ct/fHhOGeOfF4O9QNTEJfbvOp8TKGJ0qFGxOKRJDqsHHl4xecLvrKgO4x58A5UrjQG+HZS1V2YUC5osyyX2FIOr814c5YnExVU2KcnfGeyqDlARQ+dtD2YVDkw2neTQTBWRnRHNnngFcLOV/5roezQsUpPRU6rsveO5A0rQkbKIbGXeb8R4qiSxTZMfU9vthTeDyLMf8eOAWpsh+wIkOSPVKZgG+Fd5sxt6PMwIxnmNbHpQHfL4BjXfULT7CVLlJiwsZUDV7aDqyxIlq3wTO1qpB6ES6ZQikennV84hwFOzU99MDa+Xd/cb6wdnPb83Q4sCylXzwS3Q5UsurzU8scH80g+4lLQFtbf7/ZPdkPOkniExqEvTDJ7khCaGosDMLTaE2CBbPdbX4pQn/WipsShJUcYQXfnQh2xeCp97KDz5zjCMmQ== MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-3912-16-msonline-outlook-1fc6d.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: 9bb77066-b842-4f1d-566c-08d9b3711fc5 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2021 19:47:49.4571 (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: DM8P223MB0336 Subject: [FFmpeg-devel] [PATCH v18 00/19] 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: BTvOgaDF/bE7 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 (19): avcodec,avutil: Move enum AVSubtitleType 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 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/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 | 2 +- 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/dvbsubenc.c | 96 +- 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 | 126 ++- libavcodec/mpl2dec.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/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 | 328 +++++++ 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 | 106 +++ 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 +- 77 files changed, 7397 insertions(+), 1361 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