CasparCG / server

CasparCG Server is a Windows and Linux software used to play out professional graphics, audio and video to multiple outputs. It has been in 24/7 broadcast production since 2006. Ready-to-use downloads are available under the Releases tab https://casparcg.com.
GNU General Public License v3.0
889 stars 268 forks source link

Bug: NDI Playback distorted #1542

Open jpc0 opened 3 weeks ago

jpc0 commented 3 weeks ago

Observed Behavior

It seems like the resolution being fed from NDI into the backend is incorrect. Could also the the pixel format but unlikely. I have attached pictures of the expected output vs what is actually being output. I see the same behaviour on both the decklink consumer output and output from screen consumer so it seems like the issues is before the consumer at the very least. The FFMPEG, IMAGE and COLOUR producers seem to work fine, this does seem restricted to the NDI producer.

I have made some code changes to try faultfinding: I threw an exception at https://github.com/CasparCG/server/blob/e4e9ed299e1a0f9c87c8709d19b0585a5703102a/src/modules/newtek/producer/newtek_ndi_producer.cpp#L199 and it did not trigger so that confirms that it is in fact not taking that branch.

I also logged the width and height here: https://github.com/CasparCG/server/blob/e4e9ed299e1a0f9c87c8709d19b0585a5703102a/src/modules/newtek/producer/newtek_ndi_producer.cpp#L204 and I can confirm the with and height is 1920x1080 which is the same width and height as the consumers & channel is running at. There are no errors reported from casparcg. A behaviour I did notice was that it takes quite a while (close to a minute) for the image to display and for the logging I placed for width and height to start printing. On windows there is never a delay.

I may try bumping to NDI V6 but that needs some code changes in casparcg, and seeing if that solves the problem.

expected

actual

Expected behaviour

NDI Playback works as expected, and is it does on windows.

Steps to reproduce

Playback NDI on linux

Environment

jpc0 commented 3 weeks ago

I can confirm switching to the libndi.so.6 library does not solve the problem. However on further testing turning off alpha on the sending device changes the level of stretching which makes me think it is an issue with stride/pixel format

jpc0 commented 3 weeks ago

Some more information:

As mentioned in https://github.com/CasparCG/server/pull/1543 discussion it is also distorted on Windows builds. However when I tested it is working correctly on v2.4.0 release. Upon bisecting I found that commit e3289ecac25fca89221f258051222ecdefa08d92 is the commit that broke the expected behaviour.

For those who got here by some sort of search:

A behaviour I did notice was that it takes quite a while (close to a minute) for the image to display and for the logging I placed for width and height to start printing.

That was caused by the firewall blocking ndi. Make sure your firewall rules allow communication between the server and the ndi source/destination.

niklaspandersson commented 3 weeks ago

I'll have a look at the (my) offending commit