Can You Insert Text From A File In Real Time With Ffmpeg Streaming?
I have this code i use to stream a file and place the name of the show of the video at a certain time of the video ( name_of_show ) at the top of the screen, and the bottom of the
Solution 1:
Use the reload=1 and textfile options in drawtext. From the drawtext filter documentation:
reloadIf set to 1, the textfile will be reloaded before each frame. Be sure to update it atomically, or it may be read partially, or even fail.
textfileA text file containing text to be drawn. The text must be a sequence of UTF-8 encoded characters. This parameter is mandatory if no text string is specified with the parametertext. If bothtextandtextfileare specified, an error occurs.
Example:
ffmpeg -i input.mp4 -vf "drawtext=texfile=mytext.txt:reload=1:fontsize=22:fontcolor=white" output.mp4
To update atomically you can use mv or equivalent:
mv temp.txt mytext.txt
Post a Comment for "Can You Insert Text From A File In Real Time With Ffmpeg Streaming?"