casfast.blogg.se

Ffmpeg filter text
Ffmpeg filter text




ffmpeg filter text

Show text between 5-10 seconds: ffmpeg -i input.mp4 -vf "drawtext=fontfile=/path/to/font.ttf:text="Stack Overflow":fontcolor=white:fontsize=24:box=1: :boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2:enable="between(t,5,10)"" -codec:a copy output.mp4 Use the enable option to control when the text appears.

  • Scrolling from RIGHT to LEFT in ffmpeg / drawtext.
  • ffmpeg filter text

  • Loop text that wipes left to right using FFMPEG drawtext filter.
  • Moving / animated / looping / scrolling text See ffmpeg cli filter that require user input. See Sendcmd in ffmpeg and FFmpeg drawtext filter – is it possible to use variables with live data for x,y coordinates?
  • sendcmd if you have predetermined positions and timing.
  • ffmpeg filter text

    You can reposition the text with the sendcmd and zmq filters: You can chain multiple drawtext filters: ffmpeg -i input.mp4 -vf "drawtext=fontfile=/path/to/font.ttf:text="Stack Overflow":fontcolor=white:fontsize=24:box=1: :boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2,drawtext=fontfile=/path/to/font.ttf:text="Bottom right text":fontcolor=black:fontsize=14:x=w-tw-10:y=h-th-10" -codec:a copy output.mp4 You can use ffplay to preview your text without having to wait for a file to encode: ffplay -vf "drawtext=fontfile=/path/to/font.ttf:text="Stack Overflow":fontcolor=white:fontsize=24:box=1: :boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2" input.mp4Īlternatively you can use mpv but the syntax is slightly different: mpv -vf="lavfi=:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2]" input.mp4

  • See the drawtext filter documentation for a complete list and explanations of options.
  • Remove if you do not want any transparency.
  • The audio is stream copied in this example (like a copy and paste).
  • Print Stack Overflow in white text onto center of video, with black background box of 50% opacity: ffmpeg -i input.mp4 -vf "drawtext=fontfile=/path/to/font.ttf:text="Stack Overflow":fontcolor=white:fontsize=24:box=1: :boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2" -codec:a copy output.mp4 This answer focuses on the drawtext filter. If you need more complex timing, formatting, or dynamic text see the subtitles filter. Use the drawtext filter for simple text on video.






    Ffmpeg filter text