Kivy OpenCV ip camera stream problem

510 views
Skip to first unread message

Atakan Yüksel

unread,
Mar 26, 2022, 3:11:50 PM3/26/22
to Kivy users support
Hi, I have an ip camera that streams at "http://192.168.1.23:81/stream" URL. My code's aim is play that live stream.
My code works on PC perfectly but when try to play that live stream, app goes just a blank white screen (even buttons disappear). And I dont get any log about the problem.
Can you help me to solve the problem please ? Or can you show me there is any other method to play the live stream through IP cam

Everything you need about the code is below.

(Also, in this link: https://github.com/aiakon/abc)


Here is the logs:
03-24 23:11:44.156 11925 12119 I python  : Android kivy bootstrap done. __name__ is __main__
03-24 23:11:44.156 11925 12119 I python  : AND: Ran string
03-24 23:11:44.156 11925 12119 I python  : Run user program, change dir and execute entrypoint
03-24 23:11:44.244 11925 12119 I python  : [WARNING] [Config      ] Older configuration version detected (0 instead of 21)
03-24 23:11:44.244 11925 12119 I python  : [WARNING] [Config      ] Upgrading configuration in progress.
03-24 23:11:44.249 11925 12119 I python  : [INFO   ] [Logger      ] Record log in /data/user/0/org.abc.abc/files/app/.kivy/logs/kivy_22-03-24_0.txt
03-24 23:11:44.250 11925 12119 I python  : [INFO   ] [Kivy        ] v2.0.0
03-24 23:11:44.250 11925 12119 I python  : [INFO   ] [Kivy        ] Installed at "/data/user/0/org.abc.abc/files/app/_python_bundle/site-packages/kivy/__init__.pyc"
03-24 23:11:44.250 11925 12119 I python  : [INFO   ] [Python      ] v3.8.9 (default, Mar 22 2022, 23:27:55)
03-24 23:11:44.250 11925 12119 I python  : [Clang 8.0.2 (https://android.googlesource.com/toolchain/clang 40173bab62ec7462
03-24 23:11:44.250 11925 12119 I python  : [INFO   ] [Python      ] Interpreter at ""
03-24 23:11:44.935 11925 12119 I python  : [INFO   ] [Factory     ] 186 symbols loaded
03-24 23:11:45.135 11925 12119 I python  : [INFO   ] [ImageLoaderFFPy] Using ffpyplayer 4.3.2
03-24 23:11:45.136 11925 12119 I python  : [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer
03-24 23:11:45.358 11925 12119 I python  : [INFO   ] [Window      ] Provider: sdl2
03-24 23:11:45.376 11925 12119 I python  : [INFO   ] [GL          ] Using the "OpenGL ES 2" graphics system
03-24 23:11:45.376 11925 12119 I python  : [INFO   ] [GL          ] Backend used <sdl2>
03-24 23:11:45.377 11925 12119 I python  : [INFO   ] [GL          ] OpenGL version <b'OpenGL ES 3.2 v1.r20p0-01rel0.a41d1d553047de7edc8f79dbe3e575cd'>
03-24 23:11:45.377 11925 12119 I python  : [INFO   ] [GL          ] OpenGL vendor <b'ARM'>
03-24 23:11:45.377 11925 12119 I python  : [INFO   ] [GL          ] OpenGL renderer <b'Mali-G76 MC4'>
03-24 23:11:45.377 11925 12119 I python  : [INFO   ] [GL          ] OpenGL parsed version: 3, 2
03-24 23:11:45.377 11925 12119 I python  : [INFO   ] [GL          ] Texture max size <8192>
03-24 23:11:45.377 11925 12119 I python  : [INFO   ] [GL          ] Texture max units <16>
03-24 23:11:45.414 11925 12119 I python  : [INFO   ] [Window      ] auto add sdl2 input provider
03-24 23:11:45.415 11925 12119 I python  : [INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
03-24 23:11:45.424 11925 12119 I python  : [INFO   ] [Text        ] Provider: sdl2
03-24 23:11:45.499 11925 12119 I python  : [WARNING] [Base        ] Unknown <android> provider
03-24 23:11:45.499 11925 12119 I python  : [INFO   ] [Base        ] Start application main loop
03-24 23:11:45.501 11925 12119 I python  : [INFO   ] [GL          ] NPOT texture support is available
03-24 23:11:50.639 11925 12119 I python  : 1
03-24 23:11:50.646 11925 12119 I python  : 2

I put 1 and 2 to see if code is working but app is not reaches the URL. I can check that because I have a LED that is ON when live streaming URL is busy. 


Robert

unread,
Mar 26, 2022, 5:54:31 PM3/26/22
to Kivy users support
Unlikely I will have better suggestions than the guys on Discord, but:

Assuming the app has INTERNET permission:
1) Try printing the values returned by the camera, to see if the cv2 code is doing what you think it is doing.
2) Remove the python filter on the logcat output, this will enable you to see if there is an Android error message. This will be very verbose.

Atakan Yüksel

unread,
Mar 27, 2022, 4:45:04 AM3/27/22
to Kivy users support
Hi, thanks for suggestions the problem is cv2.VideoCapture is not working on android, i assume. I got this log (below) and it is revelant with cv2.VideoCapture. I thought if i got this error because I am using URL inside of cv2.VideoCapture, so i tried to play mp4 video but I got same error. Can you help me to fix it please ?

03-26 22:17:35.836  3497  3497 I AssistHolderContentView: forceFitSystemWindows pb = 0
03-26 22:17:35.886  3497  3497 I chatty  : uid=1000(system) com.mi.android.globalminusscreen identical 3 lines
03-26 22:17:35.903  3497  3497 I AssistHolderContentView: forceFitSystemWindows pb = 0
03-26 22:17:35.912   780   892 D AAL     : 03-26 10:17:35.846 BL=1975,ESS= 256, 03-26 10:17:35.862 BL=1973,ESS= 256, 03-26 10:17:35.879 BL=1971,ESS= 256, 03-26 10:17:35.895 BL=1969,ESS= 256, 03-26 10:17:35.912 BL=1967,ESS= 256,
03-26 22:17:35.919  3497  3497 I AssistHolderContentView: forceFitSystemWindows pb = 0
03-26 22:17:35.953  3497  3497 I chatty  : uid=1000(system) com.mi.android.globalminusscreen identical 2 lines
03-26 22:17:35.970  3497  3497 I AssistHolderContentView: forceFitSystemWindows pb = 0
03-26 22:17:35.978   780   892 D AAL     : 03-26 10:17:35.929 BL=1965,ESS= 256, 03-26 10:17:35.945 BL=1963,ESS= 256,
03-26 22:17:35.986  3497  3497 I AssistHolderContentView: forceFitSystemWindows pb = 0
03-26 22:17:36.103  3497  3497 I chatty  : uid=1000(system) com.mi.android.globalminusscreen identical 7 lines
03-26 22:17:36.119  3497  3497 I AssistHolderContentView: forceFitSystemWindows pb = 0
03-26 22:17:36.121   507 17191 I hwcomposer: [HWCDisplay] [Display_0 (type:1)] fps:8.438753,dur:1066.51,max:329.85,min:15.62  
03-26 22:17:36.122   566   566 I SurfaceFlinger: screenshot (org.abc.abc/org.kivy.android.PythonActivity#0)
03-26 22:17:36.122   566   566 I SurfaceFlinger: isIncludeStatusBarAndNavBar (1)
03-26 22:17:36.127  1533  1533 D NavBarTintController: onSampleCollected 0.0
03-26 22:17:36.136  3497  3497 I AssistHolderContentView: forceFitSystemWindows pb = 0
03-26 22:17:36.153  3497  3497 I AssistHolderContentView: forceFitSystemWindows pb = 0
03-26 22:17:36.162  7982  8028 I python  : 1
03-26 22:17:36.163  7982  8028 E cv::error(): OpenCV(4.5.1) Error: Bad argument (CAP_IMAGES: can't find starting number (in the name of file): http://192.168.1.23:81/stream) in icvExtractPattern, file /home/pc/KivyTestt/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/opencv/arm64-v8a__ndk_target_21/opencv/modules/videoio/src/cap_images.cpp, line 253
03-26 22:17:36.165  7982  8028 E OpenCV/4.5.1: [ERROR:0] global /home/pc/KivyTestt/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/opencv/arm64-v8a__ndk_target_21/opencv/modules/videoio/src/cap.cpp (142) open VIDEOIO(CV_IMAGES): raised OpenCV exception:
03-26 22:17:36.165  7982  8028 E OpenCV/4.5.1:
03-26 22:17:36.165  7982  8028 E OpenCV/4.5.1: OpenCV(4.5.1) /home/pc/KivyTestt/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/opencv/arm64-v8a__ndk_target_21/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): http://192.168.1.23:81/stream in function 'icvExtractPattern'
03-26 22:17:36.165  7982  8028 E OpenCV/4.5.1:
03-26 22:17:36.165  7982  8028 E OpenCV/4.5.1:
03-26 22:17:36.165  7982  8028 E NativeCodec: failed to stat file: http://192.168.1.23:81/stream (No such file or directory)
03-26 22:17:36.166  7982  8028 I python  : 2
03-26 22:17:36.170  3497  3497 I AssistHolderContentView: forceFitSystemWindows pb = 0
03-26 22:17:36.220  3497  3497 I chatty  : uid=1000(system) com.mi.android.globalminusscreen identical 3 lines
03-26 22:17:36.236  3497  3497 I AssistHolderContentView: forceFitSystemWindows pb = 0
03-26 22:17:36.242   566   566 I SurfaceFlinger: screenshot (org.abc.abc/org.kivy.android.PythonActivity#0)
03-26 22:17:36.242   566   566 I SurfaceFlinger: isIncludeStatusBarAndNavBar (1)
03-26 22:17:36.245  1292  1453 E WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.927) failed {.code = ERROR_NOT_SUPPORTED, .description = }
03-26 22:17:36.246  1533  1533 D NavBarTintController: onSampleCollected 0.0
03-26 22:17:36.249  1292  1460 D SlaveWifiManager: getWifiSlaveConnectionInfo
03-26 22:17:36.249  1292  1452 D SlaveWifiService: Slave message handler : 155633
03-26 22:17:36.250  1292  1460 D SlaveWifiManager: getWifiSlaveConnectionInfo
03-26 22:17:36.250  1292  1452 D SlaveWifiService: Slave message handler : 155633
03-26 22:17:36.252  1533  1533 D SignalClusterView: updateMobileTypeImage  0
03-26 22:17:36.253  1533  1533 I chatty  : uid=1000(system) com.android.systemui identical 1 line
03-26 22:17:36.253  1533  1533 D SignalClusterView: updateMobileTypeImage  0

27 Mart 2022 Pazar tarihinde saat 00:54:31 UTC+3 itibarıyla Robert şunları yazdı:

Robert

unread,
Mar 27, 2022, 1:02:47 PM3/27/22
to Kivy users support
OK so ocv is not working, either because it doesn't work (nothing anybody here could do about that), or because url is not portable (it worked on a pc, right?).
Did you try the obvious stuff like  .cgi or rtsp://  ?
Reply all
Reply to author
Forward
0 new messages