With MDelay feature, you can make time shifting (a delay) for the required period for any sources.
It means that you can obtain video and audio with a delay between preview and real time. For example, you can see on a preview panel an event from live sources that have already happened earlier. Or start to download a network stream into a buffer and then playback it. You can use it for any source objects in MPlatform SDK - MFile, MLive, MMixer, MPlaylist, and for any frames in MFormats SDK.
Main features of MDelay
Delaying the stream for a precise number of frames
Specify the desired delay and be sure that it is frame accurate at any moment.
Check the mdelay.time property description for details.
Adjustable compression quality
Set desired compression quality to get the balance between picture quality and CPU utilization with internal MJPEG encoder or uncompressed for a lossless result.
Check the mdelay.quality property description for details.
Possibility to use HDD or RAM to store of the delay buffer
Use RAM for fast access to the buffer or capture to HDD for a long period buffering.
Check the mdelay.buffer_duration property description for details.
Changing the video format on the fly
You can change the format of your live stream at any moment without having to reinitialize delay.
Possibility to append video to the existing delay buffer
Use a single buffer for the whole session and make cuts on the fly by stopping the delay process.
Check the mdelay.reset_on_open and mdelay.delete_on_close properties description for details.
Possibility to playback video from the delay buffer
Playback your buffer during the delay process, or after it's finalization and extract data whenever you need it. Just paly the *.sbe file like any other video file using MFile or MPlaylsit objects.
Check the mdelay.buffer_path property description for details.
|mdelay.enabled||false||Indicates whether MDelay feature is enabled or disabled.
Dynamically changed value.
If you turn MDelay off then all buffer is flushed. It means that if you need to show video in real-time and then again with delay - you should set 0 to delay time.
If a duration is greater than in buffer then the first frame will be shown until the delay time is not over.
If the delay is 0 then you get real-time output.
|mdelay.quality||80||Quality of video.
Maximal value is 100, minimal is 1.
If quality is 0 then you get uncompressed video. Dynamically changed value.
The better the quality the more CPU and hard disk are used. If the video is uncompressed then CPU usage is minimal but hard disc should be fast and has enough free space(we recommend SSD for HD video).
|mdelay.live_preview||false||If you use MDelay feature for any object, the output of this object is delayed. To see real preview (without delay) you should add MPreview object and set this property to "true" for your source (not MPreview) object.|
|mdelay.split_progressive||true||This property is used for encoding optimization for progressive video (720p, 1080p).
|mdelay.buffer_path||C:\MDelay\Live.sbe||A path to the buffer file.
Please note that you can playback this file using just like any other file to extract the buffered data.
In a case of capturing to HDD, the file will contain the full-size delay stream data.
In a case of capture to RAM, it will have a 0 size but still can be played like any other file to extract the buffered data from RAM.
|mdelay.buffer_duration||3600||Maximal time for buffering (in seconds).
The more time then the more free space is required for buffering. It is possible to set 0 - in this case memory buffer will be used. Get-only property.
|mdelay.buffer_size_mem||100M||Memory buffer size.|
|mdelay.reset_on_open||true||Reset the buffer on delay process start flag.
|mdelay.delete_on_close||false||Erase the delay buffer at the end of delay process flag.
|mdelay.static_deinterlace||true||Displays only one field of a static frame (e.g. a buffer is smaller than a position).|
|mdelay.static_mute||true||Mutes a static frame (e.g. a buffer is smaller than a position).|
|mdelay.sync_time||120||Sets a time interval to force synchronization of delayed video|
All these parameters you can change with the PropsSet method or in the system registry:
MDelay with MPlatform SDK
You should enable MDelay with PropsSet method like:
(mySource as IMProps).PropsSet("object::mdelay.enabled", "true");
The same approach is used to configure any MDelay-related properties. For example, to specify delay duration to 10 seconds you should call:
(mySource as IMProps).PropsSet("object::mdelay.time", "10");
Note please that you can use any source object (MFile, MLive, MMixer or MPlaylist) to make a delay. Receiver objects (MPreview, MRenderer or MWriter) do not support MDelay feature because they receive frames from source objects.
MDelay with MFormats SDK
You should create an instance of MDelay object
MDelayClass myDelayPlugin = new MDelayClass();
Then configure parameters of delaying with the PropsSet method for the myDelayPlugin object. Note please that in MFormats SDK you don't need to specify mdelay.enabled property for your source object because you work with the plugin separately and there is no dependency on where the frames are from.
For example, to set a duration of delay to 10 seconds you should call:
When the object is configured you can use it to make a delay:
int framesRest; MFFrame modifiedFrame; ((IMFProcess)myDelayPlugin).ProcessFrame(sourceFrame, out modifiedFrame, out framesRest, "");
Then you can use the modified frame according to your requirements. For example, show it on preview:
((IMFReceiver)myPreview).ReceiverFramePut(modifiedFrame, -1, "");
VANC Timecode delay
To delay a timecode for devices you should make several settings:
- For MLive or MFLive object:
set "vanc.capture" property to "1" with PropsSet method;
set required lines with "vanc.lines" property (for example, vanc.lines=20, 21). If this property is empty or "all" then all lines are copied.
- For MRenderer or MFRenderer object:
set output.10bit = true
If it is required you can enable to copy VANC data from frame or disable it:
output.copy_vanc = 0 - don't use
output.copy_vanc = 1 - copy VANC first then add CC
output.copy_vanc = 2 - add CC first and then copy VANC