I have a video on which I want to have a text box on top of the video for this purposes I am using ffmpeg's following code `import subprocess

def byte(): video = "assets/byte/bite.mp4" command = [ "ffmpeg", "-i", video, "-filter_complex", "[0:v]drawtext=text='name of the person':fontcolor=black:x=20:y=20:enable='between(t,0,10)'[text];" "color=white:s=2000x50:d=10[bg];" "[bg][text]overlay=10:10:enable='between(t,0,10)'", "-map", "0:v", "finalbite.mp4" ] subprocess.run(command) return "finalbite.mp4"

byte() ` But the code is returning a video file containing just a white stripe with video frame dimensions as of that white line and video duration of input video I am wondering what might be wrong ?

  • You draw text on video and overlay on color=white. Change chains to: ...complex "color=white...,drawtext=...[text]; [0:v][text]overlay.... And remove -map 0:v Apr 24 at 4:38
  • still not working. the code is producing a video with only a white horizontal bar in the whole video with the sound of the video and a black background.
    – nish
    Apr 29 at 0:44
  • try this filter chain: color=white:s=2000x50:d=10, drawtext=text='name of the person':fontcolor=black:x=20:y=20:enable='between(t,0,10)'[text]; [0:v][text]overlay=10:10:enable='between(t,0,10)' Apr 29 at 2:10


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.