2.5 File.ISO

2.5.1 Features

There are several unique features VASTreaming MP4 reader/writer can support. They are unavailable in other libraries.

So, unique features of VASTreaming library are:

Write media data in the end of the file & fail recovery. VASTreaming library allows writing media data in mp4 file, appending it to the end of the file. It is noteworthy that a file metadata is written into the beginning of a file and being updated while writing. Therefore, upon the end of writing, a file can be immediately used for progressive downloading. But the most important is that such way of writing provides a user with additional failure protection. Since we are updating the data regularly while writing, even if an app using VASTreaming library crashes, a file remains readable/playable by any media player, and only several second of the written data can be lost in the worst case, opposed to an ordinary mp4 writer which usually writes metadata only when writing process ends, what makes a file unreadable in case of a failure. As an interesting side effect, there is a possibility of opening/playing a file by a media player while writing is still in progress.

NTP timestamp. VASTreaming library allows user to save the beginning of record in a file as a NTP timestamp, so absolute time of every frame with the accuracy of tens of milliseconds is available for further usage. It can be used for synchronization of different files and this kind of things. MP4 file does contain default creation and modification times in a header but those times are rounded to second and usually represent local time of a recording device with unknown precision.

Caching. VASTreaming library allows reading and caching file metadata (including all file headers, sample indices, etc.) in memory so that while reopening, a file is opened instantly, without reading and analyzing of a file metadata from disk. This function can be useful for accessing VOD files when opening every new copy of a VOD file does not require significant additional resources.

Update file on the fly. As an extension of the previous function of caching file metadata, a file reader can read and update source file data. This reader mode is called monitor. If a source file is in writing process i.e., it grows in length and size, so we can simultaneously perform writing into a file and using of the same file as a VOD source. Reader in the monitor mode propagates updated metadata of a file to all dependent readers on a regular basis.

Figure 7. Caching and updating diagram.

2.5.2 Classes

IsoSink - an object implementing IMediaSink interface. It can be used for writing an mp4 file. Creating IsoSink, we can set parameters described in ParsingParameters in order to activate extended features.

IsoSource - an object inherited from IInteractiveMediaSource. It allows reading data from an mp4 file. Real-time reading is supported, when we need to read at the same speed as the file playback and also at the highest possible speed. While creating IsoSource, we can set additional extended parameters through ParsingParameters.

ParsingParameters contains different extended settings for reading and writing mp4 files:

  • WriteMediaDataLast. This parameter enables mode "Write media data in the end of the file & fail recovery". By default this mode is disabled.
  • ExpectedFileDuration. This parameter is needed if WriteMediaDataLast is true. It defines how much space will be allocated for metadata. By default, the allocated space is enough for 1 hour record. If user expects a longer recording time, it should be set accordingly. If the allocated space is not enough, the writing switches into the normal mode, without the fail-safe mode.

contact us