From: Traian Coza <traian.coza@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Traian Coza <traian.coza@gmail.com>
Subject: [FFmpeg-devel] [PATCH 02/12] Render only when necessary
Date: Tue, 3 May 2022 12:13:18 -0400
Message-ID: <20220503161328.842587-3-traian.coza@gmail.com> (raw)
In-Reply-To: <20220503161328.842587-1-traian.coza@gmail.com>
---
fftools/ffmpeg.c | 12 ++++++++++--
libavfilter/vf_subtitles.c | 1 -
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 53717d3ebb..dea2aec2ce 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2422,9 +2422,8 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
goto out;
ist->frames_decoded++;
-
- render_avsub_ass(ist, &subtitle);
+ int rendered = 0;
for (i = 0; i < nb_output_streams; i++) {
OutputStream *ost = output_streams[i];
@@ -2432,6 +2431,15 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
|| ost->enc->type != AVMEDIA_TYPE_SUBTITLE)
continue;
+ if (avcodec_descriptor_get(ost->enc_ctx->codec_id)->props & AV_CODEC_PROP_BITMAP_SUB)
+ if (avcodec_descriptor_get(ist->dec_ctx->codec_id)->props & AV_CODEC_PROP_TEXT_SUB)
+ if (!rendered) {
+ render_avsub_ass(ist, &subtitle);
+ for (int r = 0; r < subtitle.num_rects; r++)
+ subtitle.rects[r]->type = SUBTITLE_BITMAP;
+ rendered = 1;
+ }
+
do_subtitle_out(output_files[ost->file_index], ost, &subtitle);
}
diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
index f751786033..16f9c3fff6 100644
--- a/libavfilter/vf_subtitles.c
+++ b/libavfilter/vf_subtitles.c
@@ -307,7 +307,6 @@ void render_avsub_ass(InputStream *ist, AVSubtitle *sub)
rect->data[0][y_rect * rect->w + x_rect] = color;
}
}
- rect->type = SUBTITLE_BITMAP;
ass_free_track(track);
}
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-05-03 16:14 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 01/12] Implemented text to bitmap subtitles! Traian Coza
2022-05-03 16:13 ` Traian Coza [this message]
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 03/12] Retreive width and height from video stream! Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 04/12] Initialize ass library only once! Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 05/12] Cleaned up Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 06/12] Wrote proper headers Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 07/12] Close libass after using Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 08/12] Added standard headers Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 09/12] Rearranged files, all tests are passing! Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 10/12] " Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 11/12] Added logging Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 12/12] Added more logging Traian Coza
2022-05-03 16:20 ` [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Paul B Mahol
2022-05-03 16:51 ` Nicolas George
2022-05-03 17:01 ` Traian Coza
2022-05-03 17:05 ` Leo Izen
2022-05-03 17:09 ` Traian Coza
2022-05-03 16:27 ` Soft Works
2022-05-04 0:16 ` Soft Works
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220503161328.842587-3-traian.coza@gmail.com \
--to=traian.coza@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git