5

我是使用 gstreamer 的新手。我想将 C920 网络摄像头中的视频和音频流式传输到另一台 PC,但在组合时总是出错..

我现在可以使用以下命令将 H264 视频从 C920 流式传输到另一台 PC:

gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-h264,width=1280,height=720,framerate=30/1 ! h264parse ! rtph264pay pt=127 config-interval=4 ! udpsink host=172.19.3.103

并通过以下方式查看:

gst-launch-1.0 udpsrc port=1234 ! application/x-rtp, payload=127 ! rtph264depay ! avdec_h264 ! xvimagesink sync=false

我还可以从 C920 获取音频并将其与测试图像一起记录到文件中:

gst-launch videotestsrc ! videorate ! video/x-raw-yuv,framerate=5/1 ! queue ! theoraenc ! queue ! mux. pulsesrc device="alsa_input.usb-046d_HD_Pro_Webcam_C920_F1894590-02-C920.analog-stereo" ! audio/x-raw-int,rate=48000,channels=2,depth=16 ! queue ! audioconvert ! queue ! vorbisenc ! queue ! mux. oggmux name=mux ! filesink location=stream.ogv

但我试图让这样的东西(下)工作..这个不工作,大概它甚至是我做的一个非常糟糕的组合!

gst-launch v4l2src device=/dev/video1 ! video/x-h264,width=1280,height=720,framerate=30/1 ! queue ! mux. pulsesrc device="alsa_input.usb-046d_HD_Pro_Webcam_C920_F1894590-02-C920.analog-stereo" ! audio/x-raw-int,rate=48000,channels=2,depth=16 ! queue ! audioconvert ! queue ! x264enc ! queue ! udpsink host=127.0.0.1 port=1234

4

1 回答 1

1

在将视频链接到多路复用器之前,您应该对视频进行编码。此外,我没有看到您声明您正在使用的多路复用器类型,并且您没有将音频放入多路复用器中。

我不确定是否可以在 gstreamer 中以这种方式通过相同的 rtp 流发送音频和视频。我知道gstreamer中的rtsp 服务器实现允许音频和视频一起使用,但即使在其中,我也不确定它是否仍然是两个流,只是从实现中抽象出来。

您可能只想使用 分隔流并将它们传递给gstrtpbin 元素

于 2014-05-12T13:34:26.957 回答