gstreamer 相关问题

与GStreamer(也称为Gst)相关的问题,这是一个开源多媒体框架,支持从Linux服务器和Linux桌面系统到大量嵌入式设备的所有功能。

如何使用gstreamer和OpenCV为RTSP组播服务器提供服务?

我想编写一个程序,通过多播或广播 rtsp/rtp 服务器传输 cv2 帧。 我在下面编写了带有一些示例的代码,但是使用此代码我只能首先使用...

回答 1 投票 0

GStreamer 管道:将 H.264 从 Appsrc 解码到 Appsink

我正在开发一个项目,需要用单帧解码 H.264 文件。原始文件是从 NV12 格式编码的。现在,我想将其解码回 NV12,然后将其转换为 JPEG....

回答 1 投票 0

Gstreamer 1.0:教程中的视频无法在 MacOS 上播放

我正在尝试在 MacOS 10.11.3 上使用 Xcode 7.2 编译本教程 Tutorial_01,但没有收到任何视频:我可以听到音频,但视频窗口似乎在某处丢失了。 我尝试过...

回答 3 投票 0

使用appsrc和rtsp的Gstreamer

我们正在使用 h264 编码以 90000 比特率使用 rtsp 流式传输视频。我们能够在vlc媒体播放器中获取流,但是当我们使用Gstreamer pip时我们无法获取流......

回答 1 投票 0

无法在 Chromium 中的“RTCPeerConnection”上执行“setRemoteDescription”

我无法在 Chrome 和 Edge 中调用 rtcConnection.setRemoteDescription() 来获取此 SDP 优惠。它在 Firefox 中运行良好。在 Firefox 中,WebRTC 通信已建立并正常工作,但在 Chrome 中则不然......

回答 1 投票 0

pkg-config 无法找到 pangoft2 和 gstreamer

我使用命令 $ sudo apt install build-essential libpangoft2-1.0.0 在我的 debian 上安装了 pangoft2,并使用 $ sudo apt install build-essential gstreamer1.0-plugins-* 安装了 gstreamer 他们...

回答 1 投票 0

我想编写OpenCV代码,将文本写入网络摄像头视频并使用Gst库发送UDP

