I need to create a smooth 'news ticker' on a low powered android device. Unfortunately this is impossible at runtime using HTML or native code as there is always some stutter or glitch.
I've created a solution that gives me a smooth result by encoding an mp4 for each message and displaying one video after the other. This is the code I'm using:
ffmpeg -f lavfi -i color=c=black:s=1280x100 -vf "drawtext=BebasNeue.otf:fontsize=60:fontcolor=white:y=h-line_h-30:x=-(4*n)+1280:text='Hello world'" -t 10 output.mp4
Problem: I need to set the video's duration dynamically so that the video stops when the text has completed it's journey from right to left. The messages will be of varying lengths and I need each message to scroll at a constant speed (ie. an mp4 with a longer message would have a longer duration).
Is this possible via an expression? If not is there some clever way I can calculate this outside of ffmpeg and pass it to the '-t' (duration) parameter?
** Edit ** To calculate outside of ffmpeg I can do a calculation like video_width + text_width / video_fps (ie. 1280 + 262 / 25) to give me the duration. So now I'm just looking to see if this is possible within the ffmpeg command line itself. t
Many thanks