Wowza Community

How to define a custom m4v file Reader


Im trying to stream my m4v files with Wowza.

My problem is that my files on disk are encrypted and I need to write my own custom M4V File Reader to add my decryption stack on the file reading.

What I want to do is exactly the same I’ve already done with the nDVR and dvrChunkReaderClass.

Is it possible with standard m4v file streaming on Wowza ?

Nicolas Castillejos

Hi Nicolas,

You may be able to use a custom IRandomAccessReader, which is the Wowza software’s abstraction for the file system. This would depend on how your file system is encrypted, though.

If it’s a general file encryption and not MP4-specific, then it would only work if the data sizes do not change or you have a method of keeping track of any data offsets. The MediaReader reads the packet offsets from the moov atom and then calls the read method with these offsets each time it requires a piece of data. If the information in the moov atom doesn’t match the actual data positions on disk then it would fail.

If it is some form of MP4-specific encryption, then the data in the moov atom may already adjust for this. However, the MediaReader is going to expect back the same number of bytes it requests each time, so if the decryption changes the size of the data then it could cause problems.