简体   繁体   中英

ffmpeg timelapse very slow

I'm using

ffmpeg -i IMG_5299.MOV -c:v libx264 -crf 20 -r 60 -filter:v "setpts=0.0015*PTS" -an IMG_5299-speedup.mkv

to create a 600x timelapse out of a H.265 4K 60fps video. I just want ffmpeg to pick every 600th frame and put it together to a new 60fps video. No interpolation, no nothing. Still, I only get 0.2 fps on a very recent i5-7600T CPU, while converting the same video without speedup using

ffmpeg -i IMG_5299.MOV -c:v libx264 -crf 20 -an IMG_5299-2.mkv

gives me 5 fps. So why is speeding the video up 25x times slower than just converting it? Is it doing any nifty interpolation for each frame out of 600 frames or something?

EDIT: That's the statusline I get after several minutes of encoding:

frame=  447 fps=0.2 q=28.0 size=   68639kB time=00:00:06.56 bitrate=85611.1kbits/s dup=0 drop=147650 speed=0.00233x

It's slow because you're picking one out of every 666 frames. All of those 666 frames have to be decoded and filtered before one frame can be encoded. Let's say your system can decode at 333 frames per second, then your encoding speed ceiling is 0.5 fps.

You can profile your decoding throughput using

ffmpeg -i IMG_5299.MOV -an -f null -

You can speed up encoding by only demuxing keyframe packets from the MOV.

ffmpeg -discard nokey -i IMG_5299.MOV -c:v libx264 -crf 20 -r 60 -vf "setpts=0.0015*PTS" -an IMG_5299-speedup.mkv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM