I'm using FFmpeg drawtext to display subtitles in the video, but I'm worried about how to write the code to display multiple lines after a new line.There was a description that could be done by /r/n in the escape, but I don't know how to write the actual code.If you have any experience in implementing it, please let me know.Thank you for your cooperation.
ffmpeg
This Drawtext|Nicolab that describes the characters is easy to file (top with the proviso in Windows).
However, there seems to be no way to control the space between the lines.
It may have changed since it was a question from May 2012.
Control spacing between multiple lines with drawtext filter
You are trying to use a drawtext filter to draw multiple lines of text in a video.
However, the spacing between the lines is too narrow, and the spacing actually appears to be zero.
Does anyone know how to control line spacing with this filter?
Comments:
There are currently no such parameters. Patches are welcome.
As a workaround, you can pass the source video through two separate drawtext filters and write one line for each filter instance.
Similar to the workaround above, there seems to be a two-line specification using the [in][out] tag and comma in text instead of the file.
FFmpeg drawtext over multiple lines
A:
This answer is probably a little slow for you, but you can specify multiple draw texts in a file by using the [in] tag and using commas to list each draw text.
This allows you to use multiple lines to orient each draw text in its own placement.
In your example, the command line looks like this (place the first line in the middle of the screen and each subsequent line 25 pixels below):
ffmpeg-itest_in.avi-vf "[in]drawtext=fontsize=20:fontcolor=White:fontfile='/Windows/Fonts/arial.ttf':text='onLine1':x=(w)/2:y=(h)/2,drawtext=fontsize=20:fontcolor(h)/2)+50[out]"-y test_out.avi
Also, there is an article saying that you can simply add \r\nto text, and I think you referred to it, but it is not clear because there is a comment that \n is not working.
Make a new line with drawtext in FFmpeg
If you want to use FFmpeg's draw text (multiple line), you can use Form Feed\f^L
\nComments about not working
Drawtext complex filter-multiple line#488
If you look here at 10.53.2 Text expansion, you'll be able to do something.
There seems to be another way to use subtitles instead of drawtext.
Another interpretation of subtitles or textual videos with ffmpeg
FFMPEG:Creating video using draft text along with word wrap and padding
© 2024 OneMinuteCode. All rights reserved.