With this feature, you can preview or even play out a media file while it is still being written to by another process. Playback while recording is available in both MFormats SDK and MPlatform SDK.
Playing while recording is good for:
- Checking the quality of the output file (you can do it at any time during the recording process).
- Making sure a sudden interruption of recording (such as due to power loss or computer breakdown) does not make the recorded file unreadable.
- An alternative way of implementing time-shifting.
The main idea is simple: you start capturing to file and you are able to play this file with any application that is based on MPlatform SDK or MFormats SDK.
Playback while recording in MFormats SDK
To enable/disable this feature you can set the "play_while_rec" property for the MFWriter object:
myWriter.PropsSet("play_while_rec","false");
Or enabled/disabled it directly in the capturing configuration of MFWriter object:
myWriter.WriterSet("FileName", 0, "format='mp4' play_while_rec='true' video::codec='mpeg4' video::b='5M' audio::codec='aac'");
Or in system registry:
HKEY_CURRENT_USER\Software\Medialooks\MFormats\MFWriter
play_while_rec = true/false
Playback while recording in MPlatform SDK
Playback while recording is available in MPlatform SDK in combination with Encoder Lib and Decoder Lib add-ons.
To enable/disable this feature you should set the "play_while_rec" property for the MWriter object:
myWriter.PropsSet("play_while_rec", "true");
Or set in the writer config string:
myWriter.WriterNameSet("FileName", "format='mp4' play_while_rec='true' video::codec='mpeg4' video::b='5M' audio::codec='aac'");
Or set it in the system registry:
HKEY_CURRENT_USER\Software\Medialooks\MPlatform\MWriter
play_while_rec = true/false
Recording recovery
If the recording application fails, the IDX and HDR files created along with the captured video are still available for playback with the SDK, so you can restore the captured files by using a "direct-copy" feature. The IDX and HDR files persist if you open the captured video multiple times, so you can complete the recovery any time later.
There is a specific case then the failure happens not with an application (the recording process is destroyed), but with the whole system (blackout, for instance). To make the files accessible for recovery, you should enable the following property:
HKEY_CURRENT_USER\Software\Medialooks\MPlatform\MWriter
play_while_rec.flush_idx= true
HKEY_CURRENT_USER\Software\Medialooks\MFormats\MFWriter
play_while_rec.flush_idx= true
Or set the property for the MWriter/MFWriter object.
This mode slows down the play-while-recording feature because of the flush of the IDX file operation, but if the goal is to keep the recorded content available for recovery, enable the mode.