Hi,<br><br>i am using your openRTSP software to get a stream from an
axis m1031 devices. The openRTSP gets the H.264 video and i can create
the mp4 file with the -4 option. <br>Everything is working good, but
i have an issue when i need to play those videos in the JW flash player
or flowplayer. I saw that the time shift functionality was not working
with the openRTSP mp4 files.<br>
After doing some research and hours of work (i'm not an mp4 expert) i found that openRTSP do
not create the "sync sample" metadata, so that was the cause that the
time shift functionality was not working with flash players.<br><br>Based on the documentation, the "sync sample" metadata is optional, so i think openRTSP is ok.<br>
<br>But the solution i have found is to change the QuickTimeFileSink.cpp file to support the sync sample atom.<br><br>I
added the addAtom(stss) function (code below) based on the
Time-To-Sample atom, and the new openRTSP videos start to work good.<br>
<br>Could you add the sync sample metadata to your software as an
option? So, i could use a solution based on mp4 expert developers.<br><br>Thanks in advance.<br>Gerardo.<br><br>The code...could have some bugs but it is working...<br>
<br>addAtom(stss); // Sync-Sample<br> size += addWord(0x00000000); // Version+flags<br><br> // First, add a dummy "Number of entries" field<br> // (and remember its position). We'll fill this field in later:<br>
unsigned numEntriesPosition = ftell(fOutFid);<br> size += addWord(0); // dummy for "Number of entries"<br><br> // Then, run through the chunk descriptors, and enter the entries<br> // in this (compressed) Time-to-Sample table:<br>
unsigned numEntries = 0, numSamplesSoFar = 0;<br> unsigned prevSampleDuration = 0;<br> unsigned i;<br> unsigned const samplesPerFrame = fCurrentIOState-><div id=":y7" class="ii gt">fQTSamplesPerFrame;<br> ChunkDescriptor* chunk = fCurrentIOState->fHeadChunk;<br>
while (chunk != NULL) {<br> unsigned const numSamples = chunk->fNumFrames*samplesPerFrame;<br> numSamplesSoFar += numSamples;<br> chunk = chunk->fNextChunk;<br> }<br><br> // Then, write out the last entry:<br>
for (i = 0; i < numSamplesSoFar; i+=12) {<br> size += addWord(i + 1);<br> ++numEntries;<br> }<br> if (i != (numSamplesSoFar - 1)) {<br> size += addWord(numSamplesSoFar);<br> ++numEntries;<br> }<br>
// Now go back and fill in the "Number of entries" field:<br> setWord(numEntriesPosition, numEntries);<br>addAtomEnd;<br><br>ps:
the magic 12 i got it from ffmpeg command. When i was doing some
research i used the ffmpeg command to transcode the openRTSP mp4 file to
a new one with the libx264 enconder. I saw that ffmpeg put the following sync samples: 1, 13, 25, 37...so i use the same.<br></div>