currently I try to get the video of the camera of my DJI M3E. When streaming the video to an RTMP server, I can see it on OBS, but not with my Python script.
This is my one:
import cv2
rtmp_url = "rtmp://192.168.178.137/live/" # also tried without last /
cap = cv2.VideoCapture(rtmp_url, cv2.CAP_FFMPEG)
if not cap.isOpened():
print("Fehler beim Öffnen der RTMP-Quelle") # Don't get this error
exit()
while True:
ret, frame = cap.read() # red the frame
if not ret:
continue # if i would have a invaild format then it skips, but this is as mentioned everytime
cv2.imshow("Frame", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Freigabe der Ressourcen
cap.release()
cv2.destroyAllWindows()
I tried to print out only the thing I receive from the server without processing.
This is the output:
b'libavutil 58. 2.100 / 58. 2.100'
b'libavcodec 60. 3.100 / 60. 3.100'
b'libavformat 60. 3.100 / 60. 3.100'
b'libavdevice 60. 1.100 / 60. 1.100'
b'libavfilter 9. 3.100 / 9. 3.100'
b'libswscale 7. 1.100 / 7. 1.100'
b'libswresample 4. 10.100 / 4. 10.100'
b'libpostproc 57. 1.100 / 57. 1.100'
b'[flv @ 0x14c0042f0] unsupported amf type 17'
b'[h264 @ 0x14c104530] missing picture in access unit with size 467'
b'[h264 @ 0x14c104530] no frame!'
b'[h264 @ 0x14c104530] missing picture in access unit with size 323'
b'[h264 @ 0x14c104530] no frame!'
b'[h264 @ 0x14c104530] missing picture in access unit with size 467'
b'[h264 @ 0x14c104530] missing picture in access unit with size 90'
b'[h264 @ 0x14c104530] missing picture in access unit with size 323'
b'[h264 @ 0x14c104530] missing picture in access unit with size 461'
b'[h264 @ 0x14c104530] missing picture in access unit with size 319'
b'[h264 @ 0x14c104530] missing picture in access unit with size 461'
b'[h264 @ 0x14c104530] missing picture in access unit with size 323'
b'[h264 @ 0x14c104530] missing picture in access unit with size 467'
b'[h264 @ 0x14c104530] missing picture in access unit with size 323'
but after some time I get a notmal output of an image
like this:
b'\xb7\xcdb\xe9\xccv\x02\x8b\x18\x03\x8d L\x8e}\xac\x0bVdi\xe9>\xa8\x87\xcb6S\x0c2\xe0\x1a\xdb\xe7\xe0\x17Q\x16\x08\xf0I\x01\xb9y\xe5DJ\x15\xb2q\xff\x1a\xc7g\xc7)\x8d\xa6\xc3\xaf\x14e\x86\x85@rd\t\x8d\xe2Rj\x13\xa7\x1b0\xe1w\x9b\x9f\xec\x95\x9b\x8fj(\xcd\'\xfe{u3j\x12\xd2\xf6_\xdf\xf0\x83B\xe7"\xde5C\xa88u\xf3\xdf"[\x84\xca\x1f\x8d?\xdf\x9f\xa8\xda\xeb\xfa\xba\xdf\x0fy-\xe9\xf7\x1b\x95\x8d\xca\xa0\xc4#\x9f\xde\xc4Z\xd4w\xd6?8\xf3\xf5\xd7\xd2\x849\xa2\xc5\xd0V\x01}\xdc\xe4_\x1d\x7f\xeaAz\xc9\xb7W\xcc\xa8\xb9^ny\x85#\xb3\x11}.\x82s\x94\x87\x8b\xf9Q\xd5X\xd3\xf4J&\x83\xba\x8a\x16\x04H\xb8DZS\xa2\x15\xdb\x17\xfd}]\x02\x00=d\x03M\xb5\x81\xd7\x85lc\xca\xfc\t:\xec\xe1\xa2\xb9\x0e\xcf\xf8\xcb\xe9\xf9\xb2\xc3\xed\x9d\xf8\xd6\xe9\xca\xaer\xeb\xfa\xec\xc1I\x8f\xf4\x91\xc3\xf2yD\xa7\xc5Q\xc7\xf8\xab\x9d|\x85\x97K#\x8d\xaa\x92'