设置 MJPEG 压缩器
我制作了一个控制台程序,可以预览网络摄像头的视频,并通过 MJPEG 压缩过滤器将其捕获为 .avi 格式。我的架构:
WebCam
->IBaseFilter(Video capture filter)
->IBaseFilter(MJPEG compression filter)
------------->ICaptureGraphBuilder2::RenderStream
->.avi
关于如何通过 IAMVideoCompression 接口设置 MJPEG 压缩参数以获得最小的视频大小和至少平均质量有什么建议吗?现在我将 putQuality 方法参数设置为 0.1,这对我有很大帮助;我的视频文件大小约为 15mb/分钟。
我无法使用任何视频播放器渲染此捕获的 .avi 文件(我尝试过 Windows Media Player、WMP Classic、VLC)。在观看此视频之前,我需要制作解压缩程序吗?
我应该使用其他压缩过滤器吗?哪一个最好?
我的目标是编写一个视频流服务器(如 Skype)。您认为 15mb/分钟对于通过网络传输视频数据包来说合适吗?我将使用 UDP(RTP) 套接字来传输媒体流。
I made a console program that previews a video from webcam and captures it throught the MJPEG compression filter to .avi format. My schema:
WebCam
->IBaseFilter(Video capture filter)
->IBaseFilter(MJPEG compression filter)
------------->ICaptureGraphBuilder2::RenderStream
->.avi
Any advice on how to set up MJPEG compression parameters via IAMVideoCompression interface to get the smallest video size and at least average quality? For now I set the putQuality method parameter to 0.1 and it helps me a lot; my video file size is about 15mb/minute.
I can't render this captured .avi file with any video players (I tried Windows Media Player, WMP Classic, VLC). Do I need to make a decompressor before I can watch this video?
Is there another compression filter I should be using? Which one is the best?
My aim is to write a video streaming server (like Skype). Do you think 15mb/minute is a good size to transfer the video packets down the network? I am going to use UDP(RTP) socket to transfer the mediastream.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能想看看 Gstreamer。
解码 MJPEG 流的示例管道是将
其保存到文件中
从网络摄像头获取视频并保存它(在 Ubuntu Linux 上测试)
jpegdec 是一个用于解码 jpeg 格式的 bin,其中包含“idct-method”以保证
质量可以用等效的 C/C++、Java 或 Python 代码编写上述管道。它有非常漂亮的绑定。
对于编程,请参阅我的另一篇文章
RTSP with python-gstreamer
Playing 网络相关的东西你可能想看看RTSP(基于UDP的RTP)看看我对帖子的回答
使用 GStreamer 进行流式传输
You may want to look at Gstreamer.
An example pipeline to decode an MJPEG stream would be
To save it to a file instead
To get video from webcam and save it (tested on Ubuntu Linux)
jpegdec is a bin to decode jpeg format that contains "idct-method" for the quality
You can write the above pipelines in equivalent C/C++, Java or Python code. It has pretty nice bindings.
For programming look at my other post
Playing RTSP with python-gstreamer
For network related stuff you may want to look at RTSP(UDP based RTP) look at my answer to the post here
Streaming using GStreamer