是否可以使用共享内存跨 gstreamer 管道共享编码视频?

问题描述 投票:0回答:0

我正在寻找创建一个短暂的 gstreamer 管道来使用另一个独立的长期管道生成的编码视频流。

目的是定期连接到主管道,抓取一些视频并将其保存到文件中。

我正在尝试使用共享内存接收器(

shmsink
)和源(
shmsrc
)来实现这一点。我的管道目前看起来像这样(为清楚起见进行了简化):

# Primary (producer)
gst-launch-1.0 -e \
videotestsrc ! 'video/x-raw,width=1920,height=1080,framerate=30/1' \
! videoconvert \
! x265enc ! 'video/x-h265,profile=main' \
! h265parse \
! shmsink socket-path=/tmp/foo shm-size=2000000 wait-for-connection=false sync=true

# Secondary (consumer)
gst-launch-1.0 -e \
shmsrc socket-path=/tmp/foo do-timestamp=true is-live=true \
! 'video/x-h265,profile=main,width=1280,height=1080,framerate=30/1' \
! h265parse \
! mp4mux \
! filesink location=output.mp4

这两个都运行无误,但 output.mp4 始终为零字节。

这两个管道有问题吗?使用共享内存共享 h265 编码视频的想法有缺陷吗?

gstreamer video-capture
© www.soinside.com 2019 - 2024. All rights reserved.