Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I speed up a video by dropping frames?

I've got a video that's 30 minutes long. I want to make a speeded up version that's (say) 15 minutes long. I could do this by dropping every 2nd frame. How can I do this on linux?

I'm playing with gstreamer and it looks cool. Is there a way to do this with gstreamer? What would be the gst-launch command line to do it?

My source video is in Motion JPEG, so I do have the frames to drop. Even if it was using keyframes, there still should be a way to 'double speed' the film?

I'd like a command line way to do this since I want to automate it.

like image 725
Amandasaurus Avatar asked Aug 26 '09 14:08

Amandasaurus


People also ask

Does increasing frame rate speed up the video?

Thus, the greater the frame rate, the more realistic and smooth a video will appear. However, when slowing down film, shooting slow-motion, or filming rapid movements, the higher frame rates become truly noteworthy in that you can see far more detail with minimal skips or motion jerk.

What is a dropped video frame?

"Dropped frames" means that your connection to remote server isn't stable or you can't keep up with your set bitrate. Because of this, the program was forced to drop some of the video frames in order to compensate. If you drop too many frames, you may be disconnected from the streaming server.

How do you fast forward a video without losing quality?

Step 1: Add clip speed Clip speed allows you to play a video clip faster or slower than its original speed. To apply the clip speed effect, click and drag it from the tools panel to a clip on the timeline. Open the effects tray and drag the clip speed handles to adjust the speed of a clip.


1 Answers

I looked around for a while recently on the best way to do this. I experimented with mencoder -speed and also libavfilter's setpts option. The best way I found was to output individual frames and then re-encode those frames into a single video. This example assumes a 30fps input video for best results and drops every other frame.

# Output the video at 15fps as jpegs
ffmpeg -i input.m4v -r 15 -f image2 /tmp/output-%06d.jpg
# Re-encode the frames at 30fps as h264
ffmpeg -r 30 -i "/tmp/output-%06d.jpg" -vcodec libx264 -threads 0 -an output.m4v
like image 195
johnboiles Avatar answered Oct 12 '22 23:10

johnboiles