Do you try using a .stream file as I suggested?
/content/myStream.stream
Make the contents "myStream", or whatever is actual stream name.
Richard
Do you try using a .stream file as I suggested?
/content/myStream.stream
Make the contents "myStream", or whatever is actual stream name.
Richard
Also as Richard suggested i create a test.stream file with RTMP link:
rtmp://97.74.80.208:1935/live/test.sdp
Now on Flash encoder:
FMS URL: rtmp://rtmp://97.74.80.208:1935/live
Stream: test.sdp
Than on Stream Manager i started a stream name test.stream.
Still the video is not recorded.
I am wondering now my RTMP stream can be recorded with this module.
Please help !
In my suggestion, the contents of test.stream would just be "test.sdp". You are not re-streaming RTMP (like Liverepeater system), you are just aliasing the stream name.
Richard
Richard,
I changed the link to test.sdp only in test.stream file and push again with flash encoder. And started stream with StreamManager.
The stream started successfully, below are the logs but still no recording started:
2011-05-20 20:27:21 GMT+04:00 comment server INFO 200 - RTPMediaCaster.Reconnector[20313166:test/_definst_:test.stream]: start: 1 - - - 96.375 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 20:27:21 GMT+04:00 comment server INFO 200 - RTPSessionDescriptionDataProviderBasic.getStreamIn fo[test/_definst_]: C:/Program Files/Wowza Media Systems/Wowza Media Server 2.2.3/content/test.sdp - - - 96.485 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 20:27:21 GMT+04:00 comment server WARN 200 - RTPSessionDescriptionDataProviderBasic.getStreamIn fo: SDP file missing: C:/Program Files/Wowza Media Systems/Wowza Media Server 2.2.3/content/test.sdp - - - 96.485 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 20:27:22 GMT+04:00 comment server INFO 200 - HTTPStreamManager.onHTTPRequest: Publish stream successfully started [test/_definst_]: flv:test.stream - - - 97.313 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 20:27:25 GMT+04:00 app-stop application INFO 200 _definst_ live/_definst_ - - - 101.032 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 20:27:25 GMT+04:00 comment server INFO 200 - ModuleStreamRecord.onAppStop - - - 101.032 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 20:27:33 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSmoothStreaming.addFragment[test/_definst_/test.sdp]: Add chunk: type:video id:3 count:150 duration:12495 - - - 108.328 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 20:27:33 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSanJose.endChunkTS[test/_definst_/test.sdp]: Add chunk: id:6 a/v/k:270/151/1 duration:12496 - - - 108.469 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 20:27:33 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerCupertino.endChunkTS[test/_definst_/test.sdp]: Add chunk: id:6 a/v/k:90/150/1 duration:12496 - - - 108.719 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 20:27:43 GMT+04:00 comment server INFO 200 - ModuleStreamRecord.onAppStart - - - 119.094 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 20:27:43 GMT+04:00 app-start application INFO 200 _definst_ live/_definst_ - - - 119.11 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 20:27:43 GMT+04:00 connect-pending session INFO 100 182.177.107.143 - _defaultVHost_ live _definst_ 0.797 [any] 1935 rtmp://97.74.80.208/live 182.177.107.143 rtmp http://www.hamariweb.com/pakistan-tv...els/player.swf WIN 10,3,181,14 923086104 3451 3073 - - - - - - - - - - - - - rtmp://97.74.80.208/live -
2011-05-20 20:27:43 GMT+04:00 connect session INFO 200 182.177.107.143 - _defaultVHost_ live _definst_ 0.797 [any] 1935 rtmp://97.74.80.208/live 182.177.107.143 rtmp http://www.hamariweb.com/pakistan-tv...els/player.swf WIN 10,3,181,14 923086104 3451 3073 - - - - - - - - - - - - - rtmp://97.74.80.208/live -
Still looking for a resolution on this matter.
-Mamoor
Mamoor,
Sorry, one correction: .stream files are not right thing to use in this case. Instead use .play files. same concept but the file extension is .play. For example a file named myStream.play with contents "myStream". If you are publishing a rtmp stream named myStream, you can then play the alias myStream.play
In the server side code you are using there is a least one line where ".stream" should be changed to ".play", then recompiled. Look for other occurrences that need to be changed.
Richard
Last edited by rrlanham; 05-20-2011 at 10:47 AM.
Richard,
I changed the mystream.stream to mystream.play
Inside file is mystream
On flash encoder:
Stream name: mystream
Started the stream from encoder and started the stream from StreamManager > live/mystream.play
But still no luck on recording
Below are the logs:
---------------------------------------------------------------------------------------
2011-05-20 22:01:53 GMT+04:00 comment server INFO 200 - ModuleStreamRecord.onAppStart - - - 4.75 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:01:53 GMT+04:00 app-start application INFO 200 _definst_ live/_definst_ - - - 4.797 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:01:53 GMT+04:00 connect-pending session INFO 100 2.51.134.125 - _defaultVHost_ live _definst_ 0.875 [any] 1935 rtmp://97.74.80.208/live 2.51.134.125 rtmp http://www.hamariweb.com/pakistan-tv...els/player.swf WIN 10,3,180,65 1734474552 3451 3073 - - - - - - - - - - - - - rtmp://97.74.80.208/live -
2011-05-20 22:01:53 GMT+04:00 connect session INFO 200 2.51.134.125 - _defaultVHost_ live _definst_ 0.875 [any] 1935 rtmp://97.74.80.208/live 2.51.134.125 rtmp http://www.hamariweb.com/pakistan-tv...els/player.swf WIN 10,3,180,65 1734474552 3451 3073 - - - - - - - - - - - - - rtmp://97.74.80.208/live -
2011-05-20 22:01:54 GMT+04:00 create stream INFO 200 - - _defaultVHost_ live _definst_ 0.016 [any] 1935 rtmp://97.74.80.208/live 2.51.134.125 rtmp http://www.hamariweb.com/pakistan-tv...els/player.swf WIN 10,3,180,65 1734474552 3522 3411 1 0 0 0 - - - - - - rtmp://97.74.80.208/live rtmp://97.74.80.208/live - rtmp://97.74.80.208/live -
2011-05-20 22:01:54 GMT+04:00 destroy stream INFO 200 ary_low - _defaultVHost_ live _definst_ 0.641 [any] 1935 rtmp://97.74.80.208/live 2.51.134.125 rtmp http://www.hamariweb.com/pakistan-tv...els/player.swf WIN 10,3,180,65 1734474552 3572 3637 1 - 0 0 ary_low - - - - - rtmp://97.74.80.208/live/ary_low rtmp://97.74.80.208/live/ary_low - rtmp://97.74.80.208/live -
2011-05-20 22:01:54 GMT+04:00 disconnect session INFO 200 1734474552 - _defaultVHost_ live _definst_ 1.875 [any] 1935 rtmp://97.74.80.208/live 2.51.134.125 rtmp http://www.hamariweb.com/pakistan-tv...els/player.swf WIN 10,3,180,65 1734474552 3572 3637 - - - - - - - - - - - - - rtmp://97.74.80.208/live -
2011-05-20 22:01:59 GMT+04:00 connect-pending session INFO 100 58.181.108.19 - _defaultVHost_ live _definst_ 0.813 [any] 1935 rtmp://97.74.80.208/live 58.181.108.19 rtmp rtmp://97.74.80.208/live FMLE/3.0 (compatible; FMSc/1.0) 766775432 3253 3073 - - - - - - - - - - - - - rtmp://97.74.80.208/live -
2011-05-20 22:01:59 GMT+04:00 connect session INFO 200 58.181.108.19 - _defaultVHost_ live _definst_ 0.813 [any] 1935 rtmp://97.74.80.208/live 58.181.108.19 rtmp rtmp://97.74.80.208/live FMLE/3.0 (compatible; FMSc/1.0) 766775432 3253 3073 - - - - - - - - - - - - - rtmp://97.74.80.208/live -
2011-05-20 22:02:04 GMT+04:00 create stream INFO 200 - - _defaultVHost_ live _definst_ 0.0 [any] 1935 rtmp://97.74.80.208/live 58.181.108.19 rtmp rtmp://97.74.80.208/live FMLE/3.0 (compatible; FMSc/1.0) 766775432 3400 3563 1 0 0 0 - - - - - - rtmp://97.74.80.208/live rtmp://97.74.80.208/live - rtmp://97.74.80.208/live -
2011-05-20 22:02:04 GMT+04:00 publish stream INFO 200 mystream - _defaultVHost_ live _definst_ 0.39 [any] 1935 rtmp://97.74.80.208/live 58.181.108.19 rtmp rtmp://97.74.80.208/live FMLE/3.0 (compatible; FMSc/1.0) 766775432 3493 3604 1 0 0 0 mystream videoKeyframeFrequency=5&totalDatarate=132 - - - - rtmp://97.74.80.208/live/mystream?videoKeyframeFrequency=5&totalDatarate=13 2 rtmp://97.74.80.208/live/mystream videoKeyframeFrequency=5&totalDatarate=132 rtmp://97.74.80.208/live -
2011-05-20 22:02:06 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSanJose.init[live/_definst_/mystream]: chunkDurationTarget: 10000 - - - 17.953 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:06 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSanJose.init[live/_definst_/mystream]: chunkDurationTolerance: 500 - - - 17.953 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:06 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSanJose.init[live/_definst_/mystream]: playlistChunkCount:4 - - - 17.953 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:06 GMT+04:00 comment server INFO 200 - MediaStreamMap.getLiveStreamPacketizer: Create live stream packetizer: sanjosestreamingpacketizer:mystream - - - 17.953 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:06 GMT+04:00 comment server INFO 200 - SanJosePacketHandler.startStream[live/_definst_/mystream] - - - 17.953 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:06 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSanJose.handlePacket: Audio codec: AAC - - - 17.953 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:06 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerCupertino.init[live/_definst_/mystream]: chunkDurationTarget: 10000 - - - 17.984 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:06 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerCupertino.init[live/_definst_/mystream]: chunkDurationTolerance: 500 - - - 17.984 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:06 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerCupertino.init[live/_definst_/mystream]: audioGroupCount: 3 - - - 17.984 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:06 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerCupertino.init[live/_definst_/mystream]: playlistChunkCount:3 - - - 17.984 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:06 GMT+04:00 comment server INFO 200 - MediaStreamMap.getLiveStreamPacketizer: Create live stream packetizer: cupertinostreamingpacketizer:mystream - - - 17.984 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:06 GMT+04:00 comment server INFO 200 - CupertinoPacketHandler.startStream[live/_definst_/mystream] - - - 18.0 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:07 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mystream]: Audio codec:AAC isCompatible:true - - - 18.0 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:07 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mystream][mp4a.40.2]: AAC Audio info: {AACFrame: size: 0, rate: 22050, channels: 1, samples: 1024, errorBitsAbsent: true, profileObjectType: "LC"} - - - 18.0 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:07 GMT+04:00 comment server INFO 200 - MediaStreamMap.getLiveStreamPacketizer: Create live stream packetizer: smoothstreamingpacketizer:mystream - - - 18.015 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:07 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSmoothStreaming.startStream[live/_definst_/mystream] - - - 18.015 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:07 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSanJose.handlePacket: Video codec: H264 - - - 18.406 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:07 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mystream]: Video codec:H264 isCompatible:true - - - 18.406 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:07 GMT+04:00 comment server WARN 200 - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mystream][avc1.77.30]: H.264 Video encoding settings are beyond iPhone/iPod touch recommendations (Baseline/3.0): {H264CodecConfigInfo: profile: "Main", level: 3.0, frameSize: 640x480, displaySize: 640x480, PAR: 1:1} - - - 18.422 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:12 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSmoothStreaming.flushPendingAu dio: Bitrate[live/_definst_/mystream]: 32016 - - - 23.547 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:12 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSmoothStreaming.addFragment[live/_definst_/mystream]: Add chunk: type:audio id:0 count:44 duration:2035 - - - 23.562 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:14 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSmoothStreaming.addFragment[live/_definst_/mystream]: Add chunk: type:audio id:1 count:44 duration:2044 - - - 25.531 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:16 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSmoothStreaming.addFragment[live/_definst_/mystream]: Add chunk: type:audio id:2 count:44 duration:2045 - - - 27.515 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:18 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSmoothStreaming.addFragment[live/_definst_/mystream]: Add chunk: type:audio id:3 count:44 duration:2042 - - - 29.703 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:20 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSanJose.endChunkTS[live/_definst_/mystream]: Add chunk: id:1 a/v/k:295/151/1 duration:13636 - - - 31.281 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:20 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mystream]: Add chunk: id:1 a/v/k:98/150/1 duration:13636 - - - 31.281 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:20 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSmoothStreaming.addFragment[live/_definst_/mystream]: Add chunk: type:audio id:4 count:44 duration:2043 - - - 31.906 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:22 GMT+04:00 comment server INFO 200 - RTPMediaCaster.create[14113863] - - - 33.562 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:22 GMT+04:00 comment server INFO 200 - RTPMediaCaster.init[14113863] - - - 33.562 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:22 GMT+04:00 comment server INFO 200 - RTPMediaCaster.Reconnector[14113863:live/_definst_:mystream]: start: 1 - - - 33.562 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:22 GMT+04:00 comment server INFO 200 - RTPSessionDescriptionDataProviderBasic.getStreamIn fo[live/_definst_]: C:/Program Files/Wowza Media Systems/Wowza Media Server 2.2.3/content/mystream - - - 33.672 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:22 GMT+04:00 comment server WARN 200 - RTPSessionDescriptionDataProviderBasic.getStreamIn fo: SDP file missing: C:/Program Files/Wowza Media Systems/Wowza Media Server 2.2.3/content/mystream - - - 33.672 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:22 GMT+04:00 comment server INFO 200 - LiveStreamPacketizerSmoothStreaming.addFragment[live/_definst_/mystream]: Add chunk: type:audio id:5 count:44 duration:2044 - - - 33.922 - - - - - - - - - - - - - - - - - - - - - - - - -
2011-05-20 22:02:23 GMT+04:00 comment server INFO 200 - HTTPStreamManager.onHTTPRequest: Publish stream successfully started [live/_definst_]: flv:mystream - - - 34.015 - - - - - - - - - - - - - - - - - - - - - - - - -
----------------------------------------------------------------------------------------------------
Please help how can i record an rtmp stream.
-Mamoor
StreamManager is not used in this, and won't work, it's breaking it probably. Restart Wowza to get a clean start. After the encoder publishes myStream to the application, you can test the .play file in LiveVideoStreaming player (no stream manager):
Server: rtmp://[wowza-address]:1935/live
Stream: myStream.play
I tested with rtmp encoder using same names and Wowza player.
Richard
I'm using wowza media server2 prepetual 2.2.4 build27452
Flash Media Encoder 3.2 with (MP4:+streamname)
streamrecord hourly
I built the follwoing code using wowza IDE. it works good
with the follwoing Application ConfCode:package streamrecord.hourly.monthlyrollover; import java.io.File; import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.TimeZone; import com.wowza.wms.application.*; import com.wowza.wms.module.*; import com.wowza.wms.plugin.integration.liverecord.*; import com.wowza.wms.stream.IMediaStream; import com.wowza.wms.stream.IMediaStreamActionNotify; import com.wowza.wms.stream.IMediaStreamNotify; public class ModuleStreamRecord extends ModuleBase implements IMediaStreamNotify { private IApplicationInstance appInstance; private String timezone; private StreamTimer streamTimer; private int date; private int startHour = 0; private int endHour = 23; private int hourOfDay = -1; private boolean record = false; private PublishNotifier publishNotifier; private List<String> streams; public static final int FORMAT_UNKNOWN = 0; public static final int FORMAT_FLV = 1; public static final int FORMAT_MP4 = 2; private Map<String, ILiveStreamRecord> recorders = null; private class StreamTimer extends Thread { private boolean doQuit = false; public synchronized void quit() { doQuit = true; } public void run() { while (true) { try { TimeZone tz = TimeZone.getTimeZone(timezone); Calendar cal = Calendar.getInstance(tz); date = cal.get(Calendar.DATE); int prevHour = hourOfDay; hourOfDay = cal.get(Calendar.HOUR_OF_DAY); int start = startHour; int end = endHour; if (start > end && hourOfDay > start) { end += 24; } if (end < start && hourOfDay < end) { start -=24; } if (hourOfDay >= start && hourOfDay < end) { record = true; } else { record = false; } streams = appInstance.getMediaCasterStreams().getMediaCasterNames(); if (prevHour != hourOfDay && record) { for (String streamName : streams) { IMediaStream stream = appInstance.getStreams().getStream(streamName); appInstance.getVHost().getHandlerThreadPool().execute(new DoStartRecording(stream, streamName)); } } else if(!record) { for (String streamName : streams) { ILiveStreamRecord recorder = recorders.remove(streamName); if(recorder != null) recorder.stopRecording(); } } Thread.currentThread(); Thread.sleep(60000); synchronized (this) { if (doQuit) { break; } } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } public void onAppStart(IApplicationInstance appInstance) { this.appInstance = appInstance; WMSProperties props = appInstance.getProperties(); startHour = props.getPropertyInt("startHour", 0); endHour = props.getPropertyInt("endHour", 24); timezone = props.getPropertyStr("timezone", "America/Chicago"); appInstance.addMediaStreamListener(this); recorders = Collections.synchronizedMap(new HashMap<String, ILiveStreamRecord>()); publishNotifier = new PublishNotifier(); streamTimer = new StreamTimer(); streamTimer.setName("RecordController-" + appInstance.getApplication().getName()); streamTimer.setDaemon(true); streamTimer.start(); } public void onAppStop(IApplicationInstance appInstance) { streamTimer.quit(); // cleanup any recorders that are still running synchronized (recorders) { Iterator<String> iter = recorders.keySet().iterator(); while(iter.hasNext()) { String streamName = iter.next(); ILiveStreamRecord recorder = recorders.get(streamName); recorder.stopRecording(); getLogger().info(" stopRecording: "+streamName); } recorders.clear(); } recorders = null; appInstance.removeMediaStreamListener(this); publishNotifier = null; } private synchronized void startRecording(IMediaStream stream) { String streamAlias = stream.getName().substring(0, stream.getName().indexOf(".stream")); if (!streamAlias.isEmpty()) { String outputPath = appInstance.getStreamStorageDir()+"/"+String.format("%02d", date); //day; boolean append = false; File path = new File(outputPath); if (path.exists()) { File outputFile = new File(path.getPath()+File.separator+streamAlias+"_"+String.format("%02d", hourOfDay)+".mp4"); Date today = new Date(); if (!(outputFile.lastModified() < today.getTime() - 86400000)) { append = true; } } else { path.mkdirs(); } recordStream(stream, FORMAT_MP4, append, outputPath+File.separator+streamAlias+"_"+String.format("%02d", hourOfDay)+".mp4", false, true, true); } } private void recordStream(IMediaStream stream, int format, boolean append, String outputPath, boolean versionFile, boolean startOnKeyFrame, boolean recordData) { String streamName = stream.getName(); // if a format was not specified then check the stream prefix and choose accordingly if (format == FORMAT_UNKNOWN) { format = FORMAT_FLV; String extStr = stream.getExt(); if (extStr.equals("mp4")) format = FORMAT_MP4; } String params = "stream:"+streamName; params += " format:"+(format==FORMAT_MP4?"mp4":"flv"); params += " append:"+append; if (outputPath != null) params += " outputPath:"+outputPath; else { File writeFile = stream.getStreamFileForWrite(); params += " outputPath:"+writeFile.getAbsolutePath(); } params += " versionFile:"+versionFile; params += " startOnKeyFrame:"+startOnKeyFrame; params += " recordData:"+recordData; getLogger().info("ModuleStreamRecord.startRecording: "+params); // create a stream recorder and save it in a map of recorders ILiveStreamRecord recorder = null; // create the correct recorder based on format if (format == FORMAT_MP4) recorder = new LiveStreamRecorderMP4(); else recorder = new LiveStreamRecorderFLV(); // add it to the recorders list ILiveStreamRecord prevRecorder = recorders.get(streamName); if (prevRecorder != null) prevRecorder.stopRecording(); recorders.put(streamName, recorder); // if you want to record data packets as well as video/audio recorder.setRecordData(recordData); // Set to true if you want to version the previous file rather than overwrite it recorder.setVersionFile(versionFile); // If recording only audio set this to false so the recording starts immediately recorder.setStartOnKeyFrame(startOnKeyFrame); // start recording recorder.startRecording(stream, outputPath, append); } @Override public void onMediaStreamCreate(IMediaStream stream) { stream.addClientListener(publishNotifier); } @Override public void onMediaStreamDestroy(IMediaStream stream) { stream.removeClientListener(publishNotifier); if(!stream.isPlay()) { ILiveStreamRecord recorder = recorders.remove(stream.getName()); if (recorder != null) recorder.stopRecording(); } } private class PublishNotifier implements IMediaStreamActionNotify { @Override public void onPause(IMediaStream stream, boolean isPause, double location) { // TODO Auto-generated method stub } @Override public void onPlay(IMediaStream stream, String streamName, double playStart, double playLen, int playReset) { // TODO Auto-generated method stub } @Override public void onPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend) { if(record) appInstance.getVHost().getHandlerThreadPool().execute(new DoStartRecording(stream, streamName)); } @Override public void onSeek(IMediaStream stream, double location) { // TODO Auto-generated method stub } @Override public void onStop(IMediaStream stream) { // TODO Auto-generated method stub } @Override public void onUnPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend) { ILiveStreamRecord recorder = recorders.remove(streamName); if (recorder != null) { // stop recording recorder.stopRecording(); } } } private class DoStartRecording implements Runnable { private IMediaStream stream; private String streamName; private DoStartRecording(IMediaStream stream, String streamName) { this.stream = stream; this.streamName = streamName; } public void run() { List<String> mediaCasters = appInstance.getMediaCasterStreams().getMediaCasterNames(); if (mediaCasters.contains(streamName)) { int lockCount = appInstance.getMediaCasterStreams().getMediaCaster(streamName).getLockCount(); if (lockCount > 0) startRecording(stream); } } } }
i want to record exactly 1 hour then split to new folder but it never happened it records less or more and never exceeded 55 minCode:<Root> <Application> <!-- Uncomment to set application level timeout values <ApplicationTimeout>60000</ApplicationTimeout> <PingTimeout>12000</PingTimeout> <ValidationFrequency>8000</ValidationFrequency> <MaximumPendingWriteBytes>0</MaximumPendingWriteBytes> <MaximumSetBufferTime>60000</MaximumSetBufferTime> <MaximumStorageDirDepth>25</MaximumStorageDirDepth> --> <Connections> <AutoAccept>true</AutoAccept> <AllowDomains></AllowDomains> </Connections> <!-- StorageDir path variables ${com.wowza.wms.AppHome} - Application home directory ${com.wowza.wms.ConfigHome} - Configuration home directory ${com.wowza.wms.context.VHost} - Virtual host name ${com.wowza.wms.context.VHostConfigHome} - Virtual host config directory ${com.wowza.wms.context.Application} - Application name ${com.wowza.wms.context.ApplicationInstance} - Application instance name --> <Streams> <StreamType>live-record</StreamType> <StorageDir>${com.wowza.wms.context.VHostConfigHome}/content/qt</StorageDir> <KeyDir>${com.wowza.wms.context.VHostConfigHome}/keys</KeyDir> <!-- LiveStreamPacketizers (separate with commas): cupertinostreamingpacketizer, smoothstreamingpacketizer, sanjosestreamingpacketizer, cupertinostreamingrepeater, smoothstreamingrepeater, sanjosestreamingrepeater --> <LiveStreamPacketizers>cupertinostreamingpacketizer,smoothstreamingpacketizer,sanjosestreamingpacketizer</LiveStreamPacketizers> <!-- Properties defined here will override any properties defined in conf/Streams.xml for any streams types loaded by this application --> <Properties> </Properties> </Streams> <!-- HTTPStreamers (separate with commas): cupertinostreaming, smoothstreaming, sanjosestreaming --> <HTTPStreamers>cupertinostreaming,smoothstreaming,sanjosestreaming</HTTPStreamers> <SharedObjects> <StorageDir></StorageDir> </SharedObjects> <Client> <IdleFrequency>-1</IdleFrequency> <Access> <StreamReadAccess>*</StreamReadAccess> <StreamWriteAccess>*</StreamWriteAccess> <StreamAudioSampleAccess></StreamAudioSampleAccess> <StreamVideoSampleAccess></StreamVideoSampleAccess> <SharedObjectReadAccess>*</SharedObjectReadAccess> <SharedObjectWriteAccess>*</SharedObjectWriteAccess> </Access> </Client> <RTP> <!-- RTP/Authentication/[type]Methods defined in Authentication.xml. Default setup includes; none, basic, digest --> <Authentication> <PublishMethod>digest</PublishMethod> <PlayMethod>none</PlayMethod> </Authentication> <!-- RTP/AVSyncMethod. Valid values are: senderreport, systemclock, rtptimecode --> <AVSyncMethod>senderreport</AVSyncMethod> <MaxRTCPWaitTime>12000</MaxRTCPWaitTime> <IdleFrequency>75</IdleFrequency> <RTSPSessionTimeout>90000</RTSPSessionTimeout> <RTSPMaximumPendingWriteBytes>0</RTSPMaximumPendingWriteBytes> <RTSPBindIpAddress></RTSPBindIpAddress> <RTSPConnectionIpAddress>0.0.0.0</RTSPConnectionIpAddress> <RTSPOriginIpAddress>127.0.0.1</RTSPOriginIpAddress> <IncomingDatagramPortRanges>*</IncomingDatagramPortRanges> <!-- Properties defined here will override any properties defined in conf/RTP.xml for any depacketizers loaded by this application --> <Properties> </Properties> </RTP> <MediaCaster> <!-- Properties defined here will override any properties defined in conf/MediaCasters.xml for any MediaCasters loaded by this applications --> <Properties> <Property> <Name>forceInterleaved</Name> <Value>true</Value> <Type>Boolean</Type> </Property> </Properties> </MediaCaster> <MediaReader> <!-- Properties defined here will override any properties defined in conf/MediaReaders.xml for any MediaReaders loaded by this applications --> <Properties> </Properties> </MediaReader> <MediaWriter> <!-- Properties defined here will override any properties defined in conf/MediaWriter.xml for any MediaWriter loaded by this applications --> <Properties> </Properties> </MediaWriter> <LiveStreamPacketizer> <!-- Properties defined here will override any properties defined in conf/LiveStreamPacketizers.xml for any LiveStreamPacketizers loaded by this applications --> <Properties> </Properties> </LiveStreamPacketizer> <HTTPStreamer> <!-- Properties defined here will override any properties defined in conf/HTTPStreamers.xml for any HTTPStreamer loaded by this applications --> <Properties> </Properties> </HTTPStreamer> <Repeater> <OriginURL></OriginURL> <QueryString><![CDATA[]]></QueryString> </Repeater> <Modules> <Module> <Name>base</Name> <Description>Base</Description> <Class>com.wowza.wms.module.ModuleCore</Class> </Module> <Module> <Name>properties</Name> <Description>Properties</Description> <Class>com.wowza.wms.module.ModuleProperties</Class> </Module> <Module> <Name>logging</Name> <Description>Client Logging</Description> <Class>com.wowza.wms.module.ModuleClientLogging</Class> </Module> <Module> <Name>flvplayback</Name> <Description>FLVPlayback</Description> <Class>com.wowza.wms.module.ModuleFLVPlayback</Class> </Module> <Module> <Name>liverecord</Name> <Description>StreamRecordModule</Description> <Class>streamrecord.hourly.monthlyrollover.ModuleStreamRecord</Class> </Module> </Modules> <!-- Properties defined here will be added to the IApplication.getProperties() and IApplicationInstance.getProperties() collections --> <Properties> <Property> <Name>starHour</Name> <Value>00</Value> <Type>Integer</Type> </Property> <Property> <Name>endHour</Name> <Value>24</Value> <Type>Integer</Type> </Property> <Property> <Name>timezone</Name> <Value>GMT+03:00</Value> <Type>String</Type> </Property> </Properties> </Application> </Root>
I also want to use Media mover module to move the every day stream to new folder
please advice
Thanks
Last edited by Sam202; 06-27-2011 at 09:41 AM.
I've successful used this module for recording live streams. Now I have the liverepeater-edge stream type and it isn't working as wished: the recording starts only after I start playing a stream and ends after I stop playing it.
I added a ServerListener for starting the application instance at server start but it doesn't find the streams (streams = appInstance.getMediaCasterStreams().getMediaCaster Names().
Do I have to keep playing the streams for 24 hours or is there a nicer method?
Thanks