Live TV Audio/Video Sync (1 Viewer)

hoborg

Portal Pro
June 13, 2008
4,413
1,644
Nový Jičín
Home Country
Czech Republic Czech Republic
@mm1352000:

The FFDshow video decoder should be used only for MPEG-2 streams, not H264.
And if you set FFDshow to output MPEG-2 in NV12, you will have HW deinterlacing.
 

Owlsroost

Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,539
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    mm1352000:

    With MPEG-2 video, the FFDshow A/V sync issues pretty much 100% reproduceable for me - at present I don't have any H.264 live TV content to test with.

    The MPEG-2 and H.264 demuxing are handled separately in TsReader (and in FFDshow of course), so it's possible that H.264 is OK anyway....

    EDIT: there seems to be a reasonable selection of test files on MP FTP, so I'll try some of the H.264 .ts samples, but a corrupted H.264 sample file - to test the syncing after stream discontinuities - would be really useful if you have one kicking around :) (otherwise I could probably create one by chopping sections out of a good file with a binary file editor)

    BTW, you can have HW deinterlacing with FFDShow - see the attached jpeg (and disable the internal deinterlacing).

    Tony
     

    Attachments

    • FFDShow_NV12.jpg
      FFDShow_NV12.jpg
      90.1 KB

    Spooky

    MP Donator
  • Premium Supporter
  • February 14, 2005
    1,187
    47
    void 4tl
    Home Country
    Austria Austria
    Hi everyone

    I have to say that I don't generally use FFDShow because I find the picture quality of the Cyberlink 10 decoder to be *a lot* better (maybe due to the VA deinterlacing of the video card in comparison to the software deinterlacing done by FFDShow).

    When using ffdshow from SAF, deinterlacing is also done by the hardware.

    // woops, I kept this tab open for too long ;)
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,544
    8,236
    Home Country
    New Zealand New Zealand
    Hi again everyone

    Hmmm, the NV12 option doesn't do as I expected - I don't notice any difference when I enable it. Cyberlink produces output at 50 fps (according to shift+1) whereas FFDShow produces 25 fps. Since this is interlaced content with 50 fields per second I thought that the 25 fps indicated FFDShow was doing the deinterlacing. Am I wrong?

    I can reproduce the sync issues with MPEG 2 content when the FFDShow is producing 25 fps output, however when I use YADIF deinterlacing and use the double frame rate option the sync problems go away. I'm left wondering whether the issue is something to do with "frame rate compensation" (sorry, I don't know if that is the right term)...

    mm

    [Edit: okay, I think I've got hardware deinterlacing working. I disabled the deinterlacing section in FFDShow, and unticked all the output colour spaces except NV12. Now shift+1 tells me the output is 50 fps. There are sync problems with NV12 50 fps...]
     

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,539
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    [Edit: okay, I think I've got hardware deinterlacing working. I disabled the deinterlacing section in FFDShow, and unticked all the output colour spaces except NV12. Now shift+1 tells me the output is 50 fps. There are sync problems with NV12 50 fps...]

    Good :) - so does it happen with H.264 too ?

    Tony
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,544
    8,236
    Home Country
    New Zealand New Zealand
    Good :) - so does it happen with H.264 too ?

    Not so far as I can tell, so in other words the issue seems to be isolated to MPEG 2. Note that I'm using libavcodec for both MPEG and h.264/AVC but libmpeg2 doesn't seem to make any difference. With h.264, there seems to be a period of slow motion playback (frame drops?) when I first change to the channel. After a second or so the frame rates stabilise and the audio is in sync. There are no frame drops for MPEG 2...
     

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,539
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    Good :) - so does it happen with H.264 too ?

    Not so far as I can tell, so in other words the issue seems to be isolated to MPEG 2. Note that I'm using libavcodec for both MPEG and h.264/AVC but libmpeg2 doesn't seem to make any difference. With h.264, there seems to be a period of slow motion playback (frame drops?) when I first change to the channel. After a second or so the frame rates stabilise and the audio is in sync. There are no frame drops for MPEG 2...

    Assuming you are testing with the standard TsReader.ax, the slo-mo at the start is probably TsReader modifying the sample timestamps to minimise the visual impact of pulling the video into sync. It's this technique that FFDShow video decoder doesn't like (with MPEG2) because it doesn't track the sample timestamps continuously (as far as I can tell from the code & behaviour).

    Also TsReader wasn't passing the PES header discontinuity data through to the decode filter in MPEG2 mode (but it was for H.264) - these are the "Video Continuity error..." entries in the log - which also caused FFDShow to go out of sync.

    Tony
     

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,539
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    Attached is a new version of TsReader.ax with (probably) a better implementation of the fix, plus it's now only applied if FFDShow video decoder is in use.

    Patch file for source code also attached.

    Tony
     

    Attachments

    • TsReader_FFDShow_fix_4.zip
      155.7 KB
    • TsReader_FFDShow_fix_4.patch
      12.2 KB

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,539
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    Updated (and hopefully final) version of the modified TsReader is attached to this post. This has a new mod to try and fix an occasional failure to re-sync after stream corruptions (only for MPEG2 video).

    Tony
     

    Users who are viewing this thread

    Top Bottom