完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
因为我需要使用 Gstreamer 通过 IP 流式传输本地存储的视频,并在 VLC 播放器中接收流式视频。
我正在使用 IMX6Q-SL EVK 板 代码编译和执行没有任何错误。但没有显示任何输出,也没有传输任何数据包。 请帮助我解决问题。代码参考如下。 由于我是处理器的新手,请耐心等待我的知识。 #include int main(int argc, char *argv[]) { GstElement *pipeline, *source, *decode, *convert, *scale, *encoder, *pay, *sink; GstCaps *filtercaps; GstBus *bus; GstMessage *msg; GMainLoop *loop; // Initialize GStreamer gst_init(&argc, &argv); gst_debug_set_threshold_for_name("x264enc", GST_LEVEL_LOG); // Create the pipeline pipeline = gst_pipeline_new("my-pipeline"); // Create the source element for reading the video frames from a local file source = gst_element_factory_make("filesrc", "source"); g_object_set(G_OBJECT(source), "location", "Video.mp4", NULL); // set the path to the video file as needed // Create the decode element for decoding the video decode = gst_element_factory_make("decodebin", "decode"); // Create the convert element for converting the video format convert = gst_element_factory_make("videoconvert", "convert"); // Create the scale element for resizing the video scale = gst_element_factory_make("videoscale", "scale"); g_object_set(G_OBJECT(scale), "method", 0, NULL); g_object_set(G_OBJECT(scale), "add-borders", FALSE, NULL); g_object_set(G_OBJECT(scale), "skip-canvas", TRUE, NULL); // Create the encoder element for encoding the video with H.264 encoder = gst_element_factory_make("x264enc", "encoder"); g_object_set(G_OBJECT(encoder), "tune", 5, NULL); // set encoding parameters as needed // Create the pay element for packaging the encoded video into RTP packets pay = gst_element_factory_make("rtph264pay", "pay"); // Create the sink element for sending the RTP packets over UDP sink = gst_element_factory_make("udpsink", "sink"); g_object_set(G_OBJECT(sink), "host", "192.168.100.232", NULL); // set receiver IP address g_object_set(G_OBJECT(sink), "port", 554, NULL); // set receiver port number // Add all elements to the pipeline gst_bin_add_many(GST_BIN(pipeline), source, decode, convert, scale, encoder, pay, sink, NULL); // Link the elements together gst_element_link(source, decode); gst_element_link_many(convert, scale, encoder, pay, sink, NULL); // Set the caps filter for the decode element filtercaps = gst_caps_new_simple("video/x-h264", "stream-format", G_TYPE_STRING, "byte-stream", NULL); gst_element_link_filtered(decode, convert, filtercaps); gst_caps_unref(filtercaps); // Start playing the pipeline gst_element_set_state(pipeline, GST_STATE_PLAYING); // Wait for completion or error loop = g_main_loop_new(NULL, FALSE); bus = gst_element_get_bus(pipeline); msg = gst_bus_timed_pop_filtered(bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR); # if (msg != NULL) { gst_message_unref(msg); } gst_object_unref(bus); gst_element_set_state(pipeline, GST_STATE_NULL); gst_object_unref(pipeline); g_main_loop_unref(loop); return 0; } 使用下面的 bash 编译程序 g++ -o Stream Stream_Local.cpp `pkg-config --cflags --libs gstreamer-1.0 gstreamer-app-1.0` |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
1934个成员聚集在这个小组
加入小组我的项目我做主,使用GN+Ninja来完成构建系统(VSCode开发RT106X)
36421 浏览 0 评论
NXP IMX8应用处理器快速入门必备:技巧、使用、设计指南
4918 浏览 1 评论
6109 浏览 1 评论
6819 浏览 0 评论
NXP i.MX6UL开发板(linux系统烧录+规格+硬件+模块移植)使用手册
4249 浏览 0 评论
650浏览 2评论
求助,S32G上Core M启动后如何让Core A在Flash指定位置加载uboot?
645浏览 2评论
ESP32-WROVER-IE + LAN8720以太网,GPIO0电压只有1.6v,无法正常进入spi flash boot模式如何解决?
646浏览 2评论
求分享适用于PN7160 Android的NFC工厂测试应用程序
733浏览 2评论
846浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-25 13:48 , Processed in 0.971298 second(s), Total 44, Slave 38 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号