«

»

Apr 08

How To Stream Video To a TLC Streaming Server Complete

This is a detailed tutorial on publishing a LIVE video stream via Real Time Messaging Protocol (RTMP) to your TLC Streaming Server Complete. Also provided are instructions on using your TLC Streaming Server Complete’s web server home page with built-in web based video player for: subscribing to live video streams you publish to your server; for playback of saved videos that are shipped with your AMI; and for generating ’embed’ code that can be used to create your own custom web pages to play live or on-demand video in RTMP or HTTP/HLS protocols from your TLC Streaming Server Complete.

Live video and audio streaming via RTMP is comprised of two components: 1) the ‘publisher’ and 2) the ‘subscriber’. These different roles have developed for them considerably different software to perform their respective tasks. Though both need access to the streaming server for live broadcasts, the main difference is that a ‘publisher’ needs to access additional local hardware, such as a video camera and a microphone on your PC or tablet, in addition to the screen and speakers. The video player, on the other hand, need only access the screen and speakers.

There are many, many products, both in software and in hardware, that can publish video via RTMP, and/or play it back. For publishing, this write-up focuses on Adobe Flash Media Live Encoder (FMLE) and hardware (an Apple MacBook) with a built-in camera. FMLE works almost identically on Microsoft Windows PCs, as well, so you can follow these instructions for using FMLE regardless of whether you are on Mac or Windows.

  1. On your Mac (or PC) go to http://www.adobe.com/products/flash-media-encoder.html and download Flash Media Live Encoder. You will have to sign up and agree to the EULA.
  2. Install FMLE, run it. You may see your camera light go on, but if it does not, it does not mean that FMLE is not working, it just means it didn’t turn on your camera light or your camera doesn’t have a light.
  3. In the left panel, you will see a check box “Video”, make sure it is checked and leave all of the defaults in the left panel as-is.
  4. In the right panel, you will see “Stream to Flash Media Server”. Check it and below it enter the “FMS URL”. The URL is in the form of rtmp://your.server.name/live. If your server’s public DNS name is ec2-123-123-123-123.compute-1.amazonaws.com then your FMS URL is rtmp://ec2-123-123-123-123.compute-1.amazonaws.com/live. NOTE: I have had problems with Adobe FMLE on Mac connecting to the server when inputting a server name instead of an IP address. Try using the public IP address if the DNS name is not working.
  5. Leave the backup blank.
  6. For your “stream” name, for production purposes you can make it long or complicated and anything you want. But for use with the Streaming Server Complete’s home page, name the stream ‘test’ as this is what is hard-coded on the server’s home page.
  7. You can accept all of the other defaults.
  8. Note: do NOT click “Start” button unless all of your information is correct. The application will hang for about a minute if there is no server to connect to
  9. Once ready, start streaming to your server – you are now publishing via RTMP!

Once publishing, you can see what others can see when they 1) ‘subscribe’ to the stream via RTMP and 2) download the stream via ‘HTTP Live Stream’ (HLS) to an HLS compatible player. The easiest way to ‘subscribe’ via RTMP is through your TLC Streaming Server’s home web page using a browser that supports Adobe Flash and Flash plugins. Likewise, that same home page has an HLS embedded player that should be viewed with either Android, iPad or iPhone.

Using the appropriate browser to test RTMP, HTTP, or HLS, navigate the browser to your TLC Streaming Server Complete public domain name. For example, using the DNS name above, you would go to http://ec2-123-123-123-123.compute-1.amazonaws.com on your device browser to get to your streaming server’s home page.

Technology Leadership Company has created 4 player applications on that page for you to test your new server AND generate ’embed’ code you can use to copy to custom web pages.

  • The top left player gives a working example of RTMP “On-demand” playback of a demo .flv video file bundled with your AMI, using Adobe Flash.
  • The top right player gives a working example of HTTP “On-demand” playback of a .mp4 file bundled with your AMI, using HTML5 video tag
  • The bottom left player gives a working example of RTMP “live” playback of a stream YOU started publishing from FMLE (instructions above), using Adobe Flash.
  • The bottome right player gives a working example of HLS “live” playback of the stream YOU started publishing from FMLE (instructions above), using an HLS formatted file URL inside an iframe.

The main purpose of this server is to publish streams live, with an added benefit of having the stream ALREADY SAVED for you on your streaming server, in both FLV and MP4 format, available at the end of publishing. The file names and file paths are described below.

Because the publisher may want to use the same stream name, and in an effort not to lose previously recorded streams or accidentally merge videos by the same stream id, Technology Leadership’s custom file saving module renames all saved streams by appending a date and time to the end of the file name, and moving the the file to its respective video-on-demand playback directory.

Thus, a published stream id called ‘test’ saved on May 16th, 2014 at 2:02:30pm creates two files, one named ‘test-2014-05-16-14-02-39.flv’ AND the other ‘test-2014-05-16-14-02-39.mp4′. There will be multiple files all with unique file names if the publisher has streamed, stopped, and restarted; and/or when one or more publishers use different stream ids.

You should obtain a list of the files saved and use those file names in video-on-demand ’embed code’ produced by your streaming server’s home page.

To obtain a list of FLV and MP4 saved files, used for RTMP and HTTP video-on-demand playback, respectively:

  1. Log into your server using the SSH key you specified, using the user account name ‘ec2-user’.
  2. cd /usr/local/red5/webapp/vod/streams/
  3. NOTE: if permission is denied, type ‘sudo su -‘ and try above command again
  4. type ‘ls’

This is the list of files. Replace ‘hobbit_ipv4.flv’ string in the ’embed code’ generated by the home page RTMP video-on-demand player with the name of one of your FLV files, and it will play back. Replace ‘hobbit_ipv4.mp4′ string in the ’embed code’ generated by the home page HTTP video-on-demand player with the name of one of your MP4 files, and it will play back.

HLS .M3U8 format files are generated during live publishing, and only needed for mobile playback of “LIVE” streams. Thus, no M3U8 file manifests or their TS file segments are saved. MP4 format is used for HTTP playback of saved video, while the .M3U8 manifest and TS segments are for LIVE playback via HTTP, only.

NOTE: The HTTP MP4 video-on-demand playback for a file named filename.mp4 on a server with DNS public host name ec2-123-123-123-123.compute-1.amazonaws.com is http://ec2-123-123-123-123.compute-1.amazonaws.com/saved/filename.mp4

Good Luck and Have Fun!

Leave a Reply