martins
martins

Reputation: 451

ffmpeg from hh:mm:ss to seconds

I have several video files with seconds at which I need to cut (i.e. from 0 to 30seconds I want a first subclip, from second 30 to 59 I want a second subclip,...). Is there a way to use these seconds instead of the hh:mm:ss format ffmpeg seems to ask? By now, I have the following code:

ffmpeg -i firstvideo.mp4 -vcodec copy -acodec copy -ss 00:00:00 -t 00:00:30 firstvideo1.mp4 -vcodec copy -acodec copy -ss 00:00:30 -t 00:00:59 firstvideo2.mp4 -vcodec copy -acodec copy -ss 00:01:00 -t 00:01:30 firstvideo3.mp4 -vcodec copy -acodec copy -ss 00:01:30 -t 00:01:45 firstvideo4.mp4'

But instead of "-ss 00:00:00 -t 00:00:30" in the first video subclip, I would like to write "-ss 0 -t 30" (i.e. from 0 to 30 seconds), and so on...

Thank you very much

Upvotes: 0

Views: 657

Answers (1)

martins
martins

Reputation: 451

The final code looks like:

ffmpeg -i firstvideo.mp4 -vcodec copy -acodec copy -ss 0 -to 30 firstvideo1.mp4 -vcodec copy -acodec copy -ss 30 -to 59 firstvideo2.mp4 -vcodec copy -acodec copy -ss 60 -to 90 firstvideo3.mp4 -vcodec copy -acodec copy -ss 90 -to 105 firstvideo4.mp4

Upvotes: 2

Related Questions