title: FFMPEG add text frames to the start of video
body: <p>I have some videos either in mp4 or webm format, and I'd like to use ffmpeg to add 4 seconds to the start of each video to display some text in the center with no sound. </p>
  
  <p>Some other requirements:</p>
  
  <ul>
  <li>try to avoid re-encoding the video </li>
  <li>need to maintain the quality (resolution, bitrate, etc) </li>
  <li>(optional) to make the text fade in/out</li>
  </ul>
  
  <p>I am new to ffmpeg and any help will be appreciated. </p>
  
  <p>thanks in advance</p>
  
  <p>Example ffprobe information for mp4 below:</p>
  
  <pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
    Metadata:
      major_brand : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf55.33.100
    Duration: 00:00:03.84, start: 0.042667, bitrate: 1117 kb/s
  Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 1021 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
  Metadata:
    handler_name    : VideoHandler
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 140 kb/s (default)
  Metadata:
    handler_name    : SoundHandler
  </code></pre>
  
  <p>Example webm</p>
  
  <pre><code>Input #0, matroska,webm, from 'input.webm':
    Metadata:
    encoder         : Lavf55.33.100
   Duration: 00:00:03.80, start: 0.000000, bitrate: 1060 kb/s
     Stream #0:0(eng): Video: vp8, yuv420p, 1280x720, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
     Stream #0:1(eng): Audio: vorbis, 48000 Hz, stereo, fltp (default)
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/lBghk.png" rel="nofollow">Screenshot from joined.mp4</a></p>
  
  <p><a href="http://i.stack.imgur.com/why00.png" rel="nofollow">Screenshot for step 3 console</a></p>