CESNET / UltraGrid

UltraGrid low-latency audio and video network transmission system
http://www.ultragrid.cz
Other
485 stars 55 forks source link

[DeckLink] clicking in audio with 24 FPS in sync mode #345

Closed MartinPulec closed 8 months ago

MartinPulec commented 9 months ago

Originally posted by @alatteri in https://github.com/CESNET/UltraGrid/issues/326#issuecomment-1757020332

Clicks in audio are present if using audio compression with 24 FPS. Steps to reproduce:

ffmpeg -f lavfi -i sine=r=48000:d=30 -f lavfi -i testsrc=duration=30:r=24:size=1920x1080 tst24.mp4
uv -d decklink:sync -r embedded -t file:tst24.mp4 -s embedded --param incompatible -A AAC

Occurs also with OPUS. Doesn't occur if anything of following holds:

  1. synchronized mode is not use
  2. PCM (uncompressed) audio is used
  3. 25 FPS is used (other frame rates not tested)
MartinPulec commented 9 months ago

reproducible also simply with -t testcard:mode=Hp24 -s embedded

alatteri commented 9 months ago

Thanks for looking into this. Do you think it is fixable? Having to send un-compressed PCM with sync mode is not ideal, but it is better than un-syncronized V/A.

MartinPulec commented 8 months ago

Well, I've slightly ill-designed the new audio compression code while perhaps too much complicating it. I've just simplified it by properly time-stamping the compressed audio.

It is already pushed it but not much tested – just the simple use-cases, where it seem to work. Hopefully I'll get to some more testing in following days.

MartinPulec commented 8 months ago

Forgot to say – --param incompatible is no longer needed, neither recognized. I'll update wiki accordingly tomorrow.

MartinPulec commented 8 months ago

I've just fixed a small bug (8e8c1f33) that sometimes triggered incorrect behavior (on incommensurable codec and input frame sizes and when audio BPS doesn't much compression, which 4 for AAC, so eg. testcard's 2).

alatteri commented 8 months ago

I believe this is now fixed in latest continuous. Tested with both AAC and OPUS.

Thank you.