1

I've found out ways to cut a video at the beginning (ss), or the end or at a certain time however now i'm trying to find a way to cut 5 seconds of the middle of any video.

So if a video runs for 3 minutes, it should cut the video between 1.30 and 1.35 and have 1 video as output. I don't even know if this is possible, but i have to give it a try here since i'm out of clues.

razz vazz
  • 11
  • 1
  • 1
    can you add re the method you used to cut from the beginning or end? it shows you did some research and makes it more clear how you are using language and what your thinking is and where you are at – barlop Apr 25 '20 at 12:01

1 Answers1

2

This will require a few steps:

  1. Get duration with ffprobe.
  2. Run ffmpeg:

    ffmpeg -ss <duration/2 - 5> -t 5 -i input.mp4 output.mp4
    
    • <duration/2 - 5> is of course half the duration value minus 5 seconds. For example, if your input has a duration of 60 seconds, your -ss value will be 25. You'll enter this value manually.

    • This can be scripted for automated usage. Your OS/shell/scripting language is unknown, but for a related example in Bash you can adapt see How to create a thumbnail from the middle of a video with FFmpeg.

llogan
  • 57,139
  • 15
  • 118
  • 145