From patchwork Sun May 2 21:02:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oneric X-Patchwork-Id: 27562 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:cc:0:0:0:0 with SMTP id m12csp1495917pxt; Sun, 2 May 2021 14:06:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoVqLgsA2gdgRJdYNIzUoEEcrRYwGZKESV+xYcZ9KcX3RYvGgqhH8268CmY/MtcM8zMbhD X-Received: by 2002:aa7:c903:: with SMTP id b3mr16860275edt.296.1619989565791; Sun, 02 May 2021 14:06:05 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u16si9408188eje.499.2021.05.02.14.06.05; Sun, 02 May 2021 14:06:05 -0700 (PDT) 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=@oneric.de header.s=strato-dkim-0002 header.b=r0qmhCcm; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 32F3B680C51; Mon, 3 May 2021 00:06:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [85.215.255.25]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 941F0680C51 for ; Mon, 3 May 2021 00:05:54 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; t=1619989553; cv=none; d=strato.com; s=strato-dkim-0002; b=Vm5/GNDOESaunx5P3MoMNCtT9IXzQ6vS30aQAEsoPRh9+KXES85CMhSBfqTNdUW8UX BxDbHDnODB/WHRM0FSEbKb1qxOmWDA0o04bgzEzcHGbHGjHhP6CPJhM+uVbZDQwzgdxG j1GtnEWlGJ8koqud7T4RRtOTODxBhAaiGQzlo+jaZViqkY0FVwGxJSwajIy9MNS1bRDb FecwkPxCU4SdTZbVM7IsUKfqJKuiifc9y68nSywnm/G0Jcg+3sAvwuzKfUDNityb86Ot BnxCnl1nHiUk7qjbV46yn2J0E3+/urR/d9X6Sd6nOfbA2Ejp2Bqofm3GLdjNkx0gHPxb 1Fgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1619989553; s=strato-dkim-0002; d=strato.com; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=DDerrw7VvPJh0uUe8LuHHnzddA4q5YllrEo/Z7fvzNY=; b=rI/FKK98tjVy094NZbsggXL/zwGb8YAdWRrcKX/gHpfLBX0I1F4luS2ASgcoY8MJKi 48JRu3Jblq66OEz0IQoPiOIwnSVz5H4Bvvn0F6O9e+RzoSK9wU10vRUyAVYfrlzPMy6v U+x1u35DFyIfXyb9wnul1hFURU5OCL0kpWdRpE7MbWeWhOAwScSVVGUTDvLuF9b5Zngq K7VSmCxjLM8sXK9kkF/Iy4VUrsgyw/ObShZ/BbGpRIWJFvtwVd8VExLLhSHojLMG2P9Z nJsys3i3jdieH+rSJaC/Ab49PU5QSFFhLOu9Sulddeg1o87emuE1NbVwq34ZsJ9OFsAF D3Uw== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1619989553; s=strato-dkim-0002; d=oneric.de; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=DDerrw7VvPJh0uUe8LuHHnzddA4q5YllrEo/Z7fvzNY=; b=r0qmhCcmlQBuiJ19Fgg00ZaHzNxfAx5KgFrFc7Ab7wCdqnd/6JBFy9TEK173XyDBGw W/yBzunGAKrlQBCxzAD2PcEaVqwYy2LMQ0z85jn+FqgKF65yKmrViTvXgb7MKly1FkOm /3eNIirhtvDbU5qeJ16TkGonzZGttBGmKsc/w/zp8BzHVct/cEcye/1OJduYUEjZTGec 6s+U98A5nLGu5mB8dBb5+EVYbkFQ3NngmvTbqp8xsWu57BvCx410Q6FnhBrOoC7UQHuw +Zx/lar1DfopZ/bKRnhPeeQlfG3bPljYW7vkYT+Qyt8bMZenUfQOaIFl50TKJ3BfMI6B npAQ== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":I2IBZ0mrW/AWQXwgB4oxKM1YsW1lFUznrLvi/XReWqAAlWwZ8wlvfXmGs4jUQ0szD/eswQ0XkYWmzNcsZGdWug73vP6CpeTIL+RAt2Et" X-RZG-CLASS-ID: mo00 Received: from koenig-desktop.workgroup by smtp.strato.de (RZmta 47.25.2 AUTH) with ESMTPSA id L088d9x42L5pwUB (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sun, 2 May 2021 23:05:51 +0200 (CEST) From: Oneric To: ffmpeg-devel@ffmpeg.org Date: Sun, 2 May 2021 23:02:02 +0200 Message-Id: <20210502210201.25045-1-oneric@oneric.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avfilter/vf_subtitles: allow using embedded fonts 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 Cc: Oneric Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: gm5yZ0K/Fyxg ASS subtitles can have encoded fonts embedded into the subtitle file itself. Allow libass to load those, to render subs as intended. --- A sample file for ASS with embedded font can be at the following link. If everything works, the 'A' will render as a quad; see image: https://raw.githubusercontent.com/TheOneric/libass-regression-tests-tmp/master/regression/embedded-font/efont.ass https://raw.githubusercontent.com/TheOneric/libass-regression-tests-tmp/master/regression/embedded-font/efont-1000.png Prior to libass commit 1140b6b885c89d37eef13dc1f31f144e9a76a4d7, included in libass release 0.15.1, a libass-bug would have prevented this from actually working. To test this a recent libass is therefore required. 'ass_extract_fonts' itself however has been part of libass' API ever since its first standalone release, so calling this does not break compatibility with older versions and at worst just nothing happens. Use eg the follwoing to check: ./ffmpeg -f lavfi -i "color=cyan:640x480:d=5" -vf "ass=efont.ass" -f matroska - | ./ffplay -autoexit - --- libavfilter/vf_subtitles.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c index 493eb5f424..ab32e1b7f3 100644 --- a/libavfilter/vf_subtitles.c +++ b/libavfilter/vf_subtitles.c @@ -111,6 +111,7 @@ static av_cold int init(AVFilterContext *ctx) ass_set_message_cb(ass->library, ass_log, ctx); ass_set_fonts_dir(ass->library, ass->fontsdir); + ass_set_extract_fonts(ass->library, 1); ass->renderer = ass_renderer_init(ass->library); if (!ass->renderer) {