Source: /cirosantilli/ffmpeg-video-synthesis

= FFmpeg video synthesis
{c}

Video with a solid color:
* 2 second white video:
  ``
  ffplay -autoexit -f lavfi -i 'color=white:640x480:d=3,format=rgb24,trim=end=2'
  ``
  Also add some audio:
  ``
  ffmpeg -lavfi "color=white:640x480:d=3,format=rgb24,trim=end=2[v];sine=f=1000:d=2[a]" -map '[a]' -map '[v]' out.mkv
  ``
  TODO how to ffplay the video + audio directly? `-map` does not seem to work unfortunately.
* 2 second white followed by 2 second black video:
  ``
  ffplay -autoexit -f lavfi -i 'color=white:640x480:d=3,format=rgb24,trim=end=2[a];color=black:640x480:d=3,format=rgb24,trim=end=2[b];[a][b]concat=n=2:v=1:a=0'
  ``
* bibliography:
  * https://superuser.com/questions/1153930/how-to-generate-a-pure-white-background-video-with-ffmpeg

Display count in seconds on the video:
* black text on white background. Start from 0 and count up to 2:
  ``
  ffplay -autoexit -f lavfi -i "
  color=white:480x480:d=3,
  format=rgb24,
  drawtext=
    fontcolor=black:
    fontsize=600:
    text='%{eif\:t\:d}':
    x=(w-text_w)/2:
    y=(h-text_h)/2
  "
  ``
* bibliography:
  * https://gist.github.com/derand/31b8312fd64156120cb8f45825a1f0f7
  * https://www.reddit.com/r/ffmpeg/comments/11kxugt/make_a_video_timer_or_countdown/