FFmpeg – Video and Audio Streaming with Periscope and YouTube A handy set of scripts to configure FFmpeg to transmit video and / or audio in live streaming through online streaming services such as Periscope and YouTube

FFmpeg - Streaming Video e Audio su Periscope e YouTube

If you have come across this article, it is likely that you already know FFmpeg, one of the most famous software suites for Linux and Windows to record, convert and play audio and video. In this post we will talk about how to use this very useful and versatile tool to send a video and / or audio feed to an online streaming service such as Periscope and YouTube. To achieve this we have prepared some useful bash scripts (.sh) which you can download directly from this GitHub project – or cut/paste from this article (see below).

Before going into the scripts, it might be useful to spend a couple minutes to understand how these online streaming services actually work.

Periscope

Periscope is a free video streaming application born as a personal project of the developers Kayvon Beykpour and Joe Bernstein and subsequently purchased by Twitter in 2015: initially available only on the iOS platform, it was subsequently also released in the Web and Android version, thus obtaining full compatibility with all desktop and mobile devices.

Once registered (with Twitter, Facebook, Google or a mobile phone number) and access, the user will have the opportunity to access the Producer tool, which allows you to create one or more “channels” on which to transmit their contents: each channel will have a unique private key (mandatory), which can be used to send the content to be streamed, and a name (optional) to help distinguish it from the others.

FFmpeg - Video and Audio Streaming with Periscope and YouTube

Once the broadcast is sent to the channel – using FFmpeg or other similar tool – it will be possible to share the broadcast on your Twitter account: additionally, if the channel is set to “Public”, it will also be made available within the Periscope community.

FFmpeg Periscope – Video

This script is designed for the broadcast of an event or a pre-registered movie where the video and audio sources are included into a single mp4 file:

The latest version of this script can be found on GitHub here.

FFmpeg Periscope – Video e Audio

This script is designed for the broadcast of two different sources (video and audio), which will be merged into a single broadcast content:

The latest version of this script can be found on GitHub here.

FFmpeg Periscope – Audio only

This script, specifically designed for web radios or other audio-only broadcasts, will server a static image file as the video source and a separate audio source; both sources will be merged into a single broadcast content.

The latest version of this script can be found on GitHub here.

YouTube

YouTube natively supports live streaming / broadcast from its YouTube Studio interface: for more information on how to use this feature, we recommend taking a look at the official YouTube Creator Academy guide. Basically, in order to activate a live streaming the user needs to create a personal (or corporate) channel and then access the Live Streaming panel located in the menu at the top right of the channel screen. Once there, the YouTube Studio interface will open, from which it will be possible to retrieve the Live Stream URL and the Private Key to be used within the FFmpeg script that you will find on GitHub.

FFmpeg - Video and Audio Streaming with Periscope and YouTube

Once launched, the broadcast content will be immediately visible to all subscribers: moreover, if the display has been set as Public, it will be possible to share the stream via the dedicated URL.

FFmpeg YouTube – Video

This script is designed for the broadcast of an event or a pre-registered movie where the video and audio sources are included into a single mp4 file:

The latest version of this script can be found on GitHub here.

FFmpeg YouTube – Video e Audio

This script is designed for the broadcast of two different sources (video and audio), which will be merged into a single broadcast content:

The latest version of this script can be found on GitHub here.

FFmpeg YouTube – Audio + Immagine

This script, specifically designed for web radios or other audio-only broadcasts, will server a static image file as the video source and a separate audio source; both sources will be merged into a single broadcast content.

The latest version of this script can be found on GitHub here.

Conclusions

That’s it, at least for now: we sincerely hope that these scripts can help other users who’re struggling to stream their content through Periscope, YouTube or other similar services.

Fork me on GitHub

About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.