0

I'm new to using ffmpeg for modifying video content, and I was looking for help creating a command to do the following:

  1. Trim the first 4
  2. Trim the last 4 seconds of a video
  3. Add a 1 second fade to beginning and end
  4. Include a watermark in the bottom right corner

I've been able to find examples of doing each of these individually, but am not sure--syntactically--if it's possible to do all 4 of these things in a single command.

Any help is appreciated!

kmancusi
  • 541
  • 2
  • 13
  • Is there audio in the file too, and do you need it to be trimmed as well? Should the watermark show at all times, or should it fade too? – llogan Mar 24 '20 at 02:30
  • @llogan, audio is from video camera (not a separate recording), and ideally I would like to have a watermark that fades with the video (in and out) – kmancusi Mar 24 '20 at 03:40

1 Answers1

0
  1. Get duration with ffprobe.
  2. Run ffmpeg. Example if duration is 30 seconds:

    ffmpeg -ss 4 -to 26 -i input.mp4 -i watermark.png -filter_complex "[0:v][1]overlay=x=W-w-10:y=H-h-10,fade=t=in:d=1,fade=t=out:d=1:st=21[v];[0:a]afade=t=in:d=1,afade=t=out:d=1:st=21[a]" -map "[v]" -map "[a]" output.mp4
    

See FFmpeg Filter Documentation for more info and How to add and position watermark with ffmpeg?

llogan
  • 87,794
  • 21
  • 166
  • 190