我正在尝试将视频从 android 手机流式传输到我的笔记本电脑。我运行了 gstreamer,它工作正常。我的问题是以下代码:
[....]
pipeline = gst.parse_launch('rtspsrc name=source latency=0 ! decodebin ! autovideosink')
source = pipeline.get_by_name('source')
source.props.location = "rtsp://128.237.119.100:8086/"
decoder = gst.element_factory_make("decodebin", "decoder")
sink = gst.element_factory_make("autovideosink", "sink")
pipeline.add(source, decoder, sink)
gst.element_link_many(source, decoder, sink)
[...]
运行时出现此错误:
(server.py:2893): GStreamer-WARNING **: Name 'source' is not unique in bin 'pipeline0', not adding
Traceback (most recent call last):
File "server.py", line 27, in <module>
py = pyserver()
File "server.py", line 18, in __init__
pipeline.add(source, decoder, sink)
gst.AddError: Could not add element 'source'
我是 gstreamer 的新手。我已经参考了这个问题来编写代码:Playing RTSP with python-gstreamer
谁能指出我做错了什么?为什么我会收到 adderror?