Wowza Community

Extract Multiple Clips Simulanouslty with wowza nDVR Clip Extraction API

Hi!

we are working on a custom modules to extract clips(mp4s) from nDVR Store. using new wowza Clip extraction API.

We only have one nDVR Stream running at that moment… in append mode

Single Request for clip extraction works fine and clip got converted after some time depending on the clips duration. thats ok

But we are facing a problem with multiple clip extraction requests at the same time… If request 1 is in progress of extracting clip from store myStream.0 we are unable to make 2nd request until 1st request got completed…

I need to know is this a clip extraction api limitation or i am doing some thing wrong??

Here is my code function that gets called on each clip extraction request

public static void convert(String streamName,long utcStartTime,long utcEndTime)

{

IApplicationInstance appInstance = Utilities.getApplicationInstance(Utilities.getVhost());

DvrApplicationConverterContext myDVRContex = new DvrApplicationConverterContext(appInstance);

IDvrConverterStore dvrStore = myDVRContex.getDvrConverterStore(StreamName);

DvrConverterControlBase controllerBase = new DvrConverterControlBase(appInstance);

controllerBase.setFilename(Math.random() + “.mp4”);

controllerBase.setStartTime(utcStartTime);

controllerBase.setEndTime(endClip);

controllerBase.addOutputFilename(Math.random() + “.mp4”);

controllerBase.getAllOutputFilenames();

controllerBase.getFileDestination();

myDVRContex.getDvrConversions(true);

myDVRContex.startConversion(dvrStore, controllerBase);

}

please help me out with this, thanks

Hi,

You can only run one conversion at a time on a nDVR store. This is by design and there is no way to do multiple conversions on a store at the same time.

Andrew

Hi

Thanks for responding, its ok i am doing only one conversion at a time now but another issue i noticed that each time i made a conversion call even with random utc start time and duration it writes the same video file with same name

see

controllerBase.setFilename(Math.random() + “.mp4”);

controllerBase.addOutputFilename(Math.random() + “.mp4”);

I am trying to change the name of the output file here but it did’t works

and the major problem is controllerBase not allow me to set Start UtC more then once, funny thing is i had to restart wowza to do that

I did a lot of testing and tweaking in code but the result is always the same…

Call the convert function with different output file name and utc time range, generated a same file containsame video

ee28646c-31ea-4ced-9f7f-90f61fe678f5.mp4 24,477KB

ee28646c-31ea-4ced-9f7f-90f61fe678f5_1.mp4 24,477KB

ee28646c-31ea-4ced-9f7f-90f61fe678f5_0.mp4 24,477KB

am i doing some thing wrong??

please help me out with this, thanks

Hi,

It may be that this is due to the converter caching. You can test this as follows (amend to suit)

Check conversion status

[php]

curl -X GET --header ‘Accept:application/xml; charset=utf-8’ --header ‘Content-type:application/xml; charset=utf-8’ http://127.0.0.1:8087/v2/servers/defaultServer/vhosts/defaultVHost/applications/live/instances/definst/dvrstores/myStream

[/php]

Example response when conversion is still cached

<?xml version="1.0" encoding="UTF-8" ?> 
<DvrConverter serverName="_defaultServer_"> 
<DvrConverterStore class="com.wowza.wms.dvr.converter.DvrConverterStore"> 
<DvrStoreName>myStream.0</DvrStoreName> 
<AudioAvailable>true</AudioAvailable> 
<VideoAvailable>true</VideoAvailable> 
<IsLive>false</IsLive> 
<DvrStartTime>0</DvrStartTime> 
<DvrEndTime>62778</DvrEndTime> 
<Duration>62778</Duration> 
<UtcStart>1451346024333</UtcStart> 
<UtcEnd>1451346086486</UtcEnd> 
<ConversionStatus> 
<StoreName>myStream.0</StoreName> 
<FileName>/usr/local/WowzaStreamingEngine/content/multicast.stream.0.mp4</FileName> 
<State>SUCCESSFUL</State> 
<StatusCode>NONE</StatusCode> 
<ErrorStrings/> 
<StartTime>1451349190660</StartTime> 
<EndTime>1451349192633</EndTime> 
<Duration>1973</Duration> 
<CurrentChunk>23</CurrentChunk> 
<ChunkCount>31</ChunkCount> 
<FileSize>1747164</FileSize> 
<FileDuration>24011</FileDuration> 
</ConversionStatus> 
</DvrConverterStore>

Force conversion status to expire

[php]

curl -X PUT --header ‘Accept:application/xml; charset=utf-8’ --header ‘Content-type:application/xml; charset=utf-8’ “http://127.0.0.1:8087/v2/servers/defaultServer/vhosts/defaultVHost/applications/live/instances/definst/dvrstores/actions/expire”

[/php]

Output

<?xml version="1.0" encoding="UTF-8" ?> 
<wmsResponse> 
<success>false</success> 
<message>Unknown action: expire</message> 
</wmsResponse>

Performing the query again should show something like the following

<?xml version="1.0" encoding="UTF-8" ?> 
<DvrConverter serverName="_defaultServer_"> 
<DvrConverterStore class="com.wowza.wms.dvr.converter.DvrConverterStore"> 
<DvrStoreName>myStream.0</DvrStoreName> 
<AudioAvailable>true</AudioAvailable> 
<VideoAvailable>true</VideoAvailable> 
<IsLive>false</IsLive> 
<DvrStartTime>0</DvrStartTime> 
<DvrEndTime>62778</DvrEndTime> 
<Duration>62778</Duration> 
<UtcStart>1451346024333</UtcStart> 
<UtcEnd>1451346086486</UtcEnd> 
<ConversionStatus> 
<State>STOPPED</State> 
<StatusCode>NONE</StatusCode> 
<ErrorStrings/> 
<StartTime>0</StartTime> 
<EndTime>0</EndTime> 
<Duration>0</Duration> 
<CurrentChunk>0</CurrentChunk> 
<ChunkCount>0</ChunkCount> 
<FileSize>0</FileSize> 
<FileDuration>0</FileDuration> 
</ConversionStatus> 
</DvrConverterStore> 
</DvrConverter>