次のパイプラインは、Gstreamer-1.0 を使用して複数のストリームを同時に再生する方法を示しています。
- 解像度 4k の 2 つの同時インスタンス:
gst-launch-1.0 v4l2src device=/dev/video0 io-mode=4 ! \ video/x-raw, format=NV12, width=3840, height=2160,framerate=30/1 ! \ omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \ target-bitrate=30000 num-slices=8 control-rate=constant \ prefetch-buffer=true low-bandwidth=false \ filler-data=true cpb-size=1000 initial-delay=500 periodicity-idr=60 ! \ video/x-h265, profile=main, alignment=au ! queue ! \ mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! \ udpsink host=192.168.25.89 port=5004
gst-launch-1.0 v4l2src device=/dev/video1 io-mode=4 ! \ video/x-raw, format=NV12, width=3840, height=2160, framerate=30/1 ! \ omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \ target-bitrate=30000 num-slices=8 control-rate=constant \ prefetch-buffer=true low-bandwidth=false filler-data=true \ cpb-size=1000 initial-delay=500 periodicity-idr=60 ! \ video/x-h265, profile=main, alignment=au ! queue ! \ mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! \ udpsink host=192.168.25.89 port=5008
この例では、解像度 4k の 2 つのインスタンスをストリーム出力します。最大ビットレートは 30Mb/s および 30fps です。ビデオのエンコード フォーマットは H265 です。
注記:- 利用可能な任意のデバイスを入力デバイスとできます。上記の例では、video0 と video1 の 2 つの入力デバイスを使用しています。
- 複数のインスタンスを実行する場合は、パイプラインの最後に「
&
」を追加して、パイプラインをバックグラウンドで実行することを推奨します。 - 両方のビデオ ストリームを正しくストリーム出力するには、同じホスト デバイスで 2 つの異なるポート (port=5004 と port=5008) を使用してください。
- 解像度 1080p60 の 4 つの同時インスタンス:
gst-launch-1.0 v4l2src device=/dev/video0 io-mode=4 ! \ video/x-raw, format=NV12, width=1920, height=1080, framerate=60/1 ! \ omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \ target-bitrate=15000 num-slices=8 control-rate=constant \ prefetch-buffer=true low-bandwidth=false filler-data=true \ cpb-size=1000 initial-delay=500 periodicity-idr=60 ! \ video/x-h265, profile=main, alignment=au ! queue ! \ mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! \ udpsink host=192.168.25.89 port=5004
gst-launch-1.0 v4l2src device=/dev/video1 io-mode=4 ! \ video/x-raw, format=NV12, width=1920, height=1080, framerate=60/1 ! \ omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \ target-bitrate=15000 num-slices=8 control-rate=constant \ prefetch-buffer=true low-bandwidth=false filler-data=true \ cpb-size=1000 initial-delay=500 periodicity-idr=60 ! \ video/x-h265, profile=main, alignment=au ! queue ! \ mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! \ udpsink host=192.168.25.89 port=5008
gst-launch-1.0 v4l2src device=/dev/video2io-mode=4 ! \ video/x-raw, format=NV12, width=1920, height=1080, framerate=60/1 ! \ omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \ target-bitrate=15000 num-slices=8 control-rate=constant \ prefetch-buffer=true low-bandwidth=false filler-data=true \ cpb-size=1000 initial-delay=500 periodicity-idr=60 ! \ video/x-h265, profile=main, alignment=au ! queue ! \ mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! \ udpsink host=192.168.25.89 port=5012
gst-launch-1.0 v4l2src device=/dev/video3io-mode=4 ! \ video/x-raw, format=NV12, width=1920, height=1080, framerate=60/1 ! \ omxh265enc qp-mode=auto gop-mode=basic gop-length=60 b-frames=0 \ target-bitrate=15000 num-slices=8 control-rate=constant \ prefetch-buffer=truelow-bandwidth=false filler-data=true \ cpb-size=1000 initial-delay=500 periodicity-idr=60 ! \ video/x-h265, profile=main, alignment=au ! queue ! \ mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! \ udpsink host=192.168.25.89 port=5016
この例では、解像度 1080p の 4 つのインスタンスをストリーム出力できます。最大ビットレートは 15Mb/s および 60fps です。ビデオのエンコード フォーマットは H265 です。
注記:- 利用可能な任意のデバイスを入力デバイスとできます。上記の例では、video0、video1、video2、video3 の 4 つの入力デバイスを使用しています。
- 複数のインスタンスを実行する場合は、パイプラインの最後に「
&
」を追加して、パイプラインをバックグラウンドで実行することを推奨します。 - 4 つのビデオ ストリームをすべて正しくストリーム出力するには、同じホスト デバイスで 4 つの異なるポート (5004、5008、5012、および 5016) を使用してください。