9

I have tried looking up a solution but all of them involve copying, say 10 seconds from 00:00:00 of the video instead of removing enough of the video starting from the end to leave only 10 seconds remaining. I have a bunch of videos that I needs exactly 18 seconds removed from the end but the total duration varies from videos to video. Is this not possible to automate using ffmpeg or some other program?

Icarus
  • 127

1 Answers1

12

See Using ffmpeg to cut up video for answers on how to use ffmpeg to cut videos, with the -ss and -t flags.

To get you video duration you can use: ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 video.mp4 as seen on http://superuser.com/questions/650291/ddg#945604

So by combining both things you could do -t $(( $(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 video.mp4 |cut -d\. -f1) - 18 )) to have a duration equal to the previous one minus 18 seconds.