One of our clients wanted us to create an application that would stream live to YouTube from an iOS device. But before we could start developing the app there were certain questions that needed to be answered like:
1- What type of stream does YouTube accept?
2- Is there any reliable 3rd party encoder available to ease the process?
3- In what ways can we bypass the need of intermediate servers and stream directly to YouTube?
4- What are the requirements to establish a YouTube channel for testing purposes?
Soon after we chalked-out our parameters of research we started connecting dots to accomplish our task.
We took the first step by creating a YouTube channel to test our live stream and followed a step-by-step guide provided by Google itself.
Once our channel was successfully created we figured out that YouTube live streaming accepts the RTMP (Real Time Messaging Protocol) stream. Our next challenge was to look for an encoding SDK; the one that creates RTMP stream directly from the iPhone camera input. A quick search of existing code offered up different options like video on demand streaming and independent streaming servers. Others had pre-developed encoders but no option for custom integration in other apps.
After extensive research and exhausting different options we came across an SDK that perfectly served our purpose. From a technical standpoint this SDK created the RTMP stream for us, taking the input directly from the iPhone camera and establishing a connection with YouTube’s RTMP server using the credentials.
Using this SDK we were able to control parameters like audio codec, video codec, sample rate etc. to fine tune our stream and make a suitable trade-off between the user’s internet connection strength and video quality.
The parameters i.e. server URL and stream name, used for streaming live to the YouTube channel, are available at the bottom of the dashboard.
After we fine-tuned the parameters we were able to achieve our desired results.