Wowza Community

Replay live video while still recording

Hi,

I have developed a custom Java module that, on the onPublish event of a live stream from a camera, records it as a MP4 file with this code:

      			//create a livestreamrecorder instance to create .mp4 files
      			ILiveStreamRecord recorder = new LiveStreamRecorderMP4();
      		    recorder.setRecordData(true);
      		    recorder.setStartOnKeyFrame(true);
      		    recorder.setVersionFile(true);
      		       
      			// add it to the recorders list
      			synchronized (recorders)
      			{
      				ILiveStreamRecord prevRecorder = recorders.get(streamName);
      				if (prevRecorder != null)
      					prevRecorder.stopRecording();
      				recorders.put(streamName, recorder);
      			}
      		  recorder.startRecording(stream, false);

Now I would like the user to be able to replay the live video, while still recording it.

Let’s say, the live video lasts 2 hours, a user connects after 1 hour and would like to replay this first recorded hour before the recording has ended.

How can I programmatically create a new stream for this purpose, based on the partially recorded MP4 file?

Hi,

If using LiveStreamRecord you will need the MP4 file to be finalized before playback. This occurs when the recording of that specific file has ended.

Paul

Hi,

Segmenting/splitting the recordings into small chunks that can be played individually might be the best option.

You would need a way to manage the playback of the segmented files. The recording / Splitting can still be accomplished using the

Recording API

Daren

Hi,

If using LiveStreamRecord you will need the MP4 file to be finalized before playback. This occurs when the recording of that specific file has ended.

Paul

Thank you Paul for your answer.

Is there another way to be able to accomplish the “replay while recording” feature (e.g. recording the stream in a different format)?