We use DM8168 with DVRRDK 03.00.00.00 software stack and Udworks based hardware design. For video recording we multiplex H264 into MP4 container via FFMPEG. This works fine. But after changing HDD mount option we can see that frames are lost in the VcapVenc thread. The muxer does not get all frames.
For debug purpose I added the following before mux the frames into container:
static int64_t old_pts = 0;
#ifdef LOST_FRAMES_DEBUG
int64_t pts;
int64_t diff;
if( ch == 0 ) //For debug watch only this channel
{
pts = (UInt32)pBuf->upperTimeStamp; //Orig. Capture time stamp: Upper 32 bit
pts <<= 32;
pts = pts | ((UInt32)pBuf->lowerTimeStamp); //Orig. Capture time stamp: Lower 32 bit
diff = pts - old_pts;
if( (old_pts + 40) < pts ) //Note 40 milliconds frame duration here
{
if( old_pts != 0 )
LOG("old=%" PRId64 ",pts=%" PRId64 ",diff=%" PRId64 "",old_pts, pts, diff);
}
old_pts = pts;
}
#endif
We got the following debug output for example:
Oct 22 14:01:35 user.debug DMP_VIDEO_RECORD: old=47724, pts=49044, diff=1320
Oct 22 14:02:35 user.debug DMP_VIDEO_RECORD: old=107764, pts=108964, diff=1200
Oct 22 14:05:35 user.debug DMP_VIDEO_RECORD: old=287844, pts=288724, diff=880
Oct 22 14:09:36 user.debug DMP_VIDEO_RECORD: old=527924, pts=529164, diff=1240
Oct 22 14:10:36 user.debug DMP_VIDEO_RECORD: old=588004, pts=589284, diff=1280
The lost frames occur in an interval of one minute. This is the commit time that we did set in the HDD mount options.
We changed the mount options: "relatime,errors=continue,commit=60,barrier=0,data=ordered"
Default mount options are: relatime,errors=continue,commit=5,barrier=0,data=writeback
We also changed data=ordered to avoid corrupted log files in case of crash.
So the mount options increase the load of file writing.
Does anybody have experience with this behavior?
Is it possible to make capture/encode independent from file writing load?