4

Okay, I know this question has been asked a bajillion times. However, I have one small addition to the question that I haven't seem to have been able to find in my googling.

I'm certainly not a pro at FFMPEG...I've been using the standard speed up/slow down template for FFMPEG, the one I'm using is:

ffmpeg -i input.mp4 -filter:v "setpts=PTS/60" -an output.mp4

I'm currently working with an hour long 4K/60FPS video...I want to shrink it down to about 30 seconds or so, so I'm using PTS/100, and I don't need audio...the problem is, this is taking FOREVER...which I completely expected it to.

But as I'm sitting here waiting for it to finish...I can't help but wonder...is there a faster/more efficient way to accomplish this? I know there's a lot of weird things about FFMPEG in regards to the order of the commands you use to speed up seek time, and presets and etc.

1
  • What did you finally get to work? I can't get the answer to work (and i don't have the space to turn it into bitmaps)
    – Michael
    Feb 25, 2020 at 2:30

3 Answers 3

3

You can use

ffmpeg -itsscale 0.016667 -i input.mp4 -c copy -an output.mp4

where 0.016667 is 1/60.

However, this will keep all frames, and if the input timebase doesn't have sufficient resolution, you'll have incorrect timestamps. You can work around that by creating a temp file first.

ffmpeg -i input.mp4 -c copy -video_track_timescale 90k -an temp.mp4

and then running the first command on this temp file.

4
  • Thanks, I'll give this a shot Mar 20, 2019 at 22:18
  • where did you get the timescale of 90k?
    – Michael
    Feb 25, 2020 at 2:00
  • Neither of these is working. They are both producing an output that is practically identical in size to the original file and only shows a few frames with a large delay in between in which the last frame sits unchanging on the screen.
    – Michael
    Feb 25, 2020 at 2:21
  • On trying the output video in a different player, I think this is not actually doing anything aside from changing some metadata. The second player claims it's playing the exact same video as the first one but that the frame rate is 3600x. Obviously there is no way there is enough horsepower to play it that fast, so the video player either freaks out and drops a bunch of frames, or plays it as fast as it can which is way less than 3600x. In either case, the result in not what is expected, which is the actual removal of >99.9% of the frames.
    – Michael
    Feb 25, 2020 at 2:35
1

This sequence of commands may be helpful to solve that issue:

ffmpeg -i source.avi -r 0.016667 image/image%05d.bmp  

ffmpeg -i image/image%05d.bmp -vcodec libx264 -b:v 500k -f avi video.avi
2
  • Interesting, so you're spitting out the images into individual files, and then recompiling them into a video? Mar 20, 2019 at 22:17
  • 1
    Yes, it may work very fast but it needs some free space on the disk
    – coder80
    Mar 21, 2019 at 7:05
0

That setpts filter method did not make me happy either. It takes long and the new file seems to be the same size.

I use image2pipe format to curl images directly into ffmpeg. After some trying I was able to chain it like this:

ffmpeg -i ../hama/MAH02619.MP4 -f image2pipe -r 0.1 - | ffmpeg -i - -y out.mp4

There are two dashes - to get right, and also the -r framerate option. It makes sense here at the output side of the input file: feeds the 2nd ffmpeg only one frame every 10 seconds. The new out.mp4 is 5 secs short. The original is 22 minutes and 2GB.

It took 3-5 minutes to convert/shorten/speed up.

Part of the problem is the missing docu for image2pipe format. Conceptually it is the same as image2. Maybe it IS the same and it is all about the dashes, and the pipe operator.

On ffmpeg's website there is also the "raw bitstream" method using -c copy twice. But I did not test that yet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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