Skip to main content
Participant
December 28, 2009
Question

Truncating the DVR files

  • December 28, 2009
  • 1 reply
  • 423 views

I am working on an application that uses the new DVR capability of the Flash Media Interactive Server 3.5. My problem is that I cannot see any easy way to restrict the length/size of the recorded file without stopping the recording/publishing on the client side (this happens if one uses maxDuration or maxSize in Stream.record()). I am using the DVR functionality of the Flash Media Live Encoder 3 for recording/publishing.

My understanding is that to limit the size of the recorded file I need to somehow 1) stop the recording on the server side, 2) truncate the recorded file on the server side and 3) start appending the newly established recording to the truncated file. Consequently, I am wondering if it is possible to truncate the recorded files?

The basic idea with my application is that I am using Flash Media Live Encoder 3 for 24/7 style streaming of video with DVR capability. However, I need to be able to display only 5-10 hours from "now" to the past. Obviously, limiting the length of the recording is necessary for keeping the file sizes manageable.

Any help would be greatly appreciated. Thanks!

    This topic has been closed for replies.

    1 reply

    December 28, 2009

    Hi,

    As you are using Flash Media Live Encoder as a publisher you could restrict the recorded file's length or size in the following manner.

    Have the below code in the server side application you are connecting to and simply publish using Flash Media Server and do not use the record option there. Recording here is controlled by the Stream.record( ) api here.

    application.onConnect=function(clientObj){

        return true;

    };

    application.onPublish = function(clientObj,streamObj){

      trace("in application publish");

      streamObj.record("record",3600,-1); //Limiting Recorded file's length to 1 hr. Similarly the recorded file's size could also be limited.

    }

    application.onUnpublish = function(clientObj,streamObj){

       streamObj.record(false);

        trace("on unpublish");

    }

    So the publishing could keep continuing but once the recorded file length reaches 1 hr in length the recording would stop. You would receive "NetStream.Record.DiskQuotaExceeded" followed by "NetStream.Record.Stop" in the Encoding log of Flash Media Live Encoder. Do let me know if this worked for you.

    Thanks

    Mamata

    Participant
    December 28, 2009

    Thanks for your prompt post Mamata!

    So let me check if I understand correctly what you are saying. You say that "do not use the record option there". Do you mean that I should not use recording/DVR option in Flash Media Live Encoder? If I do use the DVR option, your server-side code would indeed send "NetStream.Record.DiskQuotaExceeded" followed by "NetStream.Record.Stop" and the recording stops. This is what I want to prevent from happening.

    Thanks,

    Antti

    December 28, 2009

    Hi,

    I just gave you a simple app to check the working of Stream.record( ) API to control the size/length of the recordings as you mentioned that didn't seem to work for you.

    You could also use Flash Media Live Encoder's 'Record' option but you must pair it with the DVRCast application for FMS which is available at https://www.adobe.com/cfusion/entitlement/index.cfm?e=fms35 .

    Thanks

    Mamata