【问题标题】:combine two gstreamer pipelines结合两个 gstreamer 管道
【发布时间】:2016-04-11 14:25:20
【问题描述】:

我有 2 个 gstreamer 管道。一个在屏幕上显示从摄像机捕获的缩放实时视频,另一个以原始格式获取视频,并在使用 H264 格式对其进行编码后将其保存到磁盘上的文件中。两条流水线如下;

# Capture and display scaled camera feed
gst-launch-1.0 -v autovideosrc ! videoscale ! video/x-raw, 
width=480,height=270 ! xvimagesink -e --gst-debug-level=3 sync=false

# Save the camera feed in its original format to disk
gst-launch-1.0 -v autovideosrc ! omxh264enc ! 'video/x-h264, 
stream-format=(string)byte-stream' ! h264parse ! qtmux ! filesink 
location=test.mp4 -e

这两个管道自己工作,我想知道如何将它们组合成一个,即在屏幕上显示缩放的视频并将视频以原始格式记录到文件中?

【问题讨论】:

    标签: gstreamer


    【解决方案1】:

    看起来我需要tee 元素。不确定我这样做是否正确,但它似乎有效:

    gst-launch-1.0 -v autovideosrc ! tee name = t ! queue ! omxh264enc ! 
    'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! qtmux ! 
    filesink location=test.mp4 t. ! queue ! videoscale ! video/x-raw, 
    width=480,height=270 ! xvimagesink -e sync=false
    

    【讨论】:

    • 是的,这是正确的方法 :) tee 完全符合您的要求,您的管道看起来正确。您还在 tee 之后使用了队列,这对于将每个分支的处理移动到单独的线程中是必要的(否则分支可能会相互阻塞)。
    • @otopolsky 感谢您的确认!我是 gstreamer 的新手,所以还在学习中!我从其文档示例中重新格式化了管道,但我确定的一件事是为什么我们第二次引用 tee 元素(在第二个队列之前),它被引用到我们 t. (为什么最后是句号?)
    猜你喜欢
    • 1970-01-01
    • 2016-09-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-26
    • 1970-01-01
    相关资源
    最近更新 更多