我编写了这段代码并尝试了其他功能,但我无法实现这个场景。我该怎么办? 问题出在代码、方法还是库中? #包括 #包括 我编写了这段代码并尝试了其他功能,但我无法实现这个场景。我该怎么办? 问题出在代码、方法还是库中? #include <gst/gst.h> #include <opencv2/opencv.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <gst/app/gstappsrc.h> int main(int argc, char* argv[]) { // Initialize GStreamer gst_init(&argc, &argv); // Create a GStreamer pipeline GstElement* pipeline = gst_parse_launch("v4l2src device=/dev/video0 ! videoconvert ! video/x-raw,format=BGR ! appsink", NULL); // Check if the pipeline was created successfully if (!pipeline) { g_print("Pipeline could not be created. Exiting.\n"); return -1; } // Set the pipeline state to playing GstStateChangeReturn ret = gst_element_set_state(pipeline, GST_STATE_PLAYING); if (ret == GST_STATE_CHANGE_FAILURE) { g_print("Unable to set the pipeline to the playing state. Exiting.\n"); return -1; } // OpenCV VideoCapture for video capture cv::VideoCapture cap; if (!cap.open("appsrc ! videoconvert ! video/x-raw, format=YUY2,width=640,height=480,framerate=25/1 ! jpegenc ! rtpjpegpay ! appsink ! udpsink host=192.168.1.14 port=5000")) { std::cerr << "Error: Could not open OpenCV VideoCapture." << std::endl; return -1; } cv::Mat frame; cv::Scalar text_color(0, 255, 0); // Text color (BGR) int font = cv::FONT_HERSHEY_SIMPLEX; double font_scale = 1.0; int font_thickness = 2; std::string text = "Hello, GStreamer!"; while (true) { if (!cap.read(frame)) { std::cerr << "Error: Could not read frame from OpenCV VideoCapture." << std::endl; break; } // Add text to the video frame using OpenCV cv::putText(frame, text, cv::Point(10, 50), font, font_scale, text_color, font_thickness); // Display the processed frame using OpenCV cv::imshow("Processed Frame", frame); cv::waitKey(1); // Convert the OpenCV frame to GStreamer format GstBuffer* buffer = gst_buffer_new_allocate(NULL, frame.total() * frame.elemSize(), NULL); GstMapInfo map_info; gst_buffer_map(buffer, &map_info, GST_MAP_WRITE); memcpy(map_info.data, frame.data, frame.total() * frame.elemSize()); gst_buffer_unmap(buffer, &map_info); // Push the frame into the GStreamer pipeline GstFlowReturn ret = gst_app_src_push_buffer(GST_APP_SRC(gst_bin_get_by_name(GST_BIN(pipeline), "appsrc")), buffer); if (ret != GST_FLOW_OK) { g_print("Error pushing frame to GStreamer pipeline. Exiting.\n"); break; } } // Clean up cv::destroyAllWindows(); gst_element_set_state(pipeline, GST_STATE_NULL); gst_object_unref(pipeline); return 0; } 我收到此错误: (gstremear_and_opencv_driver:19685):GStreamer-CRITICAL **:15:24:59.492:gst_caps_get_struct:断言“GST_IS_CAPS(大写)”失败 (gstremear_and_opencv_driver:19685):GStreamer-CRITICAL **:15:24:59.492:gst_struct_get_int:断言“结构!= NULL”失败 [警告:[电子邮件受保护]]全局 cap_gstreamer.cpp:1707 打开 OpenCV | GStreamer 警告:无法查询视频宽度/高度 (gstremear_and_opencv_driver:19685):GStreamer-CRITICAL **:15:24:59.492:gst_struct_get_fraction:断言“结构!= NULL”失败 [警告:[电子邮件受保护]]全局 cap_gstreamer.cpp:1713 打开 OpenCV | GStreamer 警告:无法查询视频 fps [警告:[电子邮件受保护]]全局 cap_gstreamer.cpp:1728 打开 OpenCV | GStreamer 警告:无法查询视频位置:状态=0,值=-1,持续时间=-1 我尝试使用 opencv 在网络摄像头视频上编写文本并使用 udp gst 库发送。 我不确定你的确切目标是什么,但假设你想从默认输出原始视频的相机 0 读取帧(否则使用 v4l2-ctl -d0 --list-formats-ext 并在捕获中的 v4l2src 之后指定视频上限管道),然后通过 UDP 覆盖一些文本和流结果作为 RTP/JPEG,然后你就可以做到这一点: 1。使用 gstreamer 从命令行: gst-launch-1.0 v4l2src device=/dev/video0 ! videoscale ! video/x-raw,width=640,height=480,pixel-aspect-ratio=1/1 ! videoconvert ! videorate ! video/x-raw,framerate=25/1 ! textoverlay text="Hello, Gstreamer" valignment=2 deltax=-200 color=4278255360 ! queue ! videoconvert ! video/x-raw,format=YUY2 ! jpegenc ! rtpjpegpay ! udpsink host=127.0.0.1 port=5000 2。或者使用 OpenCv,从 V4L 相机捕获到 OpenCv,以及用于流输出的编写器,例如: #include <opencv2/opencv.hpp> #include <opencv2/videoio.hpp> #include <opencv2/highgui.hpp> #include <opencv2/imgproc.hpp> int main(int argc, char* argv[]) { // Create OpenCV VideoCapture for reading video from camera cv::VideoCapture cap("v4l2src device=/dev/video0 ! videoscale ! video/x-raw,width=640,height=480,pixel-aspect-ratio=1/1 ! videoconvert ! video/x-raw,format=BGR ! videorate ! video/x-raw,framerate=25/1 ! appsink drop=1", cv::CAP_GSTREAMER); if (!cap.isOpened()) { std::cerr << "Error failed to open camera" << std::endl; return -1; } unsigned int width = (unsigned int) cap.get(cv::CAP_PROP_FRAME_WIDTH); unsigned int height = (unsigned int) cap.get(cv::CAP_PROP_FRAME_HEIGHT); double fps = cap.get(cv::CAP_PROP_FPS); std::cout << "Capture input opened, Ffaming: " << width << " x " << height << " @" << fps << " FPS" << std::endl; // OpenCV VideoWriter to RTP/JPG streaming to client 192.168.1.14 over UDP/5000 cv::VideoWriter streamer("appsrc ! queue ! video/x-raw,format=BGR ! videoconvert ! video/x-raw,format=YUY2 ! jpegenc ! rtpjpegpay ! udpsink host=192.168.1.14 port=5000", cv::CAP_GSTREAMER, 0, (float)fps, cv::Size(width, height)); if (!streamer.isOpened()) { std::cerr << "Error: Failed to open streamer writer." << std::endl; return -2; } std::cout << "streamer opened, ready for streaming to client 192.168.1.14 over UDP/5000" << std::endl; cv::Scalar text_color(0, 255, 0); // Text color (BGR) int font = cv::FONT_HERSHEY_SIMPLEX; double font_scale = 1.0; int font_thickness = 2; std::string text = "Hello, GStreamer!"; cv::Mat frame; while (true) { if (!cap.read(frame)) { std::cerr << "Error: Could not read frame from OpenCV VideoCapture." << std::endl; break; } // Add text to the video frame using OpenCV cv::putText(frame, text, cv::Point(10, 50), font, font_scale, text_color, font_thickness); streamer.write(frame); // Display the processed frame using OpenCV cv::imshow("Processed Frame", frame); cv::waitKey(1); } // Clean up cv::destroyAllWindows(); return 0; }

