概述
我有一个你正在寻找的代码的“C”实现.我认为转换为“Python”应该相当简单
//Display RTSP streaming of video
//(c) 2011 enthusiasticgeek
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#include
#include
#include
#include
static gboolean bus_call (GstBus *bus,GstMessage *msg, gpointer data){
GMainLoop *loop = (GMainLoop *) data;
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_EOS:
g_print ("Stream Endsn");
g_main_loop_quit (loop);
break;
case GST_MESSAGE_ERROR: {
gchar *debug;
GError *error;
gst_message_parse_error (msg, &error, &debug);
g_free (debug);
g_printerr ("Error: %sn", error->message);
g_error_free (error);
g_main_loop_quit (loop);
break;
}
default:
break;
}
return TRUE;
}
static void on_pad_added (GstElement *element, GstPad *pad, gpointer data){
GstPad *sinkpad;
GstElement *decoder = (GstElement *) data;
/* We can now link this pad with the rtsp-decoder sink pad */
g_print ("Dynamic pad created, linking source/demuxern");
sinkpad = gst_element_get_static_pad (decoder, "sink");
gst_pad_link (pad, sinkpad);
gst_object_unref (sinkpad);
}
int main (int argc, char *argv[])
{
GMainLoop *loop;
GstBus *bus;
GstElement *source;
GstElement *decoder;
GstElement *sink;
GstElement *pipeline;
GstElement *demux;
GstElement *colorspace;
/* Initializing GStreamer */
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
//gst-launch-0.10 rtspsrc location=rtsp:// ! decodebin ! ffmpegcolorspace ! autovide
最后
以上就是大气爆米花为你收集整理的python 实时rtsp识别,使用python-gstreamer播放RTSP的全部内容,希望文章能够帮你解决python 实时rtsp识别,使用python-gstreamer播放RTSP所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复