Wowza Community

Need advise for implementing timeshift, catchup or start tv for IPTV

Hi,

We are currently integrating the wowza server for a project which requires the implementation of timeshifting features. I know the definition of timeshifting is pretty vague so to make it clear I will describe the actually workflow we wanted to achieve. For example: In the interface of the IPTV middleware we have an application which displays the EPG, The user should be able to select the previous programs on a specific channel from this interface and then play this programs. In addition they should be able to rewind, pause, fastforward and choose to go to live (means the current broadcast). The source of the video/audio is multicast udp.but the output coming from the Wowza Media server can be unicast http or rtsp.

I have been searching through the documentation and so far what I have learned is that we can use the combination of nDVR and Trancoder to implement these features and the client media player can then connect to the Wowza Server using http and with the supplied wowzaplayerstart=?? and wowzaplayduration=??? parameters. for example;

  1. we set-up the nDVR to record and transcode the video coming from the multicast source, on the Application.xml we set the 10368000 to buffer the video for 48 hours and delete to delete the oldest part of the stream.

  2. We set the transcoder to transcode the video to 720p.

  3. When the user select which programs from the previous EPG they want to play, from the programs starting and endtime, we can then calculate in which part exactly is this program from the recorded stream, then we just tell the client media player to attached this to the url parameters of wowzaplayerstart and wowzaplayerduration.

Would you guys recommend this kind of set-up or do we have to messup with the Wowza API to create our module? Any comment or advise wold be very much appreciated.

Another problem I am encountering is that even if I set all the encoders, except the 720p, in trancoder.xml to false. I am still having 2 directories in the content directory. for example; mystream.stream.0 and mystream.stream.720p. The mystream.stream.o have bigger file size so i am guessing this would be the recording of the original stream, This occupies a lot of disk space. Is there a way we can configure the appilaction to save only the 720p specified in the transcode.xml?

Regards

Hi,

We are currently integrating the wowza server for a project which requires the implementation of timeshifting features. I know the definition of timeshifting is pretty vague so to make it clear I will describe the actually workflow we wanted to achieve. For example: In the interface of the IPTV middleware we have an application which displays the EPG, The user should be able to select the previous programs on a specific channel from this interface and then play this programs. In addition they should be able to rewind, pause, fastforward and choose to go to live (means the current broadcast). The source of the video/audio is multicast udp.but the output coming from the Wowza Media server can be unicast http or rtsp.

I have been searching through the documentation and so far what I have learned is that we can use the combination of nDVR and Trancoder to implement these features and the client media player can then connect to the Wowza Server using http and with the supplied wowzaplayerstart=?? and wowzaplayduration=??? parameters. for example;

  1. we set-up the nDVR to record and transcode the video coming from the multicast source, on the Application.xml we set the 10368000 to buffer the video for 48 hours and delete to delete the oldest part of the stream.

  2. We set the transcoder to transcode the video to 720p.

  3. When the user select which programs from the previous EPG they want to play, from the programs starting and endtime, we can then calculate in which part exactly is this program from the recorded stream, then we just tell the client media player to attached this to the url parameters of wowzaplayerstart and wowzaplayerduration.

Would you guys recommend this kind of set-up or do we have to messup with the Wowza API to create our module? Any comment or advise wold be very much appreciated.

Another problem I am encountering is that even if I set all the encoders, except the 720p, in trancoder.xml to false. I am still having 2 directories in the content directory. for example; mystream.stream.0 and mystream.stream.720p. The mystream.stream.o have bigger file size so i am guessing this would be the recording of the original stream, This occupies a lot of disk space. Is there a way we can configure the appilaction to save only the 720p specified in the transcode.xml?

Regards

I would read How to Plan Your nDVR Workflow which talks about some of the trade-offs to consider (single 48 hour recording versus smaller recordings, other ways to record instead of DVR, etc)

All the DVR articles are here: https://www.wowza.com/docs/wowza-ndvr

Wowza nDVR Articles

  1. Correct on WindowDuration. You will also need to set the parameter “dvrMaximumRecordingLength”. We cap the maximum recording length at 30 hours because very large recordings consume lots of memory resources which we want folks to be aware of. You can override this by setting this value in your Application.xml to something a bit more than 48 hours. It goes under DVR/Properties.
<Property>
	<Name>dvrMaximumRecordingLength</Name>
        <Value>108000</Value>
        <Type>Long</Type>
</Property>
  1. delete may be the correct choice for you. Although it doesn’t mean delete anything > 48 hours. It means when “stream1” starts streaming to DVR, if we’ve already recorded stream1, delete the old one.

  2. The Wowza nDVR Playlist Request API describes how to select a portion of the recorded DVR.

  3. You may want to consider using your EPG to record the programs into separate DVR streams as they come into Wowza, instead of separating a large recording that continually records. One reason is even though you are selecting portions of the recording to play back, the 48 DVR store is considered one unit by the DVR system. So when the first person selects a portion of that stream, the info for the entire 48 hour recording is loaded into Wowza. Wowza has logic so that when no one is using this stream it will be unloaded, which is great for freeing resources. But if everyone is looking at portions of the same DVR stream, it will rarely if ever time out and be unloaded. Not a problem is you have a single 48 hour recording, but if you are running a server with 10 or 20 different live streams, loading that many 48 hour recordings could become a problem. Smaller recordings allow things to time out and swap out of the server. That’s just one example.

