How to detect custom stream from ATEM Mini Pro ISO?

Questions about ATEM Switchers, Camera Converter and everything live!
  • Author
  • Message
Offline

ralphbrooks

  • Posts: 3
  • Joined: Tue Aug 31, 2021 6:04 pm
  • Real Name: Ralph Brooks

How to detect custom stream from ATEM Mini Pro ISO?

PostTue Aug 31, 2021 6:18 pm

Hey all,

Hoping someone can help. I am currently using the BlackMagic Pocket Cinema Camera 4K with the ATEM Mini Pro ISO. The marketing and reviews for the ISO suggest that it can do custom streaming. For me, I am trying to get this to stream from the ISO to opencv-python on WSL2 (on the same network as the ISO) so that I can do some machine learning / artificial intelligence and object detection. I was thinking of using a RTMP stream but willing to use anything that is compatible with opencv-python (and in particular what is compatible with cv2.VideoCapture).

To illustrate further, I am trying to find a way to stream from ISO and have it captured by the following python code on my desktop:


Code: Select all
import cv2

number_imgs = 10

cap = cv2.VideoCapture(??? NO IDEA ???)
print('Collecting images for {}'.format('ThumbUpLabel'))
time.sleep(5)
for imgnum in range(number_imgs):
    print('Collecting image {}'.format(imgnum))
    ret, frame = cap.read()
    cv2.imshow('frame', frame)
    time.sleep(2)

    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()


This is the part though where I get stuck. I import an xml (bottom of the post) into the ATEM Mini ISO pro with an IP address that matches the IP address for my computer (the DHCP IP address that you get when type hostname -I in WSL2). I then click the stream to go on air, but I have zero idea if the rtmp stream is working or if a rtmp stream is generated (the ATEM software says the stream is running and eventually the software shows the buffer fills up), but not sure now to test for a RTMP push stream.

What kind of software is typically used to detect if a rtmp push stream is running? Any help on this is more than appreciated.



IMPORTED XML into ATEM software

Code: Select all
<streaming>
<service>
<name>Rtmp destination</name>
<servers>
<server>
<name>Primary</name>
<url>rtmp://172.18.243.31/live</url>
</server>
</servers>
<profiles>
<profile>
<name>Streaming High</name>
<config resolution="1080p" fps="60">1
<bitrate>9000000</bitrate>
<audio-bitrate>128000</audio-bitrate>
<keyframe-interval>2</keyframe-interval>
</config>
<config resolution="1080p" fps="30">
<bitrate>6000000</bitrate>
<audio-bitrate>128000</audio-bitrate>
<keyframe-interval>2</keyframe-interval>
</config>
</profile>
<profile>
<name>Streaming Low</name>
<config resolution="1080p" fps="60">
<bitrate>4500000</bitrate>
<audio-bitrate>128000</audio-bitrate>
<keyframe-interval>2</keyframe-interval>
</config>
<config resolution="1080p" fps="30">
<bitrate>3000000</bitrate>
<audio-bitrate>128000</audio-bitrate>
<keyframe-interval>2</keyframe-interval>
</config>
</profile>
</profiles>
</service>
</streaming>
Offline

ralphbrooks

  • Posts: 3
  • Joined: Tue Aug 31, 2021 6:04 pm
  • Real Name: Ralph Brooks

Re: How to detect custom stream from ATEM Mini Pro ISO?

PostTue Sep 07, 2021 3:06 pm

To give a quick update, I can get similar code to work with BMPCC4K and Atem Mini Pro ISO with Windows.

In that case the code looks like:

Code: Select all
for label in labels:
    # I used an index of one which tied into Blackmagic Design. This could be 0 or other indices
    # on your system. You may have to experiment with different numbers until it works.
    cap = cv2.VideoCapture(1) 
    print('Collecting images for {}'.format(label))
    time.sleep(5)
    for imgnum in range(number_imgs):
        print('Collecting image {}'.format(imgnum))
        ret, frame = cap.read()
        imgname = os.path.join(IMAGES_PATH,label,label+'.'+'{}.jpg'.format(str(uuid.uuid1())))
        cv2.imwrite(imgname, frame)
        cv2.imshow('frame', frame)
        time.sleep(2)

        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
cap.release()
cv2.destroyAllWindows()


The challenge though (as many of you know) is that doing anything AI / Machine Learning related in Windows is painful in comparison to developing on linux. Plus, there are a lot of situations (robots, raspberry pi, etc.) where Linux is your only option.

Again, if anyone has any thoughts as to a solution that allows wsl2 (with Ubuntu) to work with Atem Mini Iso Pro and opencv, please let me know.

Best,

Ralph
Offline

oniongarlic

  • Posts: 8
  • Joined: Thu Dec 05, 2019 9:00 am
  • Real Name: Kaj-Michael Lang

Re: How to detect custom stream from ATEM Mini Pro ISO?

PostMon Sep 20, 2021 9:26 am

You need a RTMP ingest running on your system, for example nginx with rtmp module can do that for you. Then you should be able to do all kinds of trickery with ffmpeg/gstreamer for example.

These should work fine under wsl I think.
Offline

ralphbrooks

  • Posts: 3
  • Joined: Tue Aug 31, 2021 6:04 pm
  • Real Name: Ralph Brooks

Re: How to detect custom stream from ATEM Mini Pro ISO?

PostWed Sep 22, 2021 3:34 pm

Oniongarlic,

Willing to give it a try, but the challenge is what port should be used and how can you even detect if the RTMP is streaming.

As mentioned at the top of the thread, the heart of the matter is this one line.


Code: Select all
cap = cv2.VideoCapture(??? NO IDEA ???)



Any additional thoughts are appreciated.

Return to Live Production

Who is online

Users browsing this forum: proserv, Tobias Dieterich and 19 guests