I am using Live555/openRTSP based code to stream an H.264 video source to an mp4 file, and would like to concurrently read the earlier parts of the file (from a different application). Changing the fopen
to be fid = _fsopen(fileName, "wb", _SH_DENYWR)
(from OutputFile.cpp) clearly isn't enough, because it makes no difference and the media players still won't open it (is that the write line for the mp4 output?)
On a related note if I simulate an unclean shutdown of the software (e.g. power failure) the unfinished files are not readable by any media players. I assume that what is written to the file on file-close is what allows a media player to understand the file. This is also a situation I'd like to code for, if possible, and is quite likely the really the same problem as above?
Any pointers/answers/thoughts greatly received :-)
In case anybody ever needs the same, this is how I did it, and it was easier than I imagined:
fopen
in OutputFile.cpp to the file-sharing call _fsopen
(share read access)QuickTimeFileSink::continuePlaying()
function I call completeOutputFile()
, thus keeping the header up to date (with video length, etc).Windows Media Player didn't like it (probably tried to get exclusive file access), but VLC was quite happy to read the file whilst I was still streaming into it.