Video File Streaming as a Live Stream
Assume that you have a video file myvideo.mp4 encoded with H.264 video codec and AAC or MP3 audio codec. With ffmpeg you can stream the video file through SkyLive service as if it is a live streaming.
ffmpeg -i ./myvideo.mp4 -re -acodec copy -vcodec copy -f flv "rtmp://LiveName:Сdnpass@rtmp://cdnrussia.com/ClientID/LiveName/mystream live=1"
- ClientID – Your ID in the SkyparkCDN control panel
- LiveName – The name provided by SkyparkCDN representative
- ChanelName – Specify any custom name
- Сdnpass – The password provided by SkyparkCDN representative
The above command will stream your video file myvideo.mp4 using mystream (ChanelName) as a stream name. As a result, the video file will be accessible at the following CDN URLs.
FFmpeg with authentication
Please note that your FFmpeg should support authentication. The same type of authentication is used by Adobe Flash Media Live Encoder. Please note that it is not possible to disable authentication for our CDN services.
How can I verify that my FFmpeg supports authentication
FFmpeg having started, run the -loglevel debug command. If you will see similar result as below, your FFmpeg does not support authentication.
Parsing... Parsed protocol: 0 Parsed host : LiveName Parsed app : LiveName RTMP_Connect0, failed to connect socket. 111 (Connection refused)
Please note that LiveName is your username of SkyLive service. If your FFmpeg supportsauthentication, you will see the following.
Parsing a group of options: output file rtmp://LiveName:Сdnpass@rtmp://cdnrussia.com/ClientID/LiveName/mystream live=1. Applying option acodec (force audio codec ('copy' to copy stream)) with argument copy. Applying option vcodec (force video codec ('copy' to copy stream)) with argument copy. Applying option f (force format) with argument flv. Successfully parsed a group of options. Opening an output file: rtmp://LiveName:Сdnpass@rtmp://cdnrussia.com/ClientID/LiveName/mystream live=1
How can I enable authentication in FFmpeg
You need to configure FFmpeg without librtmp.
git clone --depth 1 git://source.ffmpeg.org/ffmpeg cd ffmpeg ./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \ --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis \ --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 make
Please note that --enable-librtmp is missing in the above configuration.