0

I'm using this command to scroll text on video

"drawbox=y=ih-108:color=blue@0.4:\
width=iw:height=48:t=fill, \
drawtext=textfile=file.txt: \ 
fontfile=OpenSans-Regular.ttf: \
y=h-line_h-65:\
x=w-mod(max(t-1.5\,0)*(w+tw)/18.5\, (w+tw)): \
fontcolor=white:fontsize=36" \

This scroll runs in loop with gap. When all the text is scrolled on video [there's a gap] then it restarts the scroll.

I want scroll to run continuously without any gap like in this video - https://www.youtube.com/watch?v=Z0ZpLAgpghk

Is there any other filter to accomplish this or how do i modify the x= expression to get desired output?

0

You can achieve this by chaining two drawtext filters

"drawbox=y=ih-108:color=blue@0.4:\
width=iw:height=48:t=fill, \
drawtext=textfile=file.txt: \ 
fontfile=OpenSans-Regular.ttf: \
y=h-line_h-65:\
x=w-mod(max(t-START_TIME_OFFSET\,0)*(SPEED)\, 2*(tw+MARGIN)): \
fontcolor=white:fontsize=36, \
drawtext=textfile=file.txt: \ 
fontfile=OpenSans-Regular.ttf: \
y=h-line_h-65:\
x=w-mod(max(t-(tw+MARGIN)/(SPEED)-START_TIME_OFFSET\,0)*(SPEED)\, 2*(tw+MARGIN)): \
fontcolor=white:fontsize=36"

START_TIME_OFFSET is the initial time when the text appears e.g. 1.5 seconds.
SPEED is the scrolling distance for one character per second e.g. 100 pixels or 1/10th the width, w/10.
MARGIN is the distance between the end of one scroll and the start of the next e.g. 100 pixels or proportional distance w/5.

For this method, text has to be equal to or wider than frame width.

| improve this answer | |
  • I'm getting error msg - [h264 @ 0x55bd20ad7200] co located POCs unavailable [h264 @ 0x55bd20af8500] co located POCs unavailable [Parsed_drawtext_3 @ 0x55bd20af3480] Failed to configure input pad on Parsed_drawtext_3peed=N/A Error reinitializing filters! Failed to inject frame into filter network: Invalid argument Error while processing the decoded data for stream #0:0 [aac @ 0x55bd20a83140] Qavg: 152.432 [aac @ 0x55bd20a83140] 2 frames left in the queue on closing Conversion failed! – Ramjivan Jangid Dec 23 '19 at 12:37
  • That's an input file decoding error - unrelated to filtering. – Gyan Dec 23 '19 at 13:09
  • input file is ok. It's working with previous command i posted – Ramjivan Jangid Dec 23 '19 at 14:06
  • Add -report and rerun. Share report. – Gyan Dec 23 '19 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.