videoffmpeg

ffmpeg cut first 5 seconds


I am having trouble removing the first 5 seconds of a .mp4 video. Here is what I have so far:

subprocess.call("ffmpeg -ss 00:00:00 -t 00:00:05 -i /home/requiem/Desktop/t1.mp4 -vcodec copy -acodec copy /home/requiem/Desktop/t2.mp4", shell=True)

The issue is that it just takes the first 5 second and saves it, but I want the first 5 seconds removed and the rest saved. How would I do that, or can I find the duration of the video so I can set -ss 00:00:05 and -t DURATION


Solution

  • In ffmpeg version 6.1.1-3ubuntu5 (only one I checked so far) the position of -ss in the parameter sequence has a meaning (see "man ffmpeg"):

    Before input moves the start timer (00:00:00) of video in the uncut file, before output cuts the video file:

    ffmpeg -i /home/requiem/Desktop/t1.mp4 -ss 00:00:05 -c copy /home/requiem/Desktop/t2.mp4