具有WebM格式的Ubuntu服务器音频的命令行流媒体摄像头 [英] Command-line streaming webcam with audio from Ubuntu server in WebM format

查看:220
本文介绍了具有WebM格式的Ubuntu服务器音频的命令行流媒体摄像头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从连接到我的无头Ubuntu服务器(运行Maverick 10.10)的网络摄像头流式传输视频和音频。我想要能够以WebM格式(VP8视频+ OGG)流。带宽有限,因此流必须低于1Mbps。



我已尝试使用FFmpeg。我可以通过以下方式从网络摄像头录制WebM视频:

  ffmpeg -s 640x360 \ 
-f video4linux2 -i / dev / video0 -isync -vcodec libvpx -vb 768000 -r 10 -vsync 1 \
-f alsa -ac 1 -i hw:1,0 -acodec libvorbis -ab 32000 -ar 11025 \\ \\
-f webm /var/www/telemed/test.webm

然而,尽管试验通过各种各样的vsync和异步选项,我可以不同步音频,或者Benny Hill风格的快进视频与匹配的快速音频。我也无法通过ffserver实现这一点(通过将test.webm路径和文件名替换为相关的Feed文件名)。



目标是获取直播,音频+视频馈送,在现代浏览器中可见,带宽较窄,仅使用开源组件。 (没有MP3格式的合法糖果)



因此我的问题是:
您将如何通过具有同步音频的Linux从网络摄像头流式传输webm ?您使用什么软件?



您是否成功通过FFmpeg从具有同步音频的网络摄像头对网路编码进行编码?如果是这样,你发出什么命令?



是否值得坚持使用FFmpeg + FFserver,或者还有其他更适合的命令行工具(例如VLC, t看起来太好编码了)?



像命令行中的Gstreamer + flumotion可以配置吗?如果是这样,我在哪里可以找到命令行文档,因为flumotion doc在命令行详细信息上比较简单?



提前感谢

解决方案

我最近设置了这个,但这是一种痛苦。这是我必须做的:



首先,从源代码构建ffmpeg以包含libvpx驱动程序(即使你使用了一个版本,你需要最新的截至本月)流式传输webm,因为他们只是添加了包含全局头文件的功能)。我在Ubuntu服务器和桌面上执行了此操作,本指南向我展示了如何其他操作系统可以在这里找到



一旦你获得了相应版本的ffmpeg / ffserver,你可以设置它们进行流式传输,在我的情况下,这样做如下。



在视频捕获设备:

  ffmpeg -f video4linux2 -standard ntsc -i / dev / video0 http://< server_ip>:8090 /0.ffm 




  • -f video4linux2 -standard ntsc -i / dev / video0部分可能会根据您的输入源而变化(我的是用于视频采集卡)。



相关ffserver .conf摘录:

 端口8090 
#BindAddress< server_ip>
MaxHTTPConnections 2000
MAXClients 100
MaxBandwidth 1000000
CustomLog / var / log / ffserver
NoDaemon

< Feed 0.ffm>
文件/tmp/0.ffm
FileMaxSize 5M
ACL allow< feeder_ip>
< / Feed>
< Feed 0_webm.ffm>
文件/tmp/0_webm.ffm
FileMaxSize 5M
ACL允许localhost
< / Feed>

< Stream 0.mpg>
Feed 0.ffm
格式mpeg1video
NoAudio
VideoFrameRate 25
VideoBitRate 256
VideoSize cif
VideoBufferSize 40
VideoGopSize 12
< / Stream>
< Stream 0.webm>
Feed 0_webm.ffm
格式webm
NoAudio
VideoCodec libvpx
VideoSize 320x240
VideoFrameRate 24
AVOptionVideo flags + global_header
AVOptionVideo cpu-used 0
AVOptionVideo qmin 1
AVOptionVideo qmax 31
AVOptionVideo quality good
PreRoll 0
StartSendOnKey
VideoBitRate 500K
< / Stream> ;

< Stream index.html>
格式状态
ACL允许< client_low_ip> < client_high_ip>
< / Stream>




  • 请注意,这是配置为在fed_ip服务器执行上述ffmpeg命令,服务器端server_ip服务器端client_low_ip通过client_high_ip,同时在server_ip处理mpeg到webm对话(接下文)。



此ffmpeg命令在以前称为server_ip的机器上执行(它处理实际的mpeg - > webm转换,并将其反馈到ffserver中的另一个Feed):

  ffmpeg -i http://< server_ip>:8090 / 0.mpg -vcodec libvpx http:// localhost:8090 / 0_webm.ffm 


