I created this issue on the bugtracker: https://trac.ffmpeg.org/ticket/7948
Here is now a patch for it. drawtext should ignore the very last newline character in text files, because many editor add automatically a newline at the end.
But when the filter draws a box behind the text, the box become to big. What do you think about this solution?
From 9a4fa45a74c95d1a56a29dafe6c5c727d83c143c Mon Sep 17 00:00:00 2001 From: jonathan <jonba...@gmail.com> Date: Mon, 10 Jun 2019 17:44:03 +0200 Subject: [PATCH] ignore last newline --- libavfilter/vf_drawtext.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index 01cd7fa122..e8c33596e9 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -1380,8 +1380,10 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame, for (i = 0, p = text; *p; i++) { GET_UTF8(code, *p++, continue;); - /* skip the \n in the sequence \r\n */ - if (prev_code == '\r' && code == '\n') + /* skip the \n in the sequence \r\n and ignore last empty line */ + if ((prev_code == '\r' && code == '\n') || + (code == '\n' && i == len - 1) || + (code == '\r' && i == len - 2)) continue; prev_code = code; -- 2.21.0
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".