我的解析有什么问题?它未能正确解析opus上限(但不是speex)并导致它不起作用任何人都知道,我必须添加更多\或/或“或”符号以使其成为有效上限?
$ gst-launch-0.10 -v gstrtpbin name=rtpbin latency=100 udpsrc caps="application/x-rtp, media=(string)audio, clock-rate=(int)48000, encoding-name=(string)X-GST-OPUS-DRAFT-SPITTKA-00, caps=(string)\"audio/x-opus\\,\\ multistream\\=\\(boolean\\)false\\,\\ streamheader\\=\\(buffer\\)\\<\\ 4f707573486561640101000080bb0000000000\\,\\ 4f707573546167731e000000456e636f6465642077697468204753747265616d6572204f707573656e63010000001a0000004445534352495054494f4e3d617564696f74657374207761766501\\ \\>\", ssrc=(uint)3090172512, payload=(int)96, clock-base=(uint)4268257583, seqnum-base=(uint)10001" port=5002 ! rtpbin.recv_rtp_sink_1 rtpbin. ! rtpopusdepay ! opusdec ! audioconvert ! audioresample ! alsasink device=2 name=uudpsink0 udpsrc port=5003 ! rtpbin.recv_rtcp_sink_1 rtpbin.send_rtcp_src_1 ! udpsink port=5007 host=%s sync=false async=false
(gst-plugin-scanner:25672): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libgstsimsyn.so': /usr/lib/gstreamer-0.10/libgstsimsyn.so: undefined symbol: gst_controller_sync_values
(gst-plugin-scanner:25672): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libgstaudiodelay.so': /usr/lib/gstreamer-0.10/libgstaudiodelay.so: undefined symbol: gst_base_transform_set_gap_aware
(gst-plugin-scanner:25672): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libgstbml.so': /usr/lib/gstreamer-0.10/libgstbml.so: undefined symbol: gst_base_src_set_format
WARNING: erroneous pipeline: could not set property "caps" in element "udpsrc0" to "application/x-rtp, media=(string)audio, clock-rate=(int)48000, encoding-name=(string)X-GST-OPUS-DRAFT-SPITTKA-00, caps=(string)"audio/x-opus\,\\ multistream\=\(boolean\)false\,\\ streamheader\=\(buffer\)\<\\ 4f707573486561640101000080bb0000000000\,\\ 4f707573546167731e000000456e636f6465642077697468204753747265616d6572204f707573656e63010000001a0000004445534352495054494f4e3d617564696f74657374207761766501\\ \>", ssrc=(uint)3090172512, payload=(int)96, clock-base=(uint)4268257583, seqnum-base=(uint)10001"
答案 0 :(得分:1)
我认为不需要特殊的逃避。如果你的管道是正确的,那么这应该工作:
gst-launch-0.10 -v gstrtpbin name=rtpbin latency=100 udpsrc caps="application/x-rtp, media=(string)audio, clock-rate=(int)48000, encoding-name=(string)X-GST-OPUS-DRAFT-SPITTKA-00, caps=(string)audio/x-opus, multistream=(boolean)false, streamheader=(buffer)<4f707573486561640101000080bb0000000000,4f707573546167731e000000456e636f6465642077697468204753747265616d6572204f707573656e63010000001a0000004445534352495054494f4e3d617564696f74657374207761766501>, ssrc=(uint)3090172512, payload=(int)96, clock-base=(uint)4268257583, seqnum-base=(uint)10001" port=5002 ! rtpbin.recv_rtp_sink_1 rtpbin. ! rtpopusdepay ! opusdec ! audioconvert ! audioresample ! alsasink device=2 name=uudpsink0 udpsrc port=5003 ! rtpbin.recv_rtcp_sink_1 rtpbin.send_rtcp_src_1 ! udpsink port=5007 host=%s sync=false async=false
如果您需要处理bash可以解释的特殊字符,请将caps="..."
更改为caps='...'
。
这是一个笨拙的python版本:
import subprocess
args=[ 'gst-launch-0.10',
'-v',
'gstrtpbin',
'name=rtpbin',
'latency=100',
'udpsrc',
'caps="application/x-rtp, media=(string)audio, clock-rate=(int)48000, encoding-name=(string)X-GST-OPUS-DRAFT-SPITTKA-00, caps=(string)audio/x-opus, multistream=(boolean)false, streamheader=(buffer)<4f707573486561640101000080bb0000000000,4f707573546167731e000000456e636f6465642077697468204753747265616d6572204f707573656e63010000001a0000004445534352495054494f4e3d617564696f74657374207761766501>, ssrc=(uint)3090172512, payload=(int)96, clock-base=(uint)4268257583, seqnum-base=(uint)10001"',
'port=5002',
'!',
'rtpbin.recv_rtp_sink_1',
'rtpbin.',
'!',
'rtpopusdepay',
'!',
'opusdec',
'!',
'audioconvert',
'!',
'audioresample',
'!',
'alsasink',
'device=2',
'name=uudpsink0',
'udpsrc',
'port=5003',
'!',
'rtpbin.recv_rtcp_sink_1',
'rtpbin.send_rtcp_src_1',
'!',
'udpsink',
'port=5007',
'host=%s',
'sync=false',
'async=false',
]
child = subprocess.Popen(args, stdout=subprocess.PIPE)
streamdata = child.communicate()[0] # streamdata will contain output of gst-launch-0.10
rc = child.returncode # rc will contain the returncode of gst-launch-0.10
print streamdata
print "\nprocess returned %d" %(rc)
我认为你最好为gstreamer找到一个好的python模块,而不是使用子进程或类似的。
希望这有帮助!