Stream screen to Youtube with VLC

vlc-media-player

I'm looking to stream to Youtube with VLC and made the following command-string:

cvlc -vv screen:// --live-caching=0 --screen-fps=30 --screen-width=1920 --screen-height=1080 --sout='#transcode{vcodec=h264,scale=Auto,width=1920,height=1080,acodec=mp3,ab=128,channels=2,samplerate=44100}:std{access=rtmp,mux=ffmpeg{mux=flv},dst=rtmp://a.rtmp.youtube.com/live2/xxxxxxxxxxx}'

If I replace screen:// .. with a videofile, the stream successfully uploads to Youtube.

But I have no idea why it won't cast the screen. Youtube briefly shows a connection but no image. The stream isn't interrupted by VLC and it shows the upload to keep proceeding, but it's never picked up by YT. Any help would be appreciated.

For the record, I am able to view the screen offline in VLC without streaming.

I get a particular error that stands out:

core mux warning: late buffer for mux input (repeated while streaming) 

but this happens as well in the case of uploading the video and then doesn't seem to cause an issue.

Log

Below is the log when I try to set up an HTTP server streaming the desktop while also playing in VLC. I do get an image, but only a static one, the first frame of the stream.

https://pastebin.com/EzSWuAM3

It tells me a lot that my computer is slow, however it's a Corei5 and the VLC process only takes up 9% with a lot remaining. Saving to file works fine.

Note

I have two monitors. That might be a problem for it somehow, I don't know.

Update

I fixed the dropped frames issue by increasing the buffer with live-caching=2500. Now it works fine with a local HTTP server, but still not with YT.

Best Answer

  1. Initialization problem

    YouTube has a weird requirement before you can stream: you have to visit the Streaming page one time to initialize your streaming profile, after you have been approved by their sign-up process.

    1. Create your profile.
    2. Wait for approval.
    3. Visit https://www.youtube.com/live_dashboard once before attempting to stream.

    Screenshot: Create stream

    Screenshot: Get Started Screen

  2. Stream key (Stream name) problem

    I also noticed that you didn't pass a Stream key into VLC. Without a Stream key (Stream name), YouTube will reject any connection. VLC supports this function in the arguments for RTP protocol, so it may support it for the RTMP protocol, but I wouldn't hold my breath. I noticed RTMP is not listed as an available streaming protocol in the GUI for VLC, so I would highly doubt that VLC can even stream RTMP protocol. Adobe has made attempts to punish anyone that uses the RTMPdump open-source project, claiming it is a DMCA violation. https://en.wikipedia.org/wiki/Real-Time_Messaging_Protocol#rtmpdump Because RTMP requires encryption to be viable for streaming securely, VLC may not support streaming to YouTube.

    You may be able to stream from VLC to this other app and then have this app pass the stream through the RTMPdump CLI program to YouTube. http://docs.livestreamer.io/install.html#windows-binaries

    Screenshot: Find your stream key here

  3. VLC reputation problem

    I have tried to get VLC to record desktop screens to a file many times in the past and present, and it has always failed miserably, either refusing to respect the frame rate I select, or encoding the file with incorrect codec tags, resulting in the file only playing audio in a media player, or any other number of problems. VLC is not as robust as its reputation leads people to believe. I would skip VLC entirely and go with a dedicated streaming program, like Open Broadcaster Software Studio (OBS Studio). OBS Studio is the updated version of OBS: https://obsproject.com/

Related Question