Wrong duration metadata on flv files

Hello,

We have random cases during a stream recording where the duration written to the file in the metadata is incorrect. This only happens in about 10% of cases, but it causes playback issues because the duration property is incorrect.

We usually have a series of subsequent recordings during the same NetConnection, and it only happens on the first stream. Any ideas on why this could be happening?

Thanks in advance!

The new recording is probably trying to append before the old recording has finished writing to the file.

Make sure you call netstream.publish(null) before you close the stream. If you start publishing again too quickly without unpublishing the old stream first then the recording may get corrupted.

You really should call publish(null) and then listen for the NetStream.UnPublish.Success NetStatus event before closing to old stream and starting a new one.

Thanks for the quick reply! Would this hold true even if the subsequent files are not appending, but writing to a different filename?

I have seen the odd occasions where the publish events for the new stream on the server do occur before the unpublish events for the old stream which will possibly cause corruption as the camera is not getting disconnected cleanly from the old stream. With local testing, it is not a problem but when any latency is involved then it does become a problem.

It shouldn’t be an issue in that case.

Richard

Thanks for the quick reply! Would this hold true even if the subsequent files are not appending, but writing to a different filename?