Can you insert text from a file in real time with ffmpeg streaming?

后端 未结 1 1044
长情又很酷
长情又很酷 2021-01-23 07:06

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 t

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-23 07:46

    Use the reload=1 and textfile options in drawtext. From the drawtext filter documentation:

    reload
    If 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.

    textfile
    A 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 parameter text.
    If both text and textfile are 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
    

    0 讨论(0)
提交回复
热议问题