我在我的网站中嵌入了HTML5视频标记,源代码是gstreamer流。
我有一个关于gst 0.10的管道:
gst-launch-0.10 -v videotestsrc ! theoraenc ! oggmux ! queue ! tcpserversink port=8080 sync-method=2
我可以通过vlc连接到此流,如下所示:
vlc tcp://localhost:8080
我还可以在HTML5视频标记中使用该网址,视频会按预期显示。
现在我尝试将其改编为gst 1.0:
gst-launch-1.0 -v videotestsrc ! theoraenc ! oggmux ! queue ! tcpserversink port=8080 sync-method=2
我再次使用vlc连接到流,但是我无法在视频代码中使用此流。
这让我发疯,我把管道剥离到最低限度,我不明白它为什么不起作用。
为什么它适用于旧的gst和vlc,而不适用于视频标签中的新gst?
答案 0 :(得分:4)
让我告诉你这是一个有趣的问题。经过几个小时的鬼混,我仍然无法找到适合我的Windows 8.1盒子的解决方案。
我有一些运气 .ogg 与:
gst-launch-1.0 -v videotestsrc is-live=true ! clockoverlay shaded-background=true font-desc="Sans 38" ! theoraenc ! oggmux ! tcpserversink host=127.0.0.1 port=8080
但正确显示流仍然是一个挑战。
这是我正在使用的html文件:
<html>
<title>A simple HTML5 video test</title>
</html>
<body>
<video autoplay controls width=320 height=240>
<source src="http://localhost:8080" type="video/ogg">
You browser doesn't support element <code>video</code>.
</video>
</body>
Invalid Source
; No video with supported format and MIME type found
; 尽管VLC正确播放,我仍然没有运气 .mp4 :
gst-launch-1.0 videotestsrc is-live=true ! clockoverlay shaded-background=true font-desc="Sans 38" ! x264enc ! mpegtsmux ! queue ! tcpserversink host=127.0.0.1 port=8080
测试期间启用/禁用了卡巴斯基反病毒和 IIS 。在禁用IIS后,我在Google Chrome上取得了一些成功。
答案 1 :(得分:1)
运行VLC 2.0.8 Twoflower&amp; Chrome版本37.0.2062.120 Ubuntu 12.04(281580)(64位):
gst-launch-1.0 videotestsrc is-live=true ! \
clockoverlay shaded-background=true font-desc="Sans 38" ! x264enc ! mpegtsmux ! \
queue ! tcpserversink host=127.0.0.1 port=8082
Firefox希望Mime类型正确。当它应该是'video / mp4'时,Gstreamer将其发送为Mime ='Plain'。没有成功覆盖类型。
我使用带有标签的空HTML5来测试各种内容:
<video id="video" autoplay="autoplay" controls >
<source src="http://localhost:8083" type="html" codecs="vp8.0, vorbis">
<source src="http://localhost:8080" type="video/webm" codecs="vp8.0, vorbis">
<source src="http://localhost:8081" type="video/ogg" codecs="theora, vorbis">
<source src="http://localhost:8082" type="video/mp4" codecs="avc1.4D401E, mp4a.40.2">
You browser doesn't support element <code>video</code>.
</video>
webm / ogg / mp4适用于chrome,因为它不关心Mime类型。