i’ve been trying capture h264 stream 2 c920 logitech camera opencv (on raspberry pi 2). have come conclusion not possible because not yet implemented. i’ve looked little in opencv/modules/highgui/cap_libv4l.cpp , found “videocapture-function” convert pixelformat bgr24. tried change h264, got black screen. guess because not being decoded right way.
so made workaround using:
- v4l2loopback
- h264_v4l2_rtspserver
- gstreamer-0.10
(you can find loopback , rtspserver on github) first setup virtual device using v4l2loopback. rtspserver captures in h264 streams rtsp localhost(127.0.0.1). catch again gstreamer , pipe virtual v4l2 video device made loopback using “v4l2sink” option in gst-launch-0.10. solution works , can connect virtual device opencv videocapture , full hd picture without overloading cpu, near enough solution. 3 second delay high stereo vision application , uses ton of bandwidth.
so wondering if knew way use v4l2 capture program derek molloys bonecv/capture program (which know works) capture in h264 maybe pipe gst-launche-0.10 , again pipe v4l2sink virtual device? (you can find capture program here: https://github.com/derekmolloy/bonecv)
the gstreamer command use is:
“gst-launch-0.10 rtspsrc location=rtsp://admin:pi@127.0.0.1:8554/unicast ! decodebin ! v4l2sink device=/dev/video4
”
or maybe in fact know change in opencv highgui code able capture h264 directly device without having use virtual device? amazingly awesome!
here links loopback , rtspserver use:
- github.com/mpromonet/h264_v4l2_rtspserver
- github.com/umlaeute/v4l2loopback
sorry wierd links don't have enough reputation yet poste more links..