gstreamer-1.0,RTSP H264流和共享内存

时间:2018-03-07 07:20:15

标签: gstreamer gstreamer-1.0

我正在尝试在共享内存中编写RTSP流,然后将其写入.mkv文件。

我使用此命令直接在.mkv文件中写入流:

gst-launch-1.0 rtspsrc location=rtsp://admin:admin@192.168.88.248:554/h264 ! shmsink socket-path=/tmp/foo shm-size=2000000

有效。

现在我添加共享内存:

gst-launch-1.0 shmsrc socket-path=/tmp/foo ! rtph264depay ! h264parse ! matroskamux ! filesink location=file.mkv

gst-launch-1.0 rtspsrc location=rtsp://admin:admin@192.168.88.248:554/h264 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" ! shmsink socket-path=/tmp/foo shm-size=2000000

我收到消息:

  

输入缓冲区需要设置RTP上限。

好的,我写了

URL.createObjectURL

我又收到了这条消息。

我做错了什么?

1 个答案:

答案 0 :(得分:0)

您需要在shmsrc之后设置大写字母,例如以下是我的接收管道:

  

gst-launch-1.0 -v rtspsrc   location = rtsp://192.168.1.150:8554 / VBoxVideo! shmsink   socket-path = / tmp / foo shm-size = 2000000 wait-for-connection = false

你必须记下上面shmsink的大写字母,以下是我的shmsink大写字母:

  

/GstPipeline:pipeline0/GstShmSink:shmsink0.GstPad:sink:caps =   " application / x-rtp \,\ media \ =(string)video \,\ payload \ =(int)96 \,\   clock-rate \ =(int)90000 \,\ encoding-name \ =(string)H264 \,\   分组模式\ =(字符串)1 \,\   简档级-ID \ =(字符串)64002a \,\   sprop-参数集\ =(字符串)\" J2QAKqwbKgHgCJ + WEAAAPoAADqYOAAEZABGQve6wgA \\ = \\ = \\,KP4Briw \\ = \" \,\   a-tool \ =(字符串)GStreamer \,\ a-type \ =(字符串)广播\,\   a-framerate \ =(string)30 \,\ a-ts-refclk \ =(string)local \,\   a-mediaclk \ =(字符串)sender \,\ ssrc \ =(uint)4083957277 \,\   clock-base \ =(uint)1018840792 \,\ seqnum-base \ =(uint)13685 \,\   npt-start \ =(guint64)0 \,\ play-speed \ =(double)1 \,\   玩规模\ =(双)1"

现在,使用shmsrc,

  

gst-launch-1.0 -vm shmsrc socket-path = / tmp / foo do-timestamp = true is-live = true   num-buffers = 1000!   "应用程序/ x-RTP,媒体=(字符串)视频,有效载荷=(INT)96,分组模式=(字符串)1" ! rtph264depay! h264parse! mp4mux! filesink location = file.mp4

注意:我已经设置了上面的大写,还注意我已经设置了um-buffers = 1000,因为我正在使用mp4mux,我需要发送和eos才能播放该文件。

所以在你的情况下:

gst-launch-1.0 -v rtspsrc location=rtsp://admin:admin@192.168.88.248:554/h264 ! shmsink socket-path=/tmp/foo shm-size=2000000

记下shmsink0管道的大写字母,稍后在管道中使用它:

gst-launch-1.0 shmsrc socket-path=/tmp/foo is-live=true num-buffers=1000 ! caps ! rtph264depay ! h264parse ! mp4mux ! filesink location=file.mp4
相关问题