buresu / ndi-python

NewTek NDI Python wrapper
MIT License
133 stars 30 forks source link

Can't receive frames being sent #15

Open Nimisha-Pabbichetty opened 2 years ago

Nimisha-Pabbichetty commented 2 years ago

Hi! I'm sending video frames using send_video.py and trying to receive them using either recv.py or recv_cv.py. On the sending side, it is printed that frames are being sent like this:

image

But on the receiving side, it is only showing 'Looking for sources' when running both files like this: image

What should I do?

buresu commented 2 years ago

Hi, Thank you for reporting. I confirmed same problem on ubuntu 22.04, but on Arch Linux, I didn't have any problems. This problem seems to be related on avahi, but the solution is not yet known. I will continue to find the solution.

Nimisha-Pabbichetty commented 2 years ago

Thank you for your prompt response. Can you let me know if this issue exists on Windows? Also could you clarify if there are any differences to setting up this repo on windows when compared to ubuntu?

buresu commented 2 years ago

Yes, it works fine on windows. The setup step is almost the same.

# install ndi-python
pip install ndi-python

# run examples
git clone --recursive https://github.com/buresu/ndi-python.git
cd ndi-python/example
pip install -r requirements.txt
python find.py

But ubuntu needs avahi daemon to search for ndi sources, you need to install avahi.

sudo apt install avahi-daemon
sudo systemctl enable --now avahi-daemon
Nimisha-Pabbichetty commented 2 years ago

Ah okay thanks!

buresu commented 2 years ago

Update: Curiously, it works fine in my current environment.

Ubuntu 22.04 LTS
Anaconda 4.12.0
Python 3.10.4
ndi-python 5.1.1.2
avahi-daemon 0.8

You can use avahi-discover to make sure that it is working properly.

sudo apt install avahi-discover
avahi-discover

Screenshot_20220522_200640

Nimisha-Pabbichetty commented 2 years ago

Interesting, I'll try to match your setup and see if it works.

tgentry1986 commented 2 years ago

Hi There,

For what its worth im having similar issues on rocky 8.6 - although not quite the same - i can usually discover sources both locally and on the network, sometimes i cant, and so far ive not been able to get a picture out of this machine to either a local monitor or a monitor on the network (windows or linux). Still investigating...

Cheers!

Nimisha-Pabbichetty commented 2 years ago

@buresu I migrated to Windows and it works fine there. I do have a different issue though. I'm transmitting frames of the format 'FOURCC_VIDEO_TYPE_UYVY' but I am only able to receive them in 'RECV_COLOR_FORMAT_BGRX_BGRA' format. The other formats throw an error like this when I try to visualise them:

image

buresu commented 2 years ago

@Nimisha-Pabbichetty cv.imshow() is not support uyvy format. If you want to get it in uyvy format, you have to convert it yourself.

You can change the following lines.

ndi_recv_create.color_format = ndi.RECV_COLOR_FORMAT_BGRX_BGRA
to
ndi_recv_create.color_format = ndi.RECV_COLOR_FORMAT_FASTEST

and

frame = np.copy(v.data)
to
frame = cv.cvtColor(v.data, cv.COLOR_YUV2BGR_UYVY)