Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Read and write from/to MP4Stream

emayor
Beginner
338 Views
Hi there,
I am using IPP and UMC to store an Mpeg4 Video track into a disk file.In order to store huge video files, the stream is split into several (fixed-size) chunks. This is working fine using theFLAG_START_WITH_HEADER flag. Now, I'd like to be able to read these chunks as they get written onto the disk. However, every file is only persisted when the MP4Muxer is closed (by using the Close() method).
I have tried using theFLAG_FRAGMENTED_AT_I_PICTURES flag as suggested by the MP4Muxer usage sample in the docs but the header seems to be overwritten everytime an I frame is passed to the muxer. This means that the files are 50 MB in size but the header startes the video duration is only 4 secs (exactly the time between I frames).
My questions are:
1.- Is there a simple way to access an MP4Stream as it is written to the disk? I understand some data in the header might change on the fly.
2.- Does it make sense to store an MP4Stream in a file using the FLAG_FRAGMENTED_AT_I_PICTURESflag? If so, how can I access the all the fragments in the file?
Any ideas would be appreciated.
Thanks in advance,
Emayor
0 Kudos
1 Reply
Sergey_O_Intel1
Employee
338 Views
Hi,

Any MP4 stream has a header to keep an index of all data inside. If the index is absent you can't read data. The header can be placed either at the beggining of the file or at the end. The former is good for reading but takes more time during multiplexing because the whole stream is kept in tmp file first and is finally copied in Muxer Close. The latter is default way.
Fragmented MP4 files can be used for networking to start the playback on the other side as soon as possible.They consist of independentfragments with their ownindexes.But you should have Splitter that can read such streams. Really I don't know any one except for IPP MP4 SPlitter.

One more point here. If you start write and read your stream simultaneously you'll probably have to improve DataReader and DataWriter so that they don't return EOF but wait for more data for some time.

-Sergey
0 Kudos
Reply