简体   繁体   English

ffmpeg游戏中时光倒流非常慢

[英]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. 在H.265 4K 60fps视频中创建600x间隔拍摄。 I just want ffmpeg to pick every 600th frame and put it together to a new 60fps video. 我只希望ffmpeg每600帧选择一次,然后将其放到新的60fps视频中。 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 不过,在最新的i5-7600T CPU上,我只能获得0.2 fps,而使用

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

gives me 5 fps. 给我5 fps。 So why is speeding the video up 25x times slower than just converting it? 那么,为什么将视频加速比仅转换视频慢25倍? Is it doing any nifty interpolation for each frame out of 600 frames or something? 它是否对600帧中的每一帧都进行了漂亮的插值?

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. 这很慢,因为您要从每666帧中选择一个。 All of those 666 frames have to be decoded and filtered before one frame can be encoded. 在可以对一帧进行编码之前,必须对所有这666个帧进行解码和过滤。 Let's say your system can decode at 333 frames per second, then your encoding speed ceiling is 0.5 fps. 假设您的系统可以每秒333帧的速度解码,那么您的编码速度上限为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. 通过仅对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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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