On 10-06-2019 09:24 PM, Jonathan Baecker wrote:
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.

Some users may want to deliberately expand the box, so this should not be forced.

What do you think about this solution?

-        /* 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))

I believe this will keep the last line on Mac-style text files.

Gyan
_______________________________________________
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".

Reply via email to