回答 1 投票 0

没有名为 gi 的模块

我已经尝试了下面给出的所有可能的命令: pip 安装 pgi 、 pip 安装 PyGObject 、 pip 安装 python-gi 仍然无法在 python 中安装该模块。 安装了 python 3.7 也尝试一下...

回答 3 投票 0

使用 GStreamer 和 souphttpsrc 播放 HLS 流(10 秒后失败)

以下管道在 10 秒后失败。 gst-launch-1.0 -v souphttpsrc location=https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8 ! hlsdemux!解码器!视频转换!自动视频接收器 对于某些人

回答 1 投票 0

Gstreamer splitmuxsink 在拆分时重置时间戳

我一直在使用 splitmuxsink 按长度或“立即分割”命令来分割实时视频流的录制。生成的视频文件都带有“全球时间&q...

回答 1 投票 0

如何在 Yocto 中向 GStreamer 添加跟踪器

我正在尝试将 GStreamer 跟踪器挂钩添加到我的 Mickledore Yocto,但没有成功。 我在 local.conf 文件中添加以下行: PACKAGECONFIG:附加:pn-gstreamer1.0_1.22.5 =“跟踪器-...

回答 1 投票 0

gst-launch-1.0.exe 与 gst_parse_launch() 之间的不同结果

我有一个如下所示的管道,我将图像数据推送到appsrc中。当我使用gst-launch-1.0.exe播放该管道的图像时,图像很好,但是当我使用

回答 1 投票 0

Yocto gcc gstreamer glibconfig.h 未找到

我正在尝试使用 gstreamer 构建一个简单的单文件 .c 应用程序,将 .mp4 文件流式传输到视频设备。该文件在我的机器上编译并运行良好,但是当使用 BitB 在 Yocto 中编译时...

回答 1 投票 0

Yocto gcc pkg-config 未找到

我正在尝试使用 gstreamer 构建一个简单的单文件 .c 应用程序,将 .mp4 文件流式传输到视频设备。该文件在我的机器上编译并运行良好,但是当使用 BitB 在 Yocto 中编译时...

回答 1 投票 0

如何将 GStreamer 缓冲区时间戳与 Linux 系统时钟相关联

我正在使用 GStreamer-1.0 管道(除其他外)通过 v4l2src 元素从摄像机读取实时视频,并将数据输入 appsink 元素。我们执行一些图像处理...

回答 2 投票 0

如何防止Gstream get_buffer()在rtsp断开连接时卡住?

我在Python中使用Gstream时遇到问题,我尝试制作RTSP侦听器的POC。 我尝试保护我的代码。我现在遇到的问题就像一堵墙:D 我无法打破它。 当我使用 get_buffer() 并且 RTSP 是...

回答 1 投票 0

filesink 是否将 GstMeta 存储到文件中?

我正在尝试使用c中的GStreamer将元数据添加到某些录音中,然后将录音与元数据一起读回。 为此,我正在实施 GstMeta。我从 t 复制了确切的示例...

回答 1 投票 0

带有 GigE 相机的 gstreamer 管道

我有一个 Imperx GigE Vision 相机,我正在尝试创建一个简单的管道来侦听其 UDP 端口并显示视频流,但图像无法正确显示。我确认了...

回答 1 投票 0

确保gstreamer接收器元素中的EOS

BLUF:我需要知道接收器元素何时完成处理 EOS 信号。 我有一个动态管道,其中视频数据流到 T 型连接器,该连接器将视频扇出到不同的文件。 该...

回答 1 投票 0

使用 rtsp 协议从 isp 摄像机进行流式传输。我收到来自客户端 VLC 应用程序的错误

需要帮助以使用 rtps 协议通过以太网流式传输 isp 摄像机。我有下面列出的代码。 问题:我无法使用 vlc 应用程序观看来自客户端的流 来源 = Gst.ElementFactor...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.