简体   繁体   English

保存V4L2摄像机输出

[英]Saving V4L2 video camera output

What video format would be the easiest when saving the output of a camera using V4L2 if I capture it in bitmap format? 如果我以位图格式捕获视频,使用V4L2保存摄像机的输出时,哪种视频格式最简单? Getting mpeg directly could be, of course, nice, but I can't unfortunately count on that. 当然,直接获取mpeg可能很好,但是我不能遗憾地依靠它。

I have managed to capture the frames, now I need to somehow view the video. 我设法捕获了帧,现在我需要以某种方式查看视频。 Can I simply convert those frames using some Linux tool or could I save the video easily straight from my app? 我可以使用Linux工具简单地转换这些帧,还是可以直接从应用程序轻松保存视频?

To keep things simple (as in a Proof-of-Concept demo), you can go ahead and directly store the YUV frames captured from the device into a file. 为了使事情变得简单(如概念验证演示中一样),您可以继续并将从设备捕获的YUV帧直接存储到文件中。

There are a bunch of viewers that support playback of single/multiple frame(s) of YUV data from a file. 有许多查看器支持从文件中播放YUV数据的单/多帧。

One such YUV viewer is freecode.com/projects/yay 一个这样的YUV查看器是freecode.com/projects/yay

You could use practically any format/codec if you used mencoder or ffmpeg 如果使用mencoderffmpeg,则几乎可以使用任何格式/编解码器

Btw, this question really should be on superuser.com 顺便说一句,这个问题确实应该在superuser.com上

If you are capturing frames already, you could save them to PPM images and then go to JPEG. 如果已经捕获了帧,则可以将其保存到PPM图像中,然后转到JPEG。 I did this using v4l2 and ImageMagick. 我使用v4l2和ImageMagick做到了这一点。 Maybe you could push JPEGs into a Motion JPEG stream. 也许您可以将JPEG推送到Motion JPEG流中。 It might not be as high tech as MPEG, but you might get it working quickly. 它可能不像MPEG那样高科技,但是您可能会使其迅速工作。 PPM files were a cinch to create. PPM文件很容易创建。 If I remember correctly, the v4l2 example code shows you how to do that part. 如果我没记错的话,v4l2示例代码向您展示了如何执行该部分。

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

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