如何创建mjpeg [英] how to create mjpeg

查看:161
本文介绍了如何创建mjpeg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白如何创建.mjpeg文件.据我了解,这只是一系列jpeg文件.我在网上搜索了将它们组合到一个文件中的方法,但是没有找到任何信息.有人说,一个人只需要创建一个微型服务器就可以显示一个接一个的图像.

I can't understand how to create a .mjpeg file. As far as I understand it is simply a series of jpeg files. I searched online for a way to combine them into a single file, but didn't find any information. Some people said that one just needs to create a miniserver that would show one image after another.

我正在尝试使用以下应用程序git://git.ideasonboard.org/uvc-gadget.git来测试UVC,它具有的选项之一是指向mjpe​​g文件的路径.我不太清楚是否可以创建一个mjpeg文件.

I'm trying to use the following application, git://git.ideasonboard.org/uvc-gadget.git, to test UVC, and one of the options that it has is a path to the mjpeg file. I'm not very clear if it is possible to create a mjpeg file at all.

非常感谢您提供有关如何创建mjpeg文件的帮助,因此我可以将其用于上述应用程序.

Would appreciate any help on how to create an mjpeg file so I could use it with the above mentioned application.

推荐答案

我很难找到相同的内容.当它支持各种影片容器而不支持UVC有效载荷格式时,仔细阅读mencoder的联机帮助页尤其容易引起误解.

I had a difficult time searching for the same. It's especially misleading to read through mencoder's manpage when it supports various movie containers but not the UVC payload format.

这似乎对我来说可以从Ubuntu 16.04上的摄像头录制字节流:

This seemed to work for me to record a bytestream from a webcam on Ubuntu 16.04:

gst-launch-1.0 v4l2src device=/dev/video0 ! 'image/jpeg,width=1280,height=720,framerate=30/1' ! \
               filesink buffer-size=0 location=mystream.mjpeg

guvcview说我的网络摄像头支持30 fps的1280x720.

where 1280x720 at 30 fps is what guvcview says my webcam supports.

来源:链接

编辑:后来我了解了v4l2-ctl:

v4l2-ctl -d /dev/video0 --list-formats-ext # identify a proper resolution/format

v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=1
v4l2-ctl --stream-mmap=1 --stream-count=30 --stream-to=mystream.mjpeg

当流计数设置为1时,它将生成可以用xdg-open查看的常规JPEG文件.否则,请运行file mystream.mjpeg确认输出具有正确的分辨率和帧数.

When the stream-count is set to 1, it makes a regular JPEG file that can be viewed with xdg-open. Otherwise, run file mystream.mjpeg to confirm the output has a proper resolution and frame count.

要使此数据与uvc-gadget -i实际结合使用,可能会涉及更多的工作.鉴于它可能需要适当的补丁程序,内核配置和调试,到目前为止,我只得到了未压缩的格式以在我的Raspberry Pi Zero上同步工作.希望你走的更远.

Getting this data to actually work with uvc-gadget -i could be much more involved. Given it possibly requires the appropriate patches, kernel configuration, and debugging, so far I have only gotten the uncompressed format to work in isochronous on my Raspberry Pi Zero. Hopefully you're further along.

这篇关于如何创建mjpeg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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