FFMpeg连续实时图像到视频编码 [英] FFMpeg Continuous Real-time Image to Video Encoding

查看:135
本文介绍了FFMpeg连续实时图像到视频编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用FFMpeg来获取图像文件流并将其转换为视频.现在,我已经成功完成了此操作,但前提是已经捕获了所有想要的图像.我想做的就是将图像转换为视频,然后将它们保存到磁盘(实时录像机)中.当前,当我仍在抓取帧时调用FFMpeg时,它仅对调用时存在的图像数量进行编码.如果每次抓取图像都调用FFMpeg,它将使CPU充满大量进程.理想情况下,FFMpeg将继续对图像进行编码,直到没有更多图像被捕获为止(即,检查自首次调用以来是否还有更多图像文件).我是否缺少针对FFMpeg的论点,或者这不可能吗?还是通过弄乱库来做到这一点的唯一方法?

I am trying to use FFMpeg to take a stream of image files and turn them into a video. Now, I have successfully done this, but only after I have already captured all the images that I want. What I would like to do is turn the images into a video as they are saved to disk (real-time video recorder). Currently, when I call FFMpeg while frames are still being grabbed, it only encodes the number of images that are present when it is called. If FFMpeg is called every time an image is grabbed, it floods the CPU with a ton of processes. Ideally, FFMpeg would continue to encode the images until there are no more images being captured (I.E., check if there are more image files since it was first called). Is there an argument for FFMpeg that I'm missing, or is this not possible? Or is the only way to do this through messing around with the libraries?

推荐答案

我不喜欢的一种解决方案是: 在Mpeg2 VOB中编码基本视频. 每X帧编码最后X帧的新视频. 由于VOB文件没有文件头,因此您可以将新文件的二进制文件附加到现有的VOB中. FFMPEG只需要在几个帧上运行.其他一些视频格式也可以使用.

One solution but not one I like is: Encode a base video in Mpeg2 VOB. Every X frames encode a new video of the last X frames. As VOB files have no file headers you can them just append the binary of the new file to the existing VOB. FFMPEG would only need to run on a few frames. Some other video formats might work too.

这篇关于FFMpeg连续实时图像到视频编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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