如何从Gstreamer管道中逐帧获取视频流?(不带OpenCV)
我正在从事一个Gstreamer项目,需要从RTSP流中提取图像。 我可以用multifilesink保存gst_parse_启动时的图像,但无法向管道中添加“侦听器”以获取缓冲区并从中提取图像 到目前为止,我所拥有的:如何从Gstreamer管道中逐帧获取视频流?(不带OpenCV),c,gstreamer,pipeline,rtsp,C,Gstreamer,Pipeline,Rtsp,我正在从事一个Gstreamer项目,需要从RTSP流中提取图像。 我可以用multifilesink保存gst_parse_启动时的图像,但无法向管道中添加“侦听器”以获取缓冲区并从中提取图像 到目前为止,我所拥有的: pipeline = gst_parse_launch("-e -v rtspsrc location="IPADDRESS" ! rtph264depay ! h264parse ! decodebin ! jpegenc ! appsink name=sink",
pipeline = gst_parse_launch("-e -v rtspsrc location="IPADDRESS" ! rtph264depay ! h264parse !
decodebin ! jpegenc ! appsink name=sink",
NULL);
bus = gst_element_get_bus(pipeline);
gst_element_set_state(pipeline, GST_STATE_PLAYING);
bus = gst_element_get_bus(pipeline);
GstElement *sink = gst_bin_get_by_name(GST_BIN(pipeline), "sink");
if (!sink) {
printf("sink is NULL\n");
exit(1);
}
GstAppSink *appsink = GST_APP_SINK(sink);
if (!appsink) {
printf("appsink is NULL\n");
exit(1);
}
GstSample *sample = gst_app_sink_pull_sample(appsink);
if (!sample) {
printf("sample is NULL\n");
exit(1);
}
GstBuffer *buffer = gst_sample_get_buffer(sample);
GstMapInfo map;
gst_buffer_map(buffer, &map, GST_MAP_READ);
`
我如何在不使用OpenCV的情况下做到这一点?(仅需字节即可获得图像)
我如何循环通过管道中缓冲的帧
提前谢谢。我不太清楚你想做什么。从管道中删除
jpegenc
,您将获得原始图像数据吗?@Florianwoch我试图从这个流中获取原始数据,使用map.data将其保存到一个字节数组中,现在我得到了完整的图像。非常感谢。