如何通过丢帧来加快视频速度? [英] How can I speed up a video by dropping frames?

查看:465
本文介绍了如何通过丢帧来加快视频速度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个30分钟的视频。我想加快一个15分钟长的版本。我可以通过删除每第二帧来做到这一点。我如何在linux上这样做?



我正在玩gstreamer,看起来很酷。有没有办法使用gstreamer? c code code code code code code code code code code code我确实有帧丢弃。即使是使用关键帧,仍然应该有一种方法来加倍电影?



我想要一个命令行方式来做到这一点,因为我想要自动化。

解决方案

我最近环顾​​了一段时间,最好的方法是这样做。我尝试使用mencoder -speed以及libavfilter的setpts选项。我发现最好的方式是输出单个帧,然后将这些帧重新编码为一个视频。这个例子假设一个30fps的输入视频获得最佳效果,并且每隔一帧就会下降。

 #以15fps输出视频为jpegs 
ffmpeg -i input.m4v -r 15 -f image2 /tmp/output-%06d.jpg
#以30fps重新编码帧为h264
ffmpeg -r 30 -i/ tmp /output-%06d.jpg-vcodec libx264 -threads 0 -an output.m4v


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.

解决方案

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

这篇关于如何通过丢帧来加快视频速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