From patchwork Sun Dec 5 16:23:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soft Works X-Patchwork-Id: 31993 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp3439411iog; Sun, 5 Dec 2021 08:23:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjr2dIcTOErOROn5HCpZSil4xsBPCTMu4mGMho4x8Wst5qAikfoSP/yDNuMwu9n0SWfL6D X-Received: by 2002:a05:6402:154:: with SMTP id s20mr47550799edu.148.1638721424244; Sun, 05 Dec 2021 08:23:44 -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 m20si11159563eji.235.2021.12.05.08.23.43; Sun, 05 Dec 2021 08:23:44 -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=k8n+RiZu; 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 B61196899AB; Sun, 5 Dec 2021 18:23:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from NAM10-BN7-obe.outbound.protection.outlook.com (unknown [40.92.40.107]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 380126802C3 for ; Sun, 5 Dec 2021 18:23:33 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lpzrObCVOvSkMFY3nhkK/ubwt5TH9b8qQuKHinBHzmBEoMWTQjKL6I12igKwUCm0csHExQSi1Vuwr5v2evs2eUl/1i+SIa74gB3nWkyGpC5k7cq2g9riRWPQNoR0KIePs+zLZc0bPPDUuYxKdpV/pOZwdS85kLQLO8aXdXp1XuIB6NOJM5p5yXJhMA1i2SCO0f82zoU0GSz0VEmZwJPLjOWd6pMHK5a/7dbCSDfvH1wXyafd1qAQdiM9A14QwXGgQc8TggTWG47U/LCEeyLF5YwkBgBCcXKAoW0jYbsTJDXrJbOyS9Zf9BHqhGPOKwUqqjeAxSQxkj3n/D8LQZmVvg== 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=iGYuSrLMVjr4+FwmN2nN137oiKERl1bZEUxqsicnqKE=; b=jpZ+rXRpS39O/DfyqlqcDOPEKjJeu5RaWLjcCA2S+vNtTbjPUzdJyW1CSzw/GpdgLg2SM+qSnVBpsooPvZlUcvCcNtWf0eqoX+gEaWuPiHMOxt6YAjG6r9bLZVJuNIRrl0bzOFi8/SivpVnFIzfIyVpB9cqBbUXfnMejhEcU8KzxlKxR5Ma6dBBpHp6jCkedM8hEmYLQ1kRZj1D6RchXS81Gz5ZfpyAtlAbiwrmSl6VMwO/MXB8lIo/ZkdAvyRpgxXYWEyhJxstYWEMEVIVkImz+O0YPUh3BsApF7pQ537Qal+F3MEVnYHgNklKAyr5rEea/tnFcByxRzmrEhpdWNg== 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=iGYuSrLMVjr4+FwmN2nN137oiKERl1bZEUxqsicnqKE=; b=k8n+RiZu2ClyBixsYX/OSAOJ3QZbi5epjesEUYn5e4eEybRaVV1cwNem1/pDy2SpSl/OfmhebLat7T5uBmRCJNp+A/RjNvLC2+cWch0WqXTSunLi4jUkKtjlCv7ki5MvaLxrC42GEK7NyLMVmxgpsal5BY7+NslPYWmvThaLBfUyRrWZv85dVwx4hkPxVJU+I2CakU2f7opJ/uqrV23cZqZS8vP3r5kr/G47MBuV4HUB6sPSmvzLaEvRRv5l33L6l4rhuvG65SFMnNGZPySR2QxZBNw8Wowlit7r73FxN9FcuYuSSnr7Tl1ozP7EffljKZeAFxXhdrfz1hzy4g9Scg== Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:b::20) by DM8P223MB0368.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16; Sun, 5 Dec 2021 16:23:30 +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 16:23:30 +0000 From: Soft Works To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH v20 00/20] Subtitle Filtering Thread-Index: AQIJqDRHyN5lMNz5hbG1DJ8waeV4ig== Date: Sun, 5 Dec 2021 16:23:30 +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: [v5Y6fF9INrHcgZhcz2AXuyexi+E/ogFODy6boYrmtx3FxPMMrtacVM0CMY7dMqRL] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b27c8a86-1e83-4db2-b502-08d9b80b9381 x-ms-traffictypediagnostic: DM8P223MB0368: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bdnPpip7/5R0OVMZG7A1oN7riRvsKZ/GDyQiFAQDQCtYQxjpM2O1WhAQ7SLlFln1lNEQR9NyA9vM/4WQSfi6YPk0ecfb8Ti8IyYdEA3L2LZlPmoVFE2+Haxt9AtHRKl8JpVEHUYNdEAfEI9QqIj2Pvigvf22lBNRDhhHL3y5MvTYQV0kD7X4FUEUiy3K1WUDKsi5zpkakP1nM/1Lb8+HYTuH5eH4x3cNAFnV08WH5O1jsMlbkoRDx7tdcctJJqstuL+gq9LtVkUnOqPiRc/njnZQ5CcXw+f9pYbkdx8DDIcfD7IGwfsPjIazFjuYEqq29/dp32q3XXRyZcXTQfuKa1AuOiGmci1x+3zdK4zhbOm7YxJAZQKuvM49/AESDE1wTjcTkvL8hCVO+eV1wgMpm4JFCRSAiWIQ+RPCTv6MJuUdnpefYdtvPTHe+hyyl+RLvIM/HXrADhFMX3VlsbmW0PbFtIMyW0PZU5kPSWqe3I08K1osrYtcb8tAmvFFNCAaVmNwO3ysDl0WtjpmZ/EFwTa5HqPlVyyBl3ws+JRAMMIIVFyd98shBh8eWV7NDjIkb+q7IS0IY/33Iq2w7F2D+w== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?9wkfGJKw/3bjIcY6xqjRTwl3LYkS?= =?utf-8?q?0yIKGFiRa6wi/v5Ceufw25d3603sq7qLv0M66hI4YbiBa5Z5ADNjnFFJDz9aAxXe2?= =?utf-8?q?dne+NhGLZUafqsze2KeMYaavHlXFn+bajxZJMQJqzq7WADlN8ElO8GefIq4ep3S6J?= =?utf-8?q?ZJjlVfso9Kt0/Nubo1fRWalAv9VXFCCoYwil4b3HDWhX+f5iwxxyJkLs0aCgDQVcv?= =?utf-8?q?ZUK3t46YtyRhNyI5I8vPX0MRlv9HqzDO6/Kh4tmyt4NEmld4J7TgfFEtPQdU/tGIm?= =?utf-8?q?fc+YYDDKP5LReps8uzqYz9o1TV+yK7jD2uTBaWR9/1ZuUdTIIT7/+gPXJWA7VeKCq?= =?utf-8?q?t/FADshHYJWOyWVl3ucW7XocsJgeS/IHkU7kEpluGZdUKxo1sJuRr4IS3/9a+avzw?= =?utf-8?q?4Da+KYHq08Zq0VmvuOdmB7c+DsGueNlpPT1ewyEOfM5/RtMgRN+6NCK5gMk8NjMkY?= =?utf-8?q?fARVR+H5Vk6PzHUybcEw2WQ4JBVwuUGavM/8DsbdMihbvX3fWJD79BMJaw+6ncrQ9?= =?utf-8?q?tSWFy4SHC8nyRaTxx0/yZvMBbX3RYbjsE2k7VTbH5CkrjXijFlmHqNQuiBxuFyvTh?= =?utf-8?q?5tYJ/jinMIHP4YkIFxMs+TfCT4V2wajPczk5145vXauC+PcLubrd+Ml0F668O1fP8?= =?utf-8?q?kuSi6aLhXagOK6CziY7goWy4JIGUF5ftPGd9dtmRvV+2zcO9FlTXPV1uiHbrBV1gi?= =?utf-8?q?6jDVbNCjrDUiG7sTJO7thoLQtaNtRUl5r5vWFjfvCdBfDjFkOjhMV18rvl0CErgvx?= =?utf-8?q?h2ZjjHftiVa4wDYb3VWZd5smN6N0IMWDJal+dMCblBkeU4WZCjvMSSsrh+ztYk2uX?= =?utf-8?q?ltZOfjZznPYionY5CzHMjdsK1QKgl0DDHkUcj0KEtvAxD7M8T1VJ4SZebJZI20uSa?= =?utf-8?q?ra/4Qq1ex9VIMAfPqi2cXvgj4u12zsbKvfhJn/ZLTJv7AITicZH0/z3nRit4oXuBI?= =?utf-8?q?JBHoUzte16cDSSaMV1ti49DwcFrsAkIZY5dhvsu6zzQ=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: b27c8a86-1e83-4db2-b502-08d9b80b9381 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2021 16:23:30.7632 (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: DM8P223MB0368 Subject: [FFmpeg-devel] [PATCH v20 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: i14939JnzKFY 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 | 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