Search code examples
html5-videohtml5-audiovlcvlcj

No sound when play video stream in HTML5


I am using vlc player to transcode multicast stream and then showing using HTML5 video tag. Video is playing there but i unable to get any sound.

VLC command:

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}

here is the 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>

However same stream (http://127.0.0.1:8080/webcam.ogg) is playing with proper sound in vlc player. Can someone suggest me where is the problem.


Solution

  • You are not specifying an audio codec in your transcoding string, here are some examples (originally taken from some demo code in the VLC sources):

    #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}
    

    Which particular one you need is up to you and your requirements.