Results 1 to 8 of 8

Thread: Control live-record by limiting duration of streaming video

  1. #1
    Join Date
    Aug 2012
    Posts
    18

    Default Control live-record by limiting duration of streaming video

    I have an app that is recording (<StreamType>live-record</StreamType>) users webcam and saving the stream on the server. I would like to control this recording by limiting the duration of recording. For example - set the maximum duration to 1min - after that disconnect the stream and save the video. Or if that's not possible maybe limit the file size. For example after file exceeds 10Mb disconnect and save the video.

    Is that possible?

    thanks!

  2. #2
    Join Date
    May 2013
    Posts
    680

    Default

    You may want to check out our LiveStreamRecord module as you can control the stream with a little more versatility.

  3. #3
    Join Date
    Aug 2012
    Posts
    18

    Default

    Thank you - Iam now using LiveStreamRecord module, with <StreamType>live-record</StreamType>
    At the top of the Application.xml - I can see different options, which I guess relate to controling the stream:

    	
    <ApplicationTimeout>60000</ApplicationTimeout>
    <PingTimeout>12000</PingTimeout>
    <ValidationFrequency>8000</ValidationFrequency>
    <MaximumPendingWriteBytes>0</MaximumPendingWriteBytes>
    <MaximumSetBufferTime>60000</MaximumSetBufferTime>
    <MaximumStorageDirDepth>25</MaximumStorageDirDepth>
    What each of these settings mean?
    How would I set it up to stop the stream after 1min?
    How would I set it up to stop the stream after 3Mb file size is reached?

    Here is my Application.xml:

    <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</StorageDir>
    			<KeyDir>${com.wowza.wms.context.VHostConfigHome}/keys</KeyDir>
    			<!-- LiveStreamPacketizers (separate with commas): cupertinostreamingpacketizer, smoothstreamingpacketizer, sanjosestreamingpacketizer, mpegdashstreamingpacketizer, 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>
    		<Transcoder>
    			<!-- To turn on transcoder set to: transcoder -->
    			<LiveStreamTranscoder></LiveStreamTranscoder>
    			<!-- [templatename].xml or ${SourceStreamName}.xml -->
    			<Templates>${SourceStreamName}.xml,transrate.xml</Templates>
    			<ProfileDir>${com.wowza.wms.context.VHostConfigHome}/transcoder/profiles</ProfileDir>
    			<TemplateDir>${com.wowza.wms.context.VHostConfigHome}/transcoder/templates</TemplateDir>
    			<Properties>
    			</Properties>
    		</Transcoder>
    
    		<DVR>
    			<!-- As a single server or as an origin, use dvrstreamingpacketizer in LiveStreamPacketizers above -->
    			<!-- Or, in an origin-edge configuration, edges use dvrstreamingrepeater in LiveStreamPacketizers above -->
    			<!-- As an origin, also add dvrchunkstreaming to HTTPStreamers below -->
    
    			<!-- If this is a dvrstreamingrepeater, define Application/Repeater/OriginURL to point back to the origin -->
    			
    			<!-- To turn on DVR recording set Recorders to dvrrecorder.  This works with dvrstreamingpacketizer  -->
    			<Recorders></Recorders>
    
    			<!-- As a single server or as an origin, set the Store to dvrfilestorage-->
    			<!-- edges should have this empty -->
    			<Store></Store>
    
    			<!--  Window Duration is length of live DVR window in seconds.  0 means the window is never trimmed. -->
    			<WindowDuration>0</WindowDuration>
    
    			<!-- Storage Directory is top level location where dvr is stored.  e.g. c:/temp/dvr -->
    			<StorageDir>${com.wowza.wms.context.VHostConfigHome}/dvr</StorageDir>
    
    			<!-- valid ArchiveStrategy values are append, version, delete -->
    			<ArchiveStrategy>append</ArchiveStrategy>
    
    			<!-- Properties for DVR -->
    			<Properties>
    			</Properties>
    		</DVR>
    
    		<TimedText>
    			<!-- VOD caption providers (separate with commas): vodcaptionprovidermp4_3gpp, vodcaptionproviderttml, vodcaptionproviderwebvtt,  vodcaptionprovidersrt, vodcaptionproviderscc -->
    			<VODTimedTextProviders>vodcaptionprovidermp4_3gpp</VODTimedTextProviders>
    			
    			<!-- Properties for TimedText -->
    			<Properties>
    			</Properties>		
    		</TimedText>		
    
    		<!-- HTTPStreamers (separate with commas): cupertinostreaming, smoothstreaming, sanjosestreaming, mpegdashstreaming, dvrchunkstreaming -->
    		<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>none</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>
    			<RTP>
    				<RTSP>
    					<!-- udp, interleave -->
    					<RTPTransportMode>interleave</RTPTransportMode>
    				</RTSP>
    			</RTP>
    			<!-- Properties defined here will override any properties defined in conf/MediaCasters.xml for any MediaCasters loaded by this applications -->
    			<Properties>
    			</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>ModuleMediaWriterFileMover</Name>
    				<Description>ModuleMediaWriterFileMover</Description>
    				<Class>com.wowza.wms.module.ModuleMediaWriterFileMover</Class>
    			</Module> 
    		</Modules>
    		<!-- Properties defined here will be added to the IApplication.getProperties() and IApplicationInstance.getProperties() collections -->
    		<Properties>
    			
    			<Property>
    				<Name>fileMoverDestinationPath</Name>
    				<Value>/var/www/video/</Value>
    				
    			</Property>
    			<Property>
    				<Name>fileMoverDeleteOriginal</Name>
    				<Value>true</Value>
    				<Type>Boolean</Type>
    			</Property>
    			<Property>
    				<Name>fileMoverVersionFile</Name>
    				<Value>false</Value>
    				<Type>Boolean</Type>
    			</Property>
    			 
    
    			<Property>
    				<Name>fileMoverFileExtension</Name>
    				<Value>mp4</Value>
    				<Type>String</Type>
    			</Property>
    
    		</Properties>
    	</Application>
    </Root>


    thanks!

  4. #4
    Join Date
    Sep 2011
    Posts
    1,933

    Default

    Hi,
    The ApplicationTimeout is the time it takes to shutdown the application when it is not doing anything (no clients connected and no custom code running etc..).
    The PingTimeout is how long the client can stay connected without being responsive, when not receiving data.

    How would I set it up to stop the stream after 1min?
    How would I set it up to stop the stream after 3Mb file size is reached?
    This is not possible by default with "live-record", but this could be achieved with custom code.
    Are you looking do disconnect the publishing client (an encoder), which will stop the stream being recorded, once the file being written by that client's stream reaches a set size?

    If you're looking to write this yourself you'll need the Wowza IDE2 to compile the custom code,
    Wowza IDE2

    If you require a consultant to assist you with this project, you can contact a a consultant through our Find a consultant forum
    We can provide a list of independent consultants if you would rather contact someone via email, this is available on request.
    If you would like to obtain the independent consultants list, please send an email to support@wowza.com with your request.

    Jason

  5. #5
    Join Date
    Aug 2012
    Posts
    18

    Default

    Quote Originally Posted by JasonH View Post
    Hi,
    Are you looking do disconnect the publishing client (an encoder), which will stop the stream being recorded, once the file being written by that client's stream reaches a set size?
    That's exactly what I'm after. The purpose for that is to prevent client to stream unlimited. For example, if someone decompiles the flash application and obtains the streaming url rtmp://myipaddress/live - he could easily stream whatever content to the server and that would be recorded. If I could manage to limit recording time or file size I would avoid this kind of situation.

    Maybe there is some other solution for this problem?

  6. #6
    Join Date
    Sep 2011
    Posts
    1,933

    Default

    Hi,
    I think you would benefit from setting a username and password for publishing to your server,
    Enable username password authentication

    You can have many username/password combinations and they are checked every time a user tries to publish to that application.
    You can also have multiple publish.password files on a per application basis if required.

    I assume that most clients will reconnect to the server if they are disconnected so I don't think the custom code approach for stopping the recordings will work.

    Jason

  7. #7
    Join Date
    Aug 2012
    Posts
    18

    Default

    Thats ok if they reconnect - I just dont want them to publish to the server 10GB at once

  8. #8
    Join Date
    May 2013
    Posts
    680

    Default

    I'd suggest programmatically controlling the recordings and then you can define within that the ability to stop recordings after x time has passed.

Similar Threads

  1. Control live-record by limiting duration of streaming video or limiting file size
    By fjckls in forum Wowza Streaming Engine functionality
    Replies: 4
    Last Post: 10-21-2013, 11:18 AM
  2. Limiting cupertinostreaming duration
    By thekendog in forum Live Streaming and Encoder Discussion
    Replies: 9
    Last Post: 01-24-2013, 12:41 PM

Posting Permissions

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