Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FFMPEG to trim off last 3 seconds of videos

I am trying to trim/cut off the last 3 secs of my videos with FFMPEG but this has really been an headache.

The following code trims but only retains the last 3 seconds. I don't want to retain the 3 secs, i don't need that, i want to retain the deleted part.

ffmpeg -sseof -3 -i input.mp4 output.mp4

Can someone please help me with the right code?. I will also like to request a batch code that will auto trim all last 3 secs of videos in my folder. Thanks for the help.

like image 554
humble5050 Avatar asked Dec 13 '22 12:12

humble5050


1 Answers

Cut video with ffmpeg.

use

ffmpeg -i input.mp4 -ss 3 -i input.mp4 -c copy -map 1:0 -map 0 -shortest -f nut - | ffmpeg -f nut -i - -map 0 -map -0:0 -c copy out.mp4
like image 135
nico_lab Avatar answered Dec 28 '22 10:12

nico_lab