Body: <p>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</p>
  <p>def byte():
  video = &quot;assets/byte/bite.mp4&quot;
  command = [
  &quot;ffmpeg&quot;,
  &quot;-i&quot;, video,
  &quot;-filter_complex&quot;,
  &quot;[0:v]drawtext=text='name of the person':fontcolor=black:x=20:y=20:enable='between(t,0,10)'[text];&quot;
  &quot;color=white:s=2000x50:d=10[bg];&quot;
  &quot;[bg][text]overlay=10:10:enable='between(t,0,10)'&quot;,
  &quot;-map&quot;, &quot;0:v&quot;,
  &quot;finalbite.mp4&quot;
  ]
  subprocess.run(command)
  return &quot;finalbite.mp4&quot;</p>
  <p>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 ?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-24T04:38:54.817Z
Comments.Text: 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`
Comments.UserDisplayName: Баяр Гончикжапов
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-29T00:44:37.307Z
Comments.Text: 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.
Comments.UserDisplayName: nish
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-29T02:10:26.387Z
Comments.Text: 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)'`
Comments.UserDisplayName: Баяр Гончикжапов
Tags: <ffmpeg>
Title: Unable to add text box with background color in ffmpeg
UserDisplayName: nish
ThreadText: # Unable to add text box with background color in ffmpeg
  
  (Asked by: username_0 on 2024-04-23)
  
  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 ?
  
  **Tags:** ffmpeg
  
  > **Comments:**
  > **username_1**: 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`  
  > **username_0**: 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.  
  > **username_1**: 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)'`  
  
  ---
  
  ## 0 answers
  
  