VLC 记录网络摄像头并流式传输到 chrome linux [英] VLC record webcam and stream to chrome linux

查看:35
本文介绍了VLC 记录网络摄像头并流式传输到 chrome linux的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在寻找如何完成我被告知是可能的.

I am currently looking for how to accomplish what I have been told is possible.

有人告诉我,我们可以使用 vlc 在 linux 中流式传输网络摄像头,这将允许以下内容:

I was told that we would be able use vlc to stream a webcam in linux which would allow for the following:

  • 将流录制到本地机器以供稍后上传.
  • 使用 Chrome 的 HTML5 视频功能在录制时播放流.
  • 从网络发送启动和停止命令以进行 vlc 录制.

我对此已经研究了很长时间,但一直未能找到可行的解决方案.

I have been researching this for quite some time and haven't been able to find a viable solution.

我已经可以使用 VLC 录制视频了

I am able to record video using VLC already with the following

vlc v4l2:// :v4l2-dev=/dev/video0 :v4l2-width=640 :v4l2-height=480 --sout "#transcode{vcodec=mpeg4,acodec=mpga,vb=800,ab=128}:standard{access=file,dst=capture_4.avi}"

这真的有可能吗?

推荐答案

如果可能的话,回答您的问题... 是的,但它很棘手.我不能回答你的所有观点,只有在 VLC 中流式传输并在 HTML5 中显示的部分

To answer your question if this is possible... YES it is BUT it's tricky. I can't answer all your points, only the part with streaming in VLC and displaying it in HTML5

您需要特定的环境设置才能使其工作(服务器上的分段器和正确的 MIME 类型).我假设你们都在使用 linux;我不是(Mac OS/unix),但它背后的原则在让它工作的工作流程方面保持不变.我会尽力解释 - 希望这对您有所帮助.

You'll need a certain environment setup for this to work (Segmenter and correct MIME Type on server). I assume you are all on linux; which I am not (Mac OS / unix) but the principles behind it stay the same concerning the workflow of getting this to work. I'll try to explain - hope this helps in any way.

我成功的设置如下:

(1) 串流 &录音

(1) STREAMING & RECORDING

本地 vlc 流实例流式传输音频和视频 -> 生成 mpegts 流.尝试将您的命令更改为类似

local vlc streaming instance streaming audio and video -> producing a mpegts stream. Try changing your command to something like

vlc v4l2:// :v4l2-dev=/dev/video0 :v4l2-width=640 :v4l2-height=480 --sout "#transcode{vcodec=mpeg4,acodec=mpga,vb=800,ab=128}:standard{access=udp, mux=ts, sap, name=live-video, dst=224.0.0.1, port=1234}"

vlc v4l2:// :v4l2-dev=/dev/video0 :v4l2-width=640 :v4l2-height=480 --sout "#transcode{vcodec=mpeg4,acodec=mpga,vb=800,ab=128}:udp{dst=224.0.0.1,port=1234,mux=ts}"

我只是在这里为您提供可在 Mac 上运行的移植命令.我不知道他们是否在 linux 上工作.现在您应该可以通过访问 SAP 公告或直接使用 VLC 播放直播流

I'm just giving you ported commands here which work on Mac. I don't know if they work on linux. Now you should be able to play the live stream with VLC by accessing the SAP announcement or directly with

vlc -vvv udp://@224.0.0.1:1234

然后您可以使用另一个 vlc 实例来记录流

You could then use another vlc instance to record the stream

vlc udp://@224.0.0.1:1234 --sout "#transcode{vcodec=mpeg4,acodec=mpga,vb=800,ab=128}:standard{access=file,dst=capture_4.avi}"

在 VLC 中有一个重复的命令,我一直在玩,但没有成功.通过这种方式,您可以使用一个实例进行流式传输和录制.也许这适用于 linux.

There is a duplicate command in VLC which I have been playing around with but without success. This way you could stream and record with one instance. Maybe this works on linux.

(2) 细分

mediastreamsegmenter 将您的 mpegts 流分割成可交付的片段.我正在使用 Apple 服务器软件.Apple 为您提供了一个 mediastreamsegemnter,它可以获取实时 mpegts 流并将其转换为添加到播放列表的片段.我不知道 linux 中的实时分段器.也许其他人会这样做.

mediastreamsegmenter to segment your mpegts stream into deliverable segments. I'm using Apple Server Software. Apple provides you with a mediastreamsegemnter which can take a live mpegts stream and convert it into segments which are added to a playlist. I don't know of a live segmenter in linux. Maybe someone else does.

(3) 交付

html 5 页面链接到包含片段的视频播放列表.mediastreamsegmenter 将生成一个播放列表 playlist.m3u8,然后可以使用 HTML 5 访问该播放列表

html 5 page linking to the video playlist containing the segments. The mediastreamsegmenter will produce a playlist playlist.m3u8, which then can be accessed with HTML 5

<video width="640" height="480">
<source src="YOUR_PATH/playlist.m3u8" />
</video>

<小时>

关于这个主题的一些有用的教程是:


Some helpful tutorials concerning this topic are:

有关设置和基本命令的信息

VLC 示例以进行流式传输

我知道这不是您问题的完整解决方案,但这可能会给您一些不错的起点来研究.

I know this is not a complete solution to your problem, but this will maybe give you some nice starting points to look into.

这篇关于VLC 记录网络摄像头并流式传输到 chrome linux的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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