c - 如何从 Gstreamer 管道中逐帧获取视频流?(没有 OpenCV)
问题描述
我正在做一个 Gstreamer 项目,我需要从 RTSP 流中提取图像。我可以使用 multifilesink 保存来自 gst_parse_launch 的图像,但无法将“侦听器”添加到管道以获取缓冲区并从中提取图像。
到目前为止我所拥有的:
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 的情况下做到这一点?(仅获取图像的字节)以及如何循环遍历管道中缓冲的帧?
先感谢您。
解决方案
推荐阅读
- excel - 将特定单词从 Word 获取到 Excel
- java - 超时服务器端长时间运行的请求
- json - 是否有可能在 gin-gonic 绑定的 json 中消失一个范围?
- reactjs - Antd表单远程提交
- java - 未触发地图位置更改侦听器
- javascript - 使用 .includes()
- node.js - 刷新 SAML SSO 会话
- google-cloud-platform - Compute Engine 实例上的 Gitlab 不可用
- bitbucket - 有没有办法限制用户在bitbucket中创建的分支数量?
- android - 为什么我的 LayoutParams 不会改变我的布局?