Search code examples
youtubeyoutube-apiyoutube-livestreaming-api

Youtube encoder won't start for live streams


I'm trying to get a livestream working on youtube. I want to stream 360° content with H264 video and AAC audio. The stream is started with the youtube live api from my mobile app and librtmp is used to deliver video and audio packets. I easily get to the point where the livestream health is good and my broadcast and stream are bound successfully.

However, when I try to transition to "testing" like this:

YoutubeManager.this.youtube.liveBroadcasts().transition("testing", liveBroadcast.getId(), "status").execute();

I get stuck on the "startTesting" status every time (100% reproducible) while I expect it to change to testing after few seconds to allow me to change it to live.

I don't know what's going on as in the youtube live control room everything seems to be fine but the encoder won't start.

Is it a common issue? Is there a mean to access the encoder logs? If you need more information feel free to ask me.

Regards.


Solution

  • I found a temporary fix !

    I noticed 2 things :

    • When the autostart option was on, the stream changed its state to startLive as soon as I stopped sending data. It suggested that the encoder was trying to start but it was too slow to do it before some other data paket was received (I guess)
    • When I tried to stream to the "Stream now" URL, as @noogui suggested, it worked ! So I checked out what was the difference in the stream now & event configurations.

    It turned out I just had to activate the low latency option as it's done by default in the stream now configuration.

    I consider it as a temporary fix because I don't really know why the encoder isn't starting otherwise and because it doesn't work with the autostart option... So I hope it wont break again if Youtube does another change on their encoder.

    So, if you have to work with the Youtube api, good luck guys !