내 현재 프로젝트 :
USB 카메라가있는 장치에서 서버로 비디오를 보내고, 서버에서 비디오 처리를 수행 한 다음 표시되는 다른 클라이언트로 보냅니다.
터미널에서 작동하도록 gstreamer를 얻었습니다.
수신 서버에서 :
gst-launch-1.0 udpsrc port=5000 ! \
application/x-rtp,media=video,clock-rate=90000,encoding-name=H264 ! \
rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! \
timeoverlay shaded-background=true text="host" deltay=20 ! \
ximagesink async=true sync=false
캡처 클라이언트에서 :
gst-launch-1.0 -v v4l2src ! \
timeoverlay shaded-background=true text="pi" ! \
video/x-raw,height=480,width=640,framerate=30/1 ! \
videoconvert ! omxh264enc ! rtph264pay ! \
udpsink host=136.225.61.68 port=5000
이것은 매우 잘 작동하며 비디오가 전송되고 있습니다. 이제 (수신 측에서) opencv로 얼굴 감지 요법을 수행 하고이 스트림을 다른 클라이언트로 보낼 수 있도록 c 코드로 스트림을 캡처해야합니다. 이것은 opencv를 지원하는 gstreamer 나쁜 플러그인으로 수행되거나 스트림을 매트로 변환하고 opencv를 사용하여 수행됩니다. 누구든지 어느 것이 더 쉬운 지 알고 있으며 예가 있습니까? (저는 gstreamer 1.0을 사용하고 있습니다).
미리 감사드립니다
마침내 첫 번째 단계에 대한 해결책을 찾았습니다. 이제 gst_parse_launch를 사용하여 C 코드로 스트림을 수신 할 수 있습니다.
서버 측의 코드는 이제 다음과 같습니다.
#include <gst/gst.h>
int main(int argc, char *argv[]) {
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* Build the pipeline */
pipeline = gst_parse_launch ("udpsrc port=5000 ! \
application/x-rtp,media=video,clock-rate=90000,encoding-name=H264 ! \
rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! \
timeoverlay shaded-background=true deltay=20 ! \
ximagesink async=true sync=false", NULL);
/* Start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* Wait until error or EOS */
bus = gst_element_get_bus (pipeline);
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
/* Free resources */
if (msg != NULL)
gst_message_unref (msg);
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}
이제 다음 단계는 이것을 OpenCV 또는 OpenCV 플러그인에 연결하여 facedetect 등을 수행 할 수 있도록하는 것입니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다