ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

GStreamer rtsp拉流播放

2021-01-05 15:35:30  阅读:273  来源: 互联网

标签:pipeline GStreamer gst bus rtsp msg 拉流 main GST


使用命令拉流播放测试

gst-launch-1.0 playbin uri=rtsp://172.17.0.8/1.264

正常效果如下:

image

如果报如下错误:

Your GStreamer installation is missing a plug-in. Additional debug info:

解决办法:

sudo apt-get install ubuntu-restricted-extras

代码拉流

#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 ("playbin uri=rtsp://172.17.0.8/1.264", 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;
}

编译:

gcc main.c -o main -Wall $(pkg-config --cflags --libs gstreamer-1.0)

如果报如下错误:

No package 'gstreamer-1.0' found
main.c:1:23: fatal error: gst/gst.h: No such file or directory

解决办法:

sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

正常运行效果同上

./main

本文用到

live555服务器live555MediaServer

标签:pipeline,GStreamer,gst,bus,rtsp,msg,拉流,main,GST
来源: https://www.cnblogs.com/zhangxuechao/p/14236071.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有