Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 494
requiem31 Avatar asked May 25 '15 19:05

requiem31


People also ask

How do I re-encode the output of FFmpeg?

If you leave out the -c copy option, ffmpeg will automatically re-encode the output video and audio according to the format you chose. For high quality video and audio, read the x264 Encoding Guide and the AAC Encoding Guide, respectively. I think you can use the following command now. Have a look also ffmpeg Doc, or this wiki page.

How fast does keyframe seeking work with ffmpeg?

At 1 second, it works as expected. As explained in FFmpeg Seeking, using -ss as an input parameter (before -i) while copying, or even transcoding with an older version of FFmpeg, employs keyframe seeking. This is much faster, but sacrifices accuracy.

What is the difference between -SS and -C in FFmpeg?

Here, the options mean the following: -ss specifies the start time, e.g. 00:01:23.000 or 83 (in seconds) -t specifies the duration of the clip (same format). Recent ffmpeg also has a flag to supply the end time with -to. -c copy copies the first video, audio, and subtitle bitstream from the input to the output file without re-encoding them.

What is the best alternative to FFmpeg for video editing?

While FFmpeg is very powerful it can also be verbose and cumbersome to work with, with a steep learning curve. An easier alternative is the Shotstack video editing API - A cloud based platform that can be used to generate videos at scale and automate video generation workflows.


Video Answer


1 Answers

How about this:

ffmpeg -ss 00:00:05 -i /home/requiem/Desktop/t1.mp4 ....
like image 90
Mike Müller Avatar answered Oct 26 '22 18:10

Mike Müller