Delete frame in video with ffmpeg - ffmpeg

I have a video at 24 frames per second. I understand that means that 24 images will appear in 1 second in a row? Is that wrong? If that is true, can each image be deleted and edited in 24 images that appear on that 1 second? and can ffmpeg do that? This is just an idea I suddenly thought of to be able to interfere more deeply with an existing video. Anyone think like that?

Yes, 24 frames per second means there are 24 images (each image is a frame) in each second. ffmpeg can extract that sequence of frames. ffmpeg can assemble a sequence of frames to create a video. You are free to edit/photoshop/replace the frames in between those two steps; ffmpeg can't prevent that and won't be bothered by it (so long as the image dimensions remain the same as all the other frames).

Related

Is there any way to "squeeze" all of a video's frames to a constant frame rate using ffmpeg?

I have a video that is very jumpy. It freezes after every couple of seconds, and running the MediaInfo reveals a frame rate of 23.701fps. The original video has 23.976fps and is shorter than the faulty version by a couple of seconds. This plays fine on VLC. They both have the same size so it looks like the faulty one has some frames stretched over to fit the additional seconds. Is there an ffmpeg command I can use to repair this video?
Thanks.

How to calculate the number of frames extracted at certain FPS?

I have a bunch of videos in a folder at different fps. I need to calculate the number of frames that can be extracted at 0.5 fps.
Its kind of a simple mathematical problem, I need help on the formula.
Thanks
if the duration of video is t and I am assuming that's when the ffmpeg will terminate then it should ideally return you t/2 frames.

How to specify the exact number of output image frames with ffmpeg?

I have N input animation frames as images in a folder and I want to create interpolated inbetween frames to create a smoother animation of length N * M, i.e. for every input frame I want to create M output frames that gradually morph to the next frame, e.g. with the minterpolate filter.
In other words, I want to increase the FPS M times, but I am not working with time as I am not working with any video formats, both input and output are image sequences stored as image files.
I was trying to combine the -r and FPS options, but without success as I don't know how they work together. For example:
I have 12 input frames.
I want to use the minterpolate filter to achieve 120 frames.
I use the command ffmpeg -i frames/f%04d.png -vf "fps=10, minterpolate" -r 100 interpolated_frames/f%04d.png
The result I get is 31 output frames.
Is there a specific combination of -r and FPS I should use? Or is there another way I can achieve what I need?
Thank you!
FFmpeg assigns a framerate of 25 to formats which don't have an inherent frame rate, like image sequences.
The image sequence demuxer has an option to set a framerate. And the minterpolate filter has an option for target fps.
ffmpeg -framerate 12 -i frames/f%04d.png -vf "minterpolate=fps=120" interpolated_frames/f%04d.png

FFMPEG - convert into variable framerate by removing duplicate frames

I have slideshow video (i.e. 10GB) 1080p quality (30 FPS), and each image lasts about 15 seconds ...
Is there any option with FFMPEG, to convert those 15 seconds periods from 30 FPS(because they are just duplicate frames) into i.e. 1 fps, thus, making the video small size...
the only periods that should keep original FPS is the fadeout period from image to image (that lasts 3 seconds... they are not duplicate frames, each frame is different because of fade-out effect).
You just need to re-encode with ffmpeg using a mid CRF value, like between 24-27. I-frames will be smaller but mainly P-frames which are static will only take few dozen bytes to store. Actually decimating the static frames and keeping the fade sequences at full FPS can be done but will be cumbersome and subject to trial and error. Just doing a simple re-encode will get you most of the size savings you would have gotten
Basic command is
ffmpeg -i in.mp4 -crf 25 -c:a copy out.mp4

In ffmpeg, can I specify time in frames rather than seconds?

I am programatically extracting multiple audio clips from single video files using ffmpeg.
My input data (start and end points) are specified in frames rather than seconds, and the audio clip will be used by a frame-centric user (an animator). So, I'd prefer to work in frames throughout.
In addition, the framerate is 30fps, which means I'd be working in steps of 0.033333 seconds, and I'm not sure it's reasonable to expect ffmpeg to trim correctly given such values.
Is it possible to specify a frame number instead of an ffmpeg time duration for start point (-ss) and duration (-t)? Or are there frame-centric ffmpeg commands that I've missed?
Audio frame or sample numbers don't correspond to video frame numbers, and I don't see a way to specify audio trim points by referencing video frame indices. Nevertheless, see this answer for more details.

Resources