希望这有帮助。 >

I am trying to stream video and audio from my webcam connected to my headless Ubuntu server (running Maverick 10.10). I want to be able to stream in WebM format (VP8 video + OGG). Bandwidth is limited, and so the stream must be below 1Mbps.

I have tried using FFmpeg. I am able to record WebM video from the webcam with the following:

ffmpeg -s 640x360 \
-f video4linux2 -i /dev/video0 -isync -vcodec libvpx -vb 768000 -r 10 -vsync 1 \
-f alsa -ac 1 -i hw:1,0 -acodec libvorbis -ab 32000 -ar 11025 \
-f webm /var/www/telemed/test.webm 

However despite experimenting with all manner of vsync and async options, I can either get out of sync audio, or Benny Hill style fast-forward video with matching fast audio. I have also been unable to get this actually working with ffserver (by replacing the test.webm path and filename with the relevant feed filename).

The objective is to get a live, audio + video feed which is viewable in a modern browser, in a tight bandwidth, using only open-source components. (None of that MP3 format legal chaff)

My questions are therefore: How would you go about streaming webm from a webcam via Linux with in-sync audio? What software you use?

Have you succeeded in encoding webm from a webcam with in-sync audio via FFmpeg? If so, what command did you issue?

Is it worth persevering with FFmpeg + FFserver, or are there other more suitable command-line tools around (e.g. VLC which doesn't seem too well built for encoding)?

Is something like Gstreamer + flumotion configurable from the command line? If so, where do I find command line documentation because flumotion doc is rather light on command line details?

Thanks in advance!

解决方案

I set this up recently, but it's kind of a pain. Here's what I had to do:

First, build ffmpeg from source to include the libvpx drivers (even if your using a version that has it, you need the newest ones (as of this month) to stream webm because they just did add the functionality to include global headers). I did this on an Ubuntu server and desktop, and this guide showed me how - instructions for other OSes can be found here.

Once you've gotten the appropriate version of ffmpeg/ffserver you can set them up for streaming, in my case this was done as follows.

On the video capture device:

ffmpeg -f video4linux2 -standard ntsc -i /dev/video0 http://<server_ip>:8090/0.ffm

  • The "-f video4linux2 -standard ntsc -i /dev/video0" portion of that may change depending on your input source (mine is for a video capture card).

Relevant ffserver.conf excerpt:

Port 8090
#BindAddress <server_ip>
MaxHTTPConnections 2000
MAXClients 100
MaxBandwidth 1000000
CustomLog /var/log/ffserver
NoDaemon

<Feed 0.ffm>
File /tmp/0.ffm
FileMaxSize 5M
ACL allow <feeder_ip>
</Feed>
<Feed 0_webm.ffm>
File /tmp/0_webm.ffm
FileMaxSize 5M
ACL allow localhost
</Feed>

<Stream 0.mpg>
Feed 0.ffm
Format mpeg1video
NoAudio
VideoFrameRate 25
VideoBitRate 256
VideoSize cif
VideoBufferSize 40
VideoGopSize 12
</Stream>
<Stream 0.webm>
Feed 0_webm.ffm
Format webm
NoAudio
VideoCodec libvpx
VideoSize 320x240
VideoFrameRate 24
AVOptionVideo flags +global_header
AVOptionVideo cpu-used 0
AVOptionVideo qmin 1
AVOptionVideo qmax 31
AVOptionVideo quality good
PreRoll 0
StartSendOnKey
VideoBitRate 500K
</Stream>

<Stream index.html>
Format status
ACL allow <client_low_ip> <client_high_ip>
</Stream>

  • Note this is configured for a server at feeder_ip to execute the aforementioned ffmpeg command, and for the server at server_ip so server to client_low_ip through client_high_ip while handling the mpeg to webm conversation on server_ip (continued below).

This ffmpeg command is executed on the machine previously referred to as server_ip (it handles the actual mpeg --> webm conversion and feeds it back into the ffserver on a different feed):

ffmpeg -i http://<server_ip>:8090/0.mpg -vcodec libvpx http://localhost:8090/0_webm.ffm

Once these have all been started up (first the ffserver, then the feeder_ip ffmpeg process then then the server_ip ffmpeg process) you should be able to access the live stream at http://:8090/0.webm and check the status at http://:8090/

Hope this helps.

这篇关于具有WebM格式的Ubuntu服务器音频的命令行流媒体摄像头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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