9688|1

5979

帖子

8

TA的资源

版主

楼主
 

【学习Sitara™ AM335x】-把Beaglebone变成一个高清晰度IP摄像头 [复制链接]

需要习惯于看英文哦,原文地址:
http://www.oz9aec.net/index.php/ ... efinition-ip-camera

Few weeks ago I posted some notes about using the Logitech HD Pro Webcam C920 with Gstreamer. I have since ported the setup to the Beaglebone, effectively turning my Beaglebone into a streaming IP camera that can deliver constant bitrate H.264 video at full 1920x1080p30 resolution without breaking a sweat.

As written in the previous post, the secret behind making this happen is to take advantage of the H.264 encoder inside the Logitech C920 camera. This requires Linux kernel 3.2+ and an application that understands the "H264 pixel format". At the time of writing the list of applications is limited to one, namely qv4l2 from the v4l-utils package (correct me if I'm wrong). However, thanks to a hack I found on Github, I have managed to create an application that can acquire the raw H.264 stream from the C920 and save it to a file.

Please do read my previous post and get an understanding of what is involved in operating the Logitech C920 in H.264-mode. It's a good idea to get used to the camera hardware and software on a host PC before trying to make it work on an embedded device. I am not going to repeat every single step here.

A more or less complete diagram of my Beaglebone camera system is shown below:



The system connects to the rest of the world using a single cable, providing both LAN connection and DC. It's not PoE-compliant, just some DC over the spare wires. The Logitech C920 camera is connected to the USB host and I use UART1 to control a simple two-servo pan/tilt mechanism based on the Pololu Micro Serial Servo Controller. This may seem like overkill and indeed I could control the servos directly; however, using the serial interface provided by the servo driver is very easy and convenient.

The present demo mockup looks like this (it doesn't have the Ethernet/power splitter):



More photos in my Bonecam set on Flickr.

I intend to create a Beaglebone-sized daughter-board containing the DC regulator, the level converter and the servo controller, and mount it on top of the Beaglebone.

A diagram of the video server (and client) software is shown below. As you can see it is mostly a Gstreamer pipeline plus the capture application mentioned above:



The capture application is now maintained in my bonecam repository on Github together with some other stuff organized as follows:

bonecam/angstrom — Patches and bitbake recipes to create a "bonecam image" for the Beaglebone. You do not necessarily need to create this image, but you do need to build gst-plugins-bad as instructed later.
bonecam/camctl — A small application that I use for controlling the camera. Probably only useful for myself or those who replicate the pan/tilt control that I am using.
bonecam/capture — The capture application with a simple build script. Compile it on target (there is no cross build script yet).
bonecam/hardware — Data sheets and diagrams of various hardware components, mostly related to the pan/tilt construction.
bonecam/scripts — Utility scripts to start the video server and client. Note that the camera must be configured to send H.264 prior to starting the server. There is also an SDP file that can be used to load into VLC allowing VLC to be the client.
At this time I do not have any automated way to make all this work so you will have do it manually following the steps provided in the bonecam/angstrom directory:

Check out the ?ngstr?m setup scripts according to the instructions in the Building ?ngstr?m page. Perform the config and update from Step 2.
Apply my "wannabe-patches" as follows:
Copy angstrom/bonecam-image.bb to sources/meta-ti/recipes-misc/images/
Copy angstrom/gst-plugins-bad_0.10.23.bb to sources/openembedded-core/meta/recipes-multimedia/gstreamer/ - this recipe will enable the h264parse plugin which is necessary for the server.
Copy the files from angstrom/v4l2apps to sources/meta-openembedded/meta-oe/recipes-multimedia/v4l2apps/ - tis includes a patch to disable qv4l2 which for some reason will attempt to build using the native Qt SDK (and fail miserably)
You can now try to build the bonecam-image using: MACHINE=beaglebone ./oebb.sh bitbake bonecam-image
I realize this is not the right way to do things; however, until I have time to properly understand ?ngstr?m and Openembedded it will have to do. Feel free to contribute a better layout/setup that allows easy integration into the ?ngstr?m build system.

Once you have built the bonecam-image you need to transfer it to a bootable micro SD card. If you don't have a procedure for that you can follow the "How to Unpack and Boot the Demo Image - the hard way" steps from the ?ngstr?m site but using the files you just created (they are located in build/tmp-angstrom_v2012_05-eglibc/deploy/images/beaglebone).

This image boots in less than 5 seconds and has very small memory footprint leaving plenty of RAM to applications.

Note that you will have to install the gst-plugin-h264parse manually as it is not automatically included in the rootfs. We should fix that together with the "creating a better setup/layout" todo-item mentioned above. You can copy all IPK packages over to the Beaglebone and install what is necessary locally.

One thing you will note while working with the C920 is that the compressor appears to deliver a 3.1 Mbps constant bitrate stream regardless of resolution and frame rate. Obviously this is too much for a 320x240 video, but it is acceptable for VGA and quite impressive for high definition. I know it is possible to do better than this, but I should perhaps also mention that the H.264 stream from the C920 has barely noticeable latency. For many applications low latency is much more important than data rate.

The bonecam/scripts directory also contains scripts for sending  and receiving Vorbis-encoded audio over RTP. Using the settings in the script, the Beaglebone will survive and still have CPU cycles to spare. I'm looking into using CELT codec instead of Vorbis, but for some reason there is no libcelt available in ?ngstr?m. On a desktop PC I have had really good results using gstreamer and CELT and I would definitely like to make it work on the Beaglebone too.

Finally, I'd like to remark that this is still very much a work in progress. I haven't spent any particular effort on trying to optimize the setup, yet it seems to be very efficient and robust. It has been streaming more or less 24 hours a day for over a week now. You may catch the occasional live streams on either this, this or this channel. The bonecam is part of a larger setup and we only have one computer powerful enough to run the Livestream/Ustream applications, which is why it is not always on air.

最新回复

Thanks a lot.  详情 回复 发表于 2013-1-17 20:41
点赞 关注
个人签名生活就是油盐酱醋再加一点糖,快活就是一天到晚乐呵呵的忙
===================================
做一个简单的人,踏实而务实,不沉溺幻想,不庸人自扰
 

回复
举报

535

帖子

0

TA的资源

版主

沙发
 
Thanks a lot.
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/9 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表