使用 gstreamer 在 android phone 中流式传输网络内容

Streaming Network content in android phone using gstreamer

我是 Gstreamer 的新手。我正在尝试使用 gstreamer 进行网络流式传输。我可以使用下面的 gst 命令来实现。它对我来说很好用。

在发射机上:gst-launch-1.0 -v filesrc location=/home/user/Downloads/big_buck_bunny_480p_h264.mov !解码箱! x264编码! rtph264支付! udpsink 主机=127.0.0.1 端口=5000

接收端:gst-launch-1.0 -v udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay !解码箱!视频转换!自动视频接收器

在这里,我使用同一台 Ubuntu PC 来传输和接收视频。

但现在我想在 android phone 而不是 ubuntu PC 上播放收到的视频。 我的意思是 ubuntu PC 应作为发送器,Android phone 作为接收器。有什么办法可以实现吗?

android phone 已连接到网络 10.xx.yy.zz。 (Android phone 和 Ubuntu PC 在同一局域网中)所以我将发射器上的 udpsink 主机更改为 10.xx.yy.zz 。现在我期待视频在 android 设备上播放。但它没有。我在发射器和接收器端收到以下日志消息

在发射端: /GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0.GstPad:sink: caps = video/x-h264, codec_data=(buffer)0164001effe1001a6764001eacd940d83de6f011000003000100000300308f162d9601000568ebecb22=c, 流-字符串格式=c, 流-字符串格式=c, au, level=(string)3, profile=(string)high, width=(int)854, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)24/ 1个 /GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0: 时间戳 = 456403579 /GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0:seqnum = 50171 管道是 PREROLLED ... 将管道设置为 PLAYING ... 新时钟:GstSystemClock

接收方: (string)H264, payload=(int)96" !rtph264depay !decodebin !videoconvert !auto​​videosink 将管道设置为 PAUSED ... /GstPipeline:pipeline0/GstUDPSrc:udpsrc0.GstPad:src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264,有效载荷=(整数)96 /GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264,有效载荷=(整数)96 管道是实时的,不需要 PREROLL ... 将管道设置为 PLAYING ... 新时钟:GstSystemClock

请帮忙。提前致谢。

对于 android 你可以为此使用 vlc.. 也许你需要这个流的 sdp 文件,就像这个问题 - check comments 一样。

或者你可以在没有 sdp 的情况下通过使用 mpegtsmux 来做到这一点,就像在 答案中一样.. 在 vlc 上你会使用 "Open live stream" 并放在那里 udp://@:5000 (其中 5000是您在发送管道中使用的端口)

关于 IP 问题 - 如果它与 Ubuntu PC 在同一个 LAN 上,是的,它会起作用(如果不编辑您的问题,请提供详细信息)。

您可以尝试使用另一台 PC(而不是 android)和 vlc - 使用我上面描述的 mpegtsmux。