Scott

Hi

The current set-up plan looks like it will do the requirements listed above.

Saving the transcoded stream but not the source stream would be done by having an application that accepts the source with the transcoder (no nDVR configured) then use a .stream file in another application to repeat the transcoded stream at 720p with nDVR configured to record in the 48hour window as mentioned above.

Repeater tutorial is here,

https://www.wowza.com/docs/how-to-lock-multi-bitrate-streams-on-live-stream-repeater-edge

You will only be needing the one .stream file and don’t need to worry about multi-bitrate or .smil file configuration.

Jason

Another way to do this on a single server is to add a very small java module to the server, which allows you to choose which streams get recorded by DVR.

For your case, it looks like this:

package com.wowza.wms.plugin.test.dvr.api;
import com.wowza.wms.application.IApplicationInstance;
import com.wowza.wms.module.ModuleBase;
import com.wowza.wms.stream.IMediaStream;
import com.wowza.wms.stream.livedvr.ILiveStreamDvrRecorderControl;
public class ModuleDvrRecordingControlExample extends ModuleBase implements ILiveStreamDvrRecorderControl
{
    public ModuleDvrRecordingControlExample() { /*no-op*/ }
    public void onAppStart(IApplicationInstance appInstance) {
        appInstance.setLiveStreamDvrRecorderControl(this);     
    }
    public void onAppStop(IApplicationInstance appInstance) { /*no-op*/ }
    public boolean shouldDvrRecord(String recorderName, IMediaStream stream) {
        String streamName = stream.getName();
        
		System.out.printf("RecorderName: %s  stream.name:%s\n", recorderName, streamName);
        
		if (streamName.endsWith("720p")) {
			return true;
		}
        
        return false;
    }
}

The Wowza User’s Guide has a chapter on extending the server which would explain how to deploy this module.

I would read How to Plan Your nDVR Workflow which talks about some of the trade-offs to consider (single 48 hour recording versus smaller recordings, other ways to record instead of DVR, etc)

All the DVR articles are here: https://www.wowza.com/docs/wowza-ndvr

Wowza nDVR Articles

  1. Correct on WindowDuration. You will also need to set the parameter “dvrMaximumRecordingLength”. We cap the maximum recording length at 30 hours because very large recordings consume lots of memory resources which we want folks to be aware of. You can override this by setting this value in your Application.xml to something a bit more than 48 hours. It goes under DVR/Properties.
<Property>
	<Name>dvrMaximumRecordingLength</Name>
        <Value>108000</Value>
        <Type>Long</Type>
</Property>
  1. delete may be the correct choice for you. Although it doesn’t mean delete anything > 48 hours. It means when “stream1” starts streaming to DVR, if we’ve already recorded stream1, delete the old one.

  2. The Wowza nDVR Playlist Request API describes how to select a portion of the recorded DVR.

  3. You may want to consider using your EPG to record the programs into separate DVR streams as they come into Wowza, instead of separating a large recording that continually records. One reason is even though you are selecting portions of the recording to play back, the 48 DVR store is considered one unit by the DVR system. So when the first person selects a portion of that stream, the info for the entire 48 hour recording is loaded into Wowza. Wowza has logic so that when no one is using this stream it will be unloaded, which is great for freeing resources. But if everyone is looking at portions of the same DVR stream, it will rarely if ever time out and be unloaded. Not a problem is you have a single 48 hour recording, but if you are running a server with 10 or 20 different live streams, loading that many 48 hour recordings could become a problem. Smaller recordings allow things to time out and swap out of the server. That’s just one example.

Scott

Hi Scott,

Thank you for all the help and advise, after many hours of research I have finally finish the first part of this project. I heed your advise and used the ILiveStreamDvrRecorder class to just record a portion of the stream based on the given start and end time from the epg. So I ended up with each recorded programs having their own directory, and inside are their m4fv and m4fa files, in the content folder.

Now I have a little doubt on how can I delete streams or folder that was created beyond the given “catchup” recording time period. Is there an API in which I can check if there is a client connected to this stream and delete it if there isn’t any or can I just use the normal Java IO API to check the dates the forder was created and just delete them if they are beyond the time period? Before, my plans was to just have a single continious recording for each stream and use the windowduration and let wowza purge the recording but now that I have multiple recording of a single input stream for each program, I am guessing I have to implement my own way of purging these recordings.

Thanks in advance.

Best regards,

Ferdinand