Results 1 to 9 of 9

Thread: Record Multiple Files Simultaneously From A Single Stream

  1. #1

    Default Record Multiple Files Simultaneously From A Single Stream

    I couldn't get this to work so I wanted to see if there is a workaround or if this is how it is intended.

    When I attempt to issue an HTTP requests to record two different output filenames from the same stream, the second one never records.

    For example, let's say I have a stream that is going for an hour and I want to record the entire hour. However during that hour I want to issue a command to say record a one minute clip during various times that can be processed and played offline while the original clip is still recording.

    How can I achieve that?

    Thanks!

  2. #2
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Try setting outputPath for one, so it has a different file name

    Richard

  3. #3

    Default

    I tried using outputPath with the same folder and tried a different outputFile for each one and that didn't work. Then I tried a different outputPath AND a different outputFile for each one and that still didn't work.

    Is that something that should work but I'm just calling it wrong?

  4. #4

    Default

    Again - is this something that I should be able to do? I need to know if this is a limitation and/or if this is something I have to work around.

  5. #5
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Sorry, this is not going to work with built-in HTTPLiveStreamRecord. Sorry for misleading. The built-in feature will only allow one recording per stream. However it can work with the LiveStreamRecord API, I tried it with the old ModuleLiveStreamRecord, I just had to comment out these lines:

    //if (prevRecorder != null)
    //	prevRecorder.stopRecording();
    The package with this source is here:
    http://www.wowza.com/downloads/forum...Record_2.0.zip

    There is a Flash UI for this. To make two recordings I had to open two copies of it, and set different file name for outputPath in each. It worked in my test, after re-building the module with the above two lines commented out.

    Richard

  6. #6
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    This just shows that two recordings can be made, but more would need to be done to that module to avoid problems, to know what stream to stop.

    maybe there is a simpler example that works as-is...

    Richard

  7. #7

    Default

    Thanks for letting me know. I'm not sure how to approach things now as the lack of reliable server side recording was one of my reasons for potentially moving to Wowza from FMS. I'm going to have to rethink that approach now as the recording itself seems to be reliable but I need various recorded streams from one live stream and your HTTP LiveStreamRecord was a fantastic feature.

    Can I add that as a feature request?
    Last edited by ImAStreamer; 02-05-2013 at 11:44 AM.

  8. #8
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Yes, there is now a feature request pending to add this ability to the HTTPLiveStreamRecord. I don't know what time frame to expect.

    Meanwhile, here is a much simpler example that use IMediaStreamActionNotify3.onPublish() and onUnPublish() to start and stop recording, and make two recordings from one live stream. For the example, Wowza is writing an .mp4 and .flv file.

    package test;
    
    import java.io.File;
    
    import com.wowza.wms.amf.*;
    import com.wowza.wms.application.*;
    import com.wowza.wms.module.*;
    import com.wowza.wms.stream.*;
    import com.wowza.wms.media.model.*;
    import com.wowza.wms.plugin.integration.liverecord.ILiveStreamRecord;
    import com.wowza.wms.plugin.integration.liverecord.LiveStreamRecorderMP4;
    import com.wowza.wms.plugin.integration.liverecord.LiveStreamRecorderFLV;
    
    public class ModuleMultiRecord extends ModuleBase
    {
    
    	class StreamListener implements IMediaStreamActionNotify3
    	{
    		public void onMetaData(IMediaStream stream, AMFPacket metaDataPacket)
    		{
    			
    		}
    
    		public void onPauseRaw(IMediaStream stream, boolean isPause, double location)
    		{
    			
    		}
    
    		public void onPause(IMediaStream stream, boolean isPause, double location)
    		{
    			
    		}
    
    		public void onPlay(IMediaStream stream, String streamName, double playStart, double playLen, int playReset)
    		{
    			
    		}
    
    		public void onPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend)
    		{
    			ILiveStreamRecord recorderMP4 = null;				
    			recorderMP4 = new LiveStreamRecorderMP4();
    			recorderMP4.setRecordData(true);
    			recorderMP4.setVersionFile(true);
    			recorderMP4.setStartOnKeyFrame(true);
    			recorderMP4.startRecording(stream, "c:/temp/" + stream.getName() + ".mp4", false);
    			
    			ILiveStreamRecord recorderFLV = null;				
    			recorderFLV = new LiveStreamRecorderFLV();
    			recorderFLV.setRecordData(true);
    			recorderFLV.setVersionFile(true);
    			recorderFLV.setStartOnKeyFrame(true);
    			recorderFLV.startRecording(stream, "c:/temp/" + stream.getName() + ".flv", false);
    			
    			stream.getClient().getAppInstance().getProperties().setProperty("recorderMP4", recorderMP4);
    			stream.getClient().getAppInstance().getProperties().setProperty("recorderFLV", recorderFLV);	
    		}
    
    		public void onSeek(IMediaStream stream, double location)
    		{
    			
    		}
    
    		public void onStop(IMediaStream stream)
    		{
    			
    		}
    
    		public void onUnPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend)
    		{
    			ILiveStreamRecord recorderMP4 = (ILiveStreamRecord)stream.getClient().getAppInstance().getProperties().getProperty("recorderMP4");
    			ILiveStreamRecord recorderFLV = (ILiveStreamRecord)stream.getClient().getAppInstance().getProperties().getProperty("recorderFLV");
    			
    			recorderMP4.stopRecording();
    			recorderFLV.stopRecording();
    			
    			recorderMP4 = null;
    			recorderFLV = null;
    			
    		}
    
    		public void onCodecInfoAudio(IMediaStream stream,
    				MediaCodecInfoAudio codecInfoAudio) {
    			
    		}
    
    		public void onCodecInfoVideo(IMediaStream stream,
    				MediaCodecInfoVideo codecInfoVideo) {
    			
    		}
    	}
    
    	public void onStreamCreate(IMediaStream stream)
    	{
    		getLogger().info("onStreamCreate["+stream+"]: clientId:" + stream.getClientId());
    		IMediaStreamActionNotify2 actionNotify = new StreamListener();
    
    		WMSProperties props = stream.getProperties();
    		synchronized (props)
    		{
    			props.put("streamActionNotifier", actionNotify);
    		}
    		stream.addClientListener(actionNotify);
    	}
    
    	public void onStreamDestroy(IMediaStream stream)
    	{
    		getLogger().info("onStreamDestroy["+stream+"]: clientId:" + stream.getClientId());
    
    		IMediaStreamActionNotify2 actionNotify = null;
    		WMSProperties props = stream.getProperties();
    		synchronized (props)
    		{
    			actionNotify = (IMediaStreamActionNotify2) stream.getProperties().get("streamActionNotifier");
    		}
    		if (actionNotify != null)
    		{
    			stream.removeClientListener(actionNotify);
    			getLogger().info("removeClientListener: " + stream.getSrc());
    		}
    	}
    
    }
    Richard

  9. #9

    Default

    Thanks Richard, I really appreciate your help. At least now I have a couple of code examples to try to decide which way to go. I may end up attempting to record the entire stream, then post process the clips using saved timestamps. That creates other issues on the back end since I'd use a lot of resources to record potentially hundreds of simultaneous streams and need to look at disk requirements.

    Please let me know if/when that feature does get added in regards to HTTP recording.

    Thanks again for the help!

Similar Threads

  1. Video Chat: multiple users in single stream
    By swexpert in forum General Forum
    Replies: 3
    Last Post: 05-24-2013, 08:14 AM
  2. Replies: 3
    Last Post: 02-29-2012, 04:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •