在 HTML5 中播放视频流时没有声音

No sound when play video stream in HTML5

我正在使用 vlc 播放器转码多播流,然后使用 HTML5 视频标签显示。那里正在播放视频,但我听不到任何声音。

VLC 命令:

vlc udp://@192.168.1.1 --sout=#transcode{vcodec=theo,vb=1024,channels=1,ab=128,samplerate=44100,width=320}:http{dst=:8080/webcam.ogg}

这里是 html:

<video autoplay="autoplay" width="500px" preload="metadata" controls>  <source src="http://127.0.0.1:8080/webcam.ogg"/><source src="http://127.0.0.1:8080/webcam.ogg"/></video>

但是同一流 (http://127.0.0.1:8080/webcam.ogg) 正在 vlc 播放器中以正确的声音播放。有人可以告诉我问题出在哪里吗?

您没有在转码字符串中指定音频编解码器,以下是一些示例(最初取自 VLC 源中的一些演示代码):

#transcode{vcodec=h264,venc=x264{cfr=16},scale=1,acodec=mp4a,ab=160,channels=2,samplerate=44100}
#transcode{vcodec=h264,venc=x264{cfr=40},scale=1,acodec=mp4a,ab=96,channels=2,samplerate=44100}
#transcode{vcodec=theo,venc=theora{quality=9},scale=1,acodec=vorb,ab=160,channels=2,samplerate=44100}
#transcode{vcodec=theo,venc=theora{quality=4},scale=1,acodec=vorb,ab=96,channels=2,samplerate=44100}
#transcode{vcodec=VP80,vb=2000,scale=1,acodec=vorb,ab=160,channels=2,samplerate=44100}
#transcode{vcodec=VP80,vb=1000,scale=1,acodec=vorb,ab=96,channels=2,samplerate=44100}

您需要哪一个取决于您和您的要求。