CESNET / UltraGrid

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

Audio Buffer Overflow / Underflow Decklink AV1 / MP3 #313

Closed sogorman closed 1 year ago

sogorman commented 1 year ago

Good afternoon. I am getting started with UltraGrid and running into an audio buffer issue. I have seen some audio issues in various threads but can't seem to get this figured out.

The test setup is using a M2 MacBook pro with a test card and 1k tone encoded with AV1 and MP3 audio. Both the audio and video have FEC.

The receiving end is a windows pc with a Decklink Mini Monitor. Both the sending and receiving side look good resource wise.

Sending command:

/Applications/uv-qt.app/Contents/MacOS/uv -t testcard:1920:1080:30:RGB -c libavcodec:codec=AV1:bitrate=1.5M:disable_intra_refresh:subsampling=422 --audio-filter controlport_stats -s testcard --audio-capture-format channels=2 --audio-codec MP3:bitrate=256k -f V:rs:200:240 -f A:mult:2 -m 1300 -P 5020 --control-port 5021 10.200.200.102 --param errors-fatal

Recieving Command: c:\UltraGrid\uv.exe -d decklink:device=0:drift_fix --audio-filter controlport_stats -r embedded -P 5020 --control-port 5021 --param errors-fatal

Here is a screenshot of the sending computer showing no errors:

Screenshot 2023-05-11 at 7 44 13 PM

Here is a screenshot of the recieving computer showing audio errors:

Screenshot 2023-05-11 at 7 43 26 PM
alatteri commented 1 year ago

1) what is the --audio-filter for? Doesn't seem like it actually is doing anything without adding the additional relevant parameters. 2) Are you sure the receiving CPU is not being tapped out. AV1 is a hard codec. 3) I wonder if soxr or speex are not available on Windows, so even though drift-fix is called, maybe its not actually happening? I've never run UG on Windows so I don't know its packaging.

sogorman commented 1 year ago

Tried removing the --audio-filter, no change.

Here is a screenshot of taskman on the receiver side, looks like the AV1 is being handed off to the GPU, system is basically idling.

Screenshot 2023-05-12 at 5 51 50 AM

I will throw a linux distro on that machine for testing and report back.

MartinPulec commented 1 year ago

Tried removing the --audio-filter, no change.

correct, but the source command is actually more bloated than it need to be and it actually doesn't tell clearly what you are going to achieve:

receiver:

I wonder if soxr or speex are not available on Windows

I will throw a linux distro on that machine for testing and report back.

Not sure how it is related but speex/soxr are certainly present in Windows builds, so I wouldn't expect this issue to be platform-specific.

Are you sure the receiving CPU is not being tapped out. AV1 is a hard codec.

I agree. It may not be the root of the problem but I'd perhaps start with something less demanding like MJPEG or H.264.

Another things to try out:

From the above most importantly – I'd be curious whether you use VPN or so. If so, UG behavior is heavily dependent upon its operation, because eg. the TCP VPN can seriously hurt frames' timing if there are retransmits and the RTT is long. If the VPN introduces jitter, let say 100 ms, it is indeed not good scenario for UG as a low latency system. I'd suggest either avoiding VPN or use at least UDP then.

MartinPulec commented 1 year ago

Closing for inactivity, feel free to reopen if you have updates on that.

Anyways, I'd ask you to post a minimal working/broken example demonstrating the problem - I don't believe that the whole four-liner command is necessary to reproduce the problem.