Gstreamer x-raw 到 h264 mp4

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

我正在使用的某些软件的文档说使用此 gstreamer 管道从摄像机流式传输视频:

gst-launch-1.0 v4l2src device=/dev/video5 ! video/x-raw ! videoconvert ! v4l2h264enc ! h264parse config-interval=3 ! rtph264pay mtu=1024 ! udpsink host=127.0.0.1 port=5600

如果我想将其调整为管道到 .mp4,我认为这样的东西会起作用:

gst-launch-1.0 v4l2src device=/dev/video5 ! video/x-raw ! videoconvert ! v4l2h264enc ! h264parse config-interval=3 ! filesink location=test.mp4

但生成的文件无法在 vlc 中播放。

我错过了什么?

提前致谢。

gstreamer gstreamer-1.0
1个回答
2
投票

您将使用容器(例如这里的 qtmux):

# For recording 100 frames:
gst-launch-1.0 v4l2src device=/dev/video5 num-buffers=100 ! video/x-raw ! videoconvert ! v4l2h264enc ! h264parse config-interval=3 ! qtmux ! filesink location=test.mp4

# If you want to manually stop with Ctrl-C, add EOS:
gst-launch-1.0 -e v4l2src device=/dev/video5 ! video/x-raw ! videoconvert ! v4l2h264enc ! h264parse config-interval=3 ! qtmux ! filesink location=test.mp4
© www.soinside.com 2019 - 2024. All rights reserved.