简体   繁体   English

如何用gstreamer流H264?

[英]How to stream H264 with gstreamer?

I need to stream my screen in fullHD, to my android phone with gstreamer, using H264. 我需要使用H264将我的屏幕全部流式传输到带有gstreamer的Android手机。 I'm using gst launch remote on Android and gst-launch on linux. 我在Android上使用gst launch remote ,在linux上使用gst gst-launch

I'm starting with gstreamer, I managed to do basic stream following this tutorial , but anything a bit different from the examples crashes on various ways. 我从gstreamer开始,我设法按照本教程做基本流,但是与示例有所不同的是以各种方式崩溃。

My basic pipeline is: 我的基本管道是:

ximagesrc use-damage=false xname=/usr/lib/torcs/torcs-bin ! videoconvert ! x264enc tune=zerolatency ! rtph264pay ! udpsink host=192.168.0.100 port=5000

And: 和:

udpsrc port=5000 caps=$CAPS ! rtph264depay ! avdec_h264 ! autovideosink

I tied to copy the caps from the first pipeline (all or multiple combinations of isolated parameters) to $CAPS but didn't work. 我绑定从第一个管道(所有或多个孤立参数的组合)的帽子复制到$CAPS但没有工作。

With

caps="video/x-h264\,\ codec_data\=\(buffer\)01f40028ffe1001a67f400289196401e0089f89c0440000003004000000ca3c60c9201000668ebcc448440\,\ stream-format\=\(string\)avc\,\ alignment\=\(string\)au\,\ level\=\(string\)4\,\ profile\=\(string\)high-4:4:4\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ framerate\=\(fraction\)25/1"

the pipeline isn't constructed, the only error is: 管道没有构造,唯一的错误是:

WARNING: erroneous pipeline: could not link udpsrc0 to rtph264depay0

Or with caps 或带帽

application/x-rtp\,\ media\=\(string\)video\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)H264\,\ packetization-mode\=\(string\)1\,\ payload\=\(int\)96\,\ a-framerate\=\(string\)25

The error is: 错误是:

ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: Internal data flow error.

Error message witout caps: 带帽的错误消息:

Setting pipeline to PAUSED ...
libva info: VA-API version 0.39.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Pipeline is live and does not need PREROLL ...
Got context from element 'autovideosink0': gst.vaapi.Display=context, gst.vaapi.Display=(GstVaapiDisplay)NULL;
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0: No RTP format was negotiated.
Additional debug info:
gstrtpbasedepayload.c(484): gst_rtp_base_depayload_handle_buffer (): /GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0:
Input buffers need to have RTP caps set on them. This is usually achieved by setting the 'caps' property of the upstream source element (often udpsrc or appsrc), or by putting a capsfilter element before the depayloader and setting the 'caps' property on that. Also see http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/gst/rtp/README
Execution ended after 0:00:00.006279687
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

Changing the source video from a web solved the caps negotiation issue. 从Web更改源视频解决了大写协商问题。 The final pipeline was: 最后的管道是:

v4l2src ! videoscale ! video/x-raw,width=1600,height=1150 ! x264enc tune=zerolatency ! rtph264pay ! udpsink host=192.168.0.100 port=5000

And: 和:

udpsrc port=5000 caps = "application/x-rtp, media=video, clock-rate=90000, encoding-name=H264, payload=96" ! rtph264depay ! avdec_h264 ! autovideosink

Thought, bigger resolutions are crashing the app. 想到,更大的分辨率正在崩溃应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM