0

I want to cut a video with FFmpeg using something similar to the code below:

ffmpeg -i movie.mp4 -ss 00:00:03 -t 00:00:08 -async 1 cut.mp4

However I want to specify -ss and -t in frames instead of in seconds. For example, instead of 3 seconds I would want to tell ffmpeg to start the cut at 90 frames. I want to do this because I am going to be cutting videos using a script and I don't want to overcomplicate things by having to convert the frame numbers into seconds before passing it to FFmpeg.

Simply specifying a number like -ss 90 starts the cut at 90 seconds in, not at 90 frames.

3

I believe you should be able to accomplish this using the select filter. However, when using a video filter, you will no longer be able to stream copy - instead, you will have to transcode the file by choosing a codec with the c:v flag.

For example, to create a cut starting at the 90th frame, and producing an output that is 1000 frames long, and transcoding the output into an H264 format, you could try:

ffmpeg -i [INPUT] -vf select=gte(n\,90) -vframes 1000 -c:v libx264 -f mp4 [output.mp4]

0

There is no way to do exactly what you are asking.

You can use -frames to process a desired number of frames but using a frame number as the starting position isn't possible.

  • So would -frames replace -t here? – mxbi Aug 12 '15 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.