Webcam streaming throught VLC with YUY2 compatibility

If you try to stream your webcam throught VLC you probably will see the following issue:

# vlc v4l2:///dev/video0 --sout '#rtp{mux=ts,sdp=rtsp://:8888/live.sdp}' 

VLC media player 3.0.4 Vetinari (revision 3.0.4-0-gf615db6332)
[000055c7620dd630] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[00007ff730002fe0] main mux error: cannot add this stream
[00007ff730001180] stream_out_rtp stream out error: cannot add this stream to the muxer
[00007ff73000ff60] main decoder error: cannot create packetizer output (YUY2)
[00007ff73000ff60] main decoder error: buffer deadlock prevented

To fix it, you must enable the transcoding and run the following command:

cvlc -vvv v4l2:///dev/video0:chroma=mp2v --v4l2-width 1280 --v4l2-height 720 --sout '#transcode{vcodec=mp2v,acodec=mpga,fps=30}:rtp{mux=ts,sdp=rtsp://:8888/live.sdp}'

where chroma enables hardware video decoding. You can edit the resolution, codecs and frame per seconds to enchance the video speed.

To run it, just run:

vlc rtsp://127.0.0.1:8888/live.sdp

Enjoy it!

Comments

Popular posts from this blog

How to fix Android when developer options are not available for this user

How to install Matlab without GUI

Contiki 3.0 on XM1000