Pages

October 28, 2015

Video recording (DVR) in Nimble Streamer

Streams recording is one of the essential use cases for live streaming. It's important to be able to view stream after the transmission is over, or switch between parts of the show during the transmission.

Nimble Streamer has an excellent capabilities for handling live streams and transmuxing them from RTSP, RTMP, SRT, MPEG-TS, Icecast and SHOUTcast to any supported format like HLS, MPEG-DASH, RTMP, SRT, SLDP, RTSP and MPEG-TS. So the next step we always wanted to make is to create streams recording, also known as Digital Video Recording, or DVR.

Nimble Streamer DVR current features:
For HLS DVR playback you may have your content be packaged in both MPEG2TS and fragmented MP4 (fMP4) containers simultaneously - see the last section of this article for details.

Nimble Streamer DVR allows recording and playing both HEVC (H.265) and AVC (H.264) video content with AAC, MP3 and AC3 audio. Other codecs are not supported.

Nimble Streamer also provides DRM feature set for Widevine, Playready and FairPlay content encryption. When a viewer connects to a stream within an application protected by the DRM, its output will be encrypted with respective DRM engine.

Let's see how you can start using Nimble Streamer DVR in your environment.

Take a look at this video tutorial to get familiar with the most useful features.



Read documentation below for more details and full description of available options.

1. Streaming scenarios setup


This article assumes that you've already installed Nimble Streamer. If not, then use this installation instruction to get an instance on your server or desktop. If you have old version of Nimble, then just easily upgrade it.

Check the following articles as examples of setup:

With all these scenarios being up and running you can start setting up DVR.

2. DVR setup


Go to "Nimble Streamer" -> "Live streams settings" menu to open the setup page. Then click on "DVR" tab to open its settings.

DVR settings tab
Here you can see list of setting. In our example we've set up something, otherwise you would see an empty list. Click on "Add DVR setting" button to start the setup.

DVR setup dialog

Here are the parameters you can define.

  • Application is the name of the application which is used during the live streaming. Whatever application name you use in live stream, it must be specified here. 
  • Stream name can be used to recording of some specific stream. If it's not specified, all streams will be recorded, each one separately within recording path. 
  • Recording path is the location of the storage which you'd like to use. It needs to be a file system location. If you don't specify it, the default cache path of Nimble Streamer will be used. 
  • Loop recording duration is the maximum time window that keeps the content. E.g. if you set this to 1 hour, start streaming and your stream lasts for 1 hour and 10 minutes, then first 10 minutes of recording will be erased to keep the last 10 minutes. This duration mostly depends on your storage capacity. If you don't specify the duration then Nimble will keep recording until it has space at the specified location.
  • Maximum size works the same way as Loop recording duration, but it uses archive size as a trigger to start erasing old recordings. It's specified in megabytes.
  • Min free space enables DVR cleanup when minimum free space on DVR storage has reached the specified limit. E.g. with 90% of available space, Nimble will cleanup archive(s) maintaining recorded duration to avoid filling the storage (same cleanup method used as for "Loop recording duration"/"Maximum size" criteria). It works only for "being recorded" DVR archives having active live stream.
  • Clean up after enables automatic deletion of "too old" content, e.g. older than 24/48/etc hours even for DVR archives that do not have "live stream" running. Nimble will periodically check if there is "too old" recording based on number of hours set and then delete it.
  • Read-only mode allows using pre-recorded archives as well as performing scheduled recording. This mode allows pausing the recording process while the archive will be still accessible for playback. Read this article for more details on operating DVR this way.
In the example above we used Larix Broadcaster mobile application to push RTSP stream into demo Nimble instance and we've set up its recording accordingly. We specified only the application name because it was up to the streamer to define a stream name.

Advanced settings include the following parameters.
  • Segment duration is the duration of the chunk being used for media storage. 
  • Thread name and priority are used for splitting recording process among several threads.
Other options include Drop invalid segments, Keep protocol timestamps and Check segment sizes on load, please read Handling timing errors article to get full details about them.

Keep SCTE-35 markers option allows recording SCTE-35 markers from incoming stream into DVR. Once HLS DVR is played, those markers are streamed along with the content.

Keep ID3 metadata allows recording ID3 tags into DVR if your source has them, whether it's Icecast or pulled HLS.


Adding from streams list

You may also easily set up recording from existing incoming and outgoing streams lists. Being in the respective lists, just click on recording button to be redirected to previously described DVR setup dialog.


ABR HLS streams

To have a DVR for ABR HLS stream, just define DVR for single bitrate streams as usual and then create an ABR stream based on those streams. After that you'll be able to play that stream as other DVR streams, check the following section for playback details.

3. DVR recording and playback


The recording process starts as soon as Nimble Streamer starts getting the incoming stream. Each stream is recorded into its own recording path. If only an application is defined then a sub-directory after stream name will be added. If the stream was specified then its path will be used.

Each recording session will be appended into stream location. So you can start, stop and resume incoming stream several times and Nimble Streamer will write the content as if it would be a single session. Obviously, the playback will be played as a single outgoing stream.

To view the existing DVR streams, go to "Nimble Streamer" -> "DVR streams" menu to open DVR streams list as shown below.

List of DVR streams.

As you can see we had 2 publishers, each having separate stream name. So every stream was recorded separately. For each one you can see its server and name, recording path and current recording size, total duration and some media parameters. You also have an option to remove un-used streams recordings as well.

Now for every stream, you can click on a question mark to open sample dialog.

DVR sample playback.
Here you can copy the outgoing DVR stream URL for further usage in your player or application. It also allows viewing the DVR stream in selected players to see what was actually recorded before giving the link outside.

Basically if you have a live stream name like
http://yourhost/live/stream/playlist.m3u8
then your DVR stream URL will be
http://yourhost/live/stream/playlist_dvr.m3u8
ABR live streams work the same way. For ABR stream name like
http://yourhost/live_abr/stream/playlist.m3u8
the DVR stream URL will be
http://yourhost/live_abr/stream/playlist_dvr.m3u8
You may use it in any HLS-capable players.

MPEG-DASH


The same applies to MPEG-DASH except it doesn't support ABR. Your stream like
http://yourhost/live/stream/manifest.mpd
will be available as
http://yourhost/live/stream/manifest_dvr.mpd

fMP4 container for HLS


The HLS URLs described above will have their content packaged in MPEG2TS container. However you can use fMP4 container for DVR playback, you'll just need to use "fmp4" suffix like this:
http://192.168.0.1:8081/live/music/playlist_fmp4_dvr.m3u8
Adding that suffix will create DVR stream with fMP4 container.

Both MPEG2TS and fMP4 DVR streams can be played simultaneously. So you can provide your users with playlist_dvr.m3u8 and playlist_fmp4_dvr.m3u8 URLs depending on their device type.

fMP4 container will work the same way as MPEG2TS for all DVR-related features like selecting range or time shift.

Removing DVR archives


Each recorded stream has its own archive. That archive is not mapped to a DVR setting so if you delete DVR setting from the DVR settings page, the archive files won't be deleted. Only the setting will disappear from the panel.

If you need to delete archives, you need to do it manually using DVR stream page. Notice that if you don't stop the DVR setting and will try to remove the archive, it will appear again because the setting will have the same destination for recording.
So in order to delete archive files, switch the stream to Read-only mode, and then delete files from DVR Streams page.
 
If you removed the DVR setting but kept the recorded streams archives, you may create the DVR setting again for the same stream. In this case Nimble will detect the old files on a hard drive and show it as one archive e.g. duration in the panel and on the timeline.

If you Pause DVR settings for the specific stream, you won't have its DVR streams shown on the DVR Streams page, as this is considered a stopped DVR setting, which makes Nimble 'forget' the DVR recorded stream until it is resumed.

Troubleshooting


Video/audio timing. Sometimes when MPEG-TS stream is used as a media source, it may have some glitches either in video or audio. This is caused by third-party encoders which set incorrect time stamps assigned to media fragments. Check timing errors handling article to learn more details about fixing this kind of issues.

Audio glitches. If you use HLS DVR output with MPEG-TS containers and have audio glitches or audio is missing, you need to enable interleaving compensation for the target application. Click on Nimble Streamer -> Live streams settings top menu, choose the application which you record your DVR for, then check Enable interleaving compensation option and set Min delay time must be set to "0".

MPEG-TS or HLS pull source. If you use pulled MPEG-TS or HLS as a source for your live stream, you need to make the following DVR setting adjustment. Go to DVR setup dialog for your DVR stream, click on Advanced settings... item and check Keep protocol timestamps check box. This will prevent possible issues with source timestamps.

DVR in SLDP HTML5 Player

HLS DVR streams can be added to SLDP HTML5 Player for rewinding low latency streams.

DVR API

Please notice that you may also control DVR via API in order to automate your streaming infrastructure.

If you'd like to export DVR into MP4, you can use this API call or use this instruction for other option.


Related documentation


12 comments:

  1. Great feature, well done gentlemen.

    ReplyDelete
    Replies
    1. Thanks, Behnam! Looking forward to your feedback.

      Delete
  2. Replies
    1. Thanks! Feel free to sign up and try it in action.

      Delete
  3. Can I bypass Wowza DVR and use Nimble DVR? I am also streaming multiple bitrates from Wowza, Any impact?

    ReplyDelete
    Replies
    1. We'll release ABR support this week and you will be able to use DVR with multiple bitrate streams.

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Very nice! A-1 work!
    It would be greeeeaaaat,
    1) if we could start and stop recording via API (e.g. based on EPG)
    2) if we could grab a list of existing recordings via API

    ReplyDelete
    Replies
    1. Thank you for the feedback!
      We've just introduced API for DVR: https://wmspanel.com/api_info We'll announce it very soon, please stay tuned for updates.

      Delete
  6. Hopefully I'm not missing something here, is there a way for the DVR URL to provide the LIVE stream content if it is not currently DVR'ing? i.e. i have abr/stream_HD which will be live for 60 minutes ahead of event start, and at event start I will click Record on DVR. At which point any new users joining should see the DVR track, I wouldn't expect pre existing "live" viewers to magically see the track after record starts. Does that make sense?

    Also - you mention above extra articles to deal with threads etc., is there any guidance on that on a transcoder machine?

    ReplyDelete
    Replies
    1. I suppose what I'm trying to do is maybe slightly off-piste, rather than starting a stream 5 minutes before an event, I want it live showing canned footage to allow viewers to be satisfied stream is good; therefore 60 minutes of 'dead' air before DVR window is undesirable. Regular use case would be go live, hit DVR record, show starts, etc.

      Delete
    2. Hello David.
      You can use Time-shifted DVR as described in this article . So you can specify URL like /live/channel1/playlist_dvr_timeshift-3600.m3u8 and users will see stream 1 hour behind and can fast-forward up to current time. Is that what you need?

      Could you refine - what kind of guidance are you need? Is there some specific topic you want to clarify?

      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.