發送EOS管道gstreamer

發送EOS管道gstreamer

我有一個 gstreamer 管道範例:gst-launch-1.0 v4l2src device=/dev/video2 ! image/jpeg,width=1280, height=800, framerate=30/1 ! v4l2jpegdec ! queue ! v4l2h264enc extra-controls="controls, h264_profile=4, video_bitrate=620000" ! 'video/x-h264, profile=high, level=(string)4' ! h264parse ! matroskamux ! filesink location=output2.mkv

我從命令行運行它。我不想使用 ctrl+c 來終止進程,而是想向進程發送 EOS 事件。

這可能嗎?如果是這樣,有人這樣做過或解決方案是什麼?

答案1

我找不到辦法做到這一點,但我添加watchdog timeout=1000到管道並斷開視訊輸入,然後看門狗終止串流並生成 EOS。-e我的命令末尾還有一個以確保視訊檔案正確關閉:

 gst-launch-1.0.exe rtspsrc location=rtsp://192.168.189.3:8554/bandwidth_h264 latency=0 ! decodebin ! watchdog timeout=1000 ! tee name=split split.! queue leaky=1 ! autovideosink sync=false split.! queue leaky=1 ! videoconvert ! x264enc ! mp4mux ! filesink location=c:/demo/test.mp4 -e

相關內容