I'm trying to play a MP4-Stream. The stream is send from my android phone. The problem is, that the moov atom, which is needed to play the mp4, is only written if the phone is done with the recording progress. So at the moment I'm only to play the streamed data, after the recording has finished. My idea was to write the ftyp and moov atom by myself, so that the streamed data can be played, while the phone is recording. I tried to use the moov atom from another videofile but this didn't work. I also have read, that normally it's impossible to build a moov atom, if only the mdat atom is given. But in my case I know the recording conditions, like framerate, etc..
So my question is, is it possible to generate a valid/useable moov atom for the incoming stream if I know the recording parameters?
It's possible. I've done it 4 years ago to implement "live streaming" to original iPhone. Just fill STSZ and STCO atoms with constant size frames, then pad each frame with zeros. Yeah, size will be huge, but you'll get real live streaming :-)
It seems to be rather impossible to stream not yet finished mp4 file because player would need special tables with chunks and offsets to locate every data sample. You can fake FTYP, MOOV and other atoms, but you can't generate all tables without having file complete. Better strategy would be to generate many short mp4 files and send them file by file...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With