none
How to diagnostic this issue: frame missed

    Question

  • I've built a graph to do some encoding. The graph looks like:

    Source Filter -> Some Necessary Filters -> My Encoding Filter -> File Writer

    During long time testing ( more than 3 days ), I found some of the Audio/Video input frames missed. That is,

    Frame Rate = 25 fps, that means each frame would have (end_time - start_time) = 400,000 ref time (100 nano-sec) or start_time_N+1_frame - start_time_N_frame = 400,000 ref time (100 nano-sec). But after 3 days running, I found there emerged randomly that start_time_N+1_frame - start_time_N_frame = 800,000 ref time. I confirmed that there does 1 frame miss for this case. So after long time writing, the frames written into file is less than expected.

    What should I do next to diagnostic this issue?

    p.s.1 the start time for each frame in Receive() was written into a file for diagnostic.

    p.s.2 In this graph, only My Encoding Filter written by me myself, others are commercialized 3rd filters.

    p.s.3 The source filter is working on receiving A/V from a satellite antenna.

    Thanks!
    Thursday, July 16, 2009 1:51 AM

Answers

  • Mixing SDI and analog audio is more than likely going to go out of sync eventually because there is no common source clock.  It would be better if you could use the SDI audio.

    If it seems as though things out of sync abruptly then there is likely some event that is triggering it.  If things simply go out of sync slowly until they are no longer acceptable then you will need to do custom rate control on the audio stream by dropping/adding samples to make it match the video stream rate.


    www.chrisnet.net
    • Marked as answer by Qingdong Friday, June 04, 2010 7:51 AM
    Friday, July 17, 2009 2:54 AM

All replies

  • Two possibilities :
    1) your source filter is not sending the missing frames
    2) the frame is discarded by some filter in the graph
    Do you log and check graph events?
    What is your CPU load?
    In my experience, some spurrious events (e.g. opening files, launching apps) may cause CPU spikes which in turn cause some filters to drop or delay processing frames (which in turn may cause other filters to drop the late frames...).
    Michel Roujansky, http://www.roujansky.com
    Thursday, July 16, 2009 9:08 AM
    Moderator
  • Thanks for your kind reply.

    Currently I listened to EC_COMPLETE, EC_USERABORT and EC_ERRORABORT. But none of these events was hit.

    The frame missing problem is very significant: within the first 3 days, everything works fine, after 3 days, within about 5,500,000 ~ 8,000,000 frames, it is about 10,000 seconds of video data discarded (frame rate is 25 fps).

    Would you please give me some suggestion that which event should I listen to?

    I have not monitored CPU. But it looks cpu load is normal, does not fluctuant too much during my program running.

    By analyzing my log file, the whole running time is: 337127.843750 seconds, while video frames are 8184480 frames which can be calculated to 327379.1875 seconds, audio frames are 7955713 frames which can be calculated to 318228.53125 seconds.

    Audio data is too much less than video though video data missed much too.
    Thursday, July 16, 2009 1:11 PM
  • It's a fairly common problem with any kind of recording that long term sync between audio and video data may not be preserved.  It is especially problematic with digital sources such as satellite and QAM cable as there may be frequent format changes that require resynchronization or momentary loss of reception. 

    Is your source digital, i.e. you're receiving an MPEG-2 / MPEG-4 / H.264 stream?
    Does the stream contain format changes, switches in program streams etc?
    Is the transport stream time linear?

    www.chrisnet.net
    Thursday, July 16, 2009 9:20 PM
  • The incoming source is SDI. We are using a hardware interface - Decklink SDI which connected to a satellite antenna. So the incoming signal should be uncompressed digital a/v stream. We tried to use embedded audio in SDI signal but we failed. So now we are using SDI only for video and analog input for audio.

    While I found a/v out-of-sync and frames missing, I stopped the program and re-start it. The recorder can work well synchronized with no frame dropped and .

    So I guess it is not because of incoming source, but the source filter seems not able to running too long time. I just want to know if there are some tools or stream paramters that can be checked to confirm my guess.

    p.s. I just simply used the graph sys clock.

    What should I do next? Thanks.
    Friday, July 17, 2009 2:15 AM
  • Mixing SDI and analog audio is more than likely going to go out of sync eventually because there is no common source clock.  It would be better if you could use the SDI audio.

    If it seems as though things out of sync abruptly then there is likely some event that is triggering it.  If things simply go out of sync slowly until they are no longer acceptable then you will need to do custom rate control on the audio stream by dropping/adding samples to make it match the video stream rate.


    www.chrisnet.net
    • Marked as answer by Qingdong Friday, June 04, 2010 7:51 AM
    Friday, July 17, 2009 2:54 AM
  • Great, would you please give me some suggestion which events can be listened to or detected?

    I also thought of programlly adding samples for a/v streams. But it could be unacceptable because the stream quality might be compromised. So I am afraid I have to schedule the program re-starting automatically. The only side-effect is the live broadcast and recording would have to be interrupted for a few seconds.
    Saturday, July 18, 2009 8:52 AM
  • For analog capture we add or remove frames to keep it synchronized with the audio stream, although it will be less perceptible if you add or remove individual audio samples in small amounts to keep it synchronized with the video stream.
    www.chrisnet.net
    Monday, July 20, 2009 1:20 PM