Pages

June 4, 2015

MPEG-TS playback and transmuxing to HLS, RTMP, MPEG-DASH

MPEG2-TS is one of the most popular streaming protocols used by various types of businesses. It supports several streams types and allows carrying multiple programs within one stream. This is why Nimble Streamer had support for transmuxing MPEG-TS into HLS streams for a long time.

Now it's time to step forward and improve MPEG2-TS feature set with a few great capabilities.

Nimble is able to take MPEG2TS incoming stream via both UDP and HTTP. It transmuxes (i.e. re-packages) streams from either of sources into:
Supported video formats are MPEG1, MPEG2, MPEG4 and AVC. Supported audio formats are MP3 and AAC. For the outgoing streams protocols that don't support these formats, only the respective subset is used for transmuxing.

The outgoing streams generated from MPEG-TS may be used in adaptive bitrate (ABR) streams produced from other protocols like RTMP and RTSP.

The incoming UDP MPEG2TS streams may be wrapped into RTP and Nimble Streamer is able to process those streams as well.

Let's see how it can be set up and used via WMSPanel.

Notice that most of the described workflow is described in the following video.



You can also read this article to see additional information.

1. Install Nimble Streamer


Use this installation instruction to get Nimble Streamer on your server or desktop.

To take MPEG-TS streams for transmuxing, you need to specify their sources. After that Nimble will pick them up and start producing streams for immediate use.

Go to Nimble Streamer -> Live Streams Settings menu to see live streaming setup page.

2. MPEG2-TS incoming streams


First thing you will see is the global settings. Here you need to select what output protocols will be generated by default.



You need to go to Applications tab and define the settings for a specific output application.

2.1 Add MPEG-TS pulled stream


Now you need to specify is the incoming stream. Go to MPEG2TS In tab to see available options for adding UDP and HTTP streams.


Let's add HTTP stream as example. Click on Add HTTP stream to see the following dialog.


 
First you need to specify Stream URL which of your MPEG-TS HTTP source.

You may also optionally define any number of Fallback URLs which will be used in case your main stream goes down. You can specify both HTTP and HTTPS streams' URLs. The backup streams will remain the source of the stream as long they are active.




If you'd like Nimble Streamer to check primary stream to switch back, click on "Add primary check interval" to enter that value. Notice that interval check feature requires Addenda premium package license registered on the server where you process these streams.


If this setting is present, you will see current active stream in the incoming streams list.

Alias is the name of your stream in the list of streams within WMSPanel settings.

You may check Add outgoing stream checkbox and define how this stream will be available in output streams. The output streams are defined separately for MPEG-TS as each stream may contain several programs. However if you'd like to make output streams automatically, you may use this option.

Saving the information will create an incoming stream for further use.



It will be synced to Nimble Streamer within several seconds.

2.2 Add MPEG-TS UDP stream


To add UDP stream setting, click on Add UDP stream to specify all the details.
You will see a dialog for defining incoming UDP stream.





You'll specify the IP address and port to receive the stream and will define Alias as described in 3.1. In addition you can click on Advanced settings to define whether you want to allow reusing sockets with other applications.

Notice the Add outgoing stream checkbox, it works the same way as described in 3.1.

Multicast

If your address qualifies for multicast IP ranges, e.g. 239.0.0.0/8 or 224.0.0.0/24, then if you enter such IP, you'll get additional Multicast interface IP Address field where you may specify that address.




These UDP setting allow getting 1 stream from 1 address. If you need to have multiple streams, you can use Multicast source IP approach.

Click on Advanced settings link to see Multicast source IP (rfc4607 SSM) field. Here you may define source IP according to RFC4607 SSM. Nimble Streamer uses IP_ADD_SOURCE_MEMBERSHIP API call to handle that.


Troubleshooting

If you see any image artifacts or video freeze when when streaming content through UDP via MPEG-TS or RTSP, Nimble allows increasing UDP buffer. Set this parameter in Nimble configuration:
udp_so_receive_buffer = 16777216 
and restart server.
This sets SO_RCVBUF socket receive buffer to 16 MB and it should be enough to process streams especially with large bitrate.

Also read: Troubleshooting MPEGTS processing. Nimble Streamer has several settings to deal with problematic media sources to avoid glitches and artifacts.


Now when incoming streams are set, you may define the outgoing streams.

3. MPEG2-TS outgoing streams


As mentioned above, by default you need to manually define outgoing stream for all incoming MPEGTS streams because one stream may contain several programs. So if you haven't specified names for for apps and streams during the incoming stream setup, you'll need to do it as a separate step.

Click on MPEGTS Out tab to see an empty list of outgoing streams.


Click on Add outgoing stream to see the dialog which allows creating a stream.

Outgoing MPEG2TS stream parameters.
The following fields are used:
  • Application name and Stream name are the strings which will be used for outgoing streams URLs so you can set them according to your naming conventions.
  • Video source and video stream. This is where the video will be taken from for further mix. The source is the incoming stream defined in step 2. The stream can be selected from the drop down list based on the source information. If no information has been received yet, you may select "First video stream" to get whatever is transmitted. If the source has just one stream, it will be picked up by default with no special setup.
  • Audio source and audio stream works the same way as "Video source".

Outgoing MPEG2TS stream.

4. Streams usage


When you're finished with the setup, click on Nimble Streamer -> Live streams and click on the server name to see what we have now.


You'll see the list of incoming streams as received from media sources.

Clicking on Outgoing streams you will see the list of result streams ready for usage.



Besides their parameters, you can see the question mark icon. Clicking on it you will get Sample URL for player dialog showing all possible streams URL for further usage and also several sample players to test the stream.

Sample playback dialog.
You can select the stream name for further usage. The protocols used in drop down list are chosen from the global or per-application settings which you set up on step 2.

5. MPEG-TS playback


As your new accepted MPEG-TS stream has already been transmuxed into multiple protocols, you may also have MPEG-TS playback. You need to enable MPEG-TS protocol in Global settings or application settings at step 2 above, and after that you'll be able to use it as outgoing HTTP stream. It will have URL like "http://server_name:port/app/stream/mpeg.2ts", e.g. http://192.168.0.2:8081/app/stream/mpeg.2ts

6. MPEG-TS streaming over UDP


Nimble Streamer has full support for UDP streaming, read more about MPEG-TS UDP streaming setup and using constant bitrate and mux rate for UDP streaming.

Take a look at this tutorial on SRT and UDP streaming setup:


7. Adaptive bitrate setup


Having the MPEG-TS, RTMP or RTSP outgoing streams being set up, you may create adaptive bitrate streams output.

Read this article for full details regarding ABR setup and usage.

8. DVR - recording and playback


MPEG-TS may be recorded for further playback via HLS and MPEG-DASH using the DVR feature set. Read this article for setup details.

What's next


With outgoing single bitrate and adaptive bitrate streams you can use them for streaming scenarios of any complexity. E.g. besides playback, you can use those streams for streams aliasing, hotlink protection, RTMP republishing and more.

Besides traditional WMSPanel web UI you may use WMSPanel API to control MPEG-TS streaming behavior. See our API reference for details.


Troubleshooting MPEGTS processing. Nimble has several settings to deal with problematic media sources to avoid glitches and artifacts.

Contact us if you have any feedback or questions regarding Nimble Streamer functionality and usage.

2 comments:

  1. Hello, we are trying to take input multicast UDP, providing a valid udp:// address and port. Seems that it does not work. Any options to achieve that? Thanks.

    ReplyDelete
    Replies
    1. Please submit full details using our helpdesk: https://wmspanel.com/help
      You should also read https://blog.wmspanel.com/p/before-you-post-question.html article prior to posting your request.

      Delete

If you face any specific issue or want to ask some question to our team,
PLEASE USE OUR HELPDESK

This will give much faster and precise response.
Thank you.

Note: Only a member of this blog may post a comment.