简体   繁体   English

如何将python中的async = false添加到Gstreamer splitmuxsink元素音频/视频/ H264组合

[英]How do I add async=false in python to a Gstreamer splitmuxsink element Audio/video/H264 combined

Gstreamer 1.8.2 installed on an embedded device using a C920. 使用C920将Gstreamer 1.8.2安装在嵌入式设备上。 Debian linux. Debian Linux。 I have a nice Gstreamer pipeline that uses the new splitmuxsink and almost works. 我有一个不错的Gstreamer管道,它使用新的splitmuxsink并几乎可以工作。 I do have splitmuxsink working on a 'basic pipeline' nicely. 我确实让splitmuxsink很好地在“基本管道”上工作。

The first pipeline works and writes one long file mp4, audio and video and at the same time passes a preview jpeg stream to a separately handled appsink which works. 第一个管道工作并写入一个长文件mp4,音频和视频,并同时将jpeg预览流传递到一个单独处理的appink,该工作将生效。 Hope this is useful in any case for someone. 希望这对任何人都有用。

    self.pipeline=Gst.parse_launch('uvch264src auto-start=true iframe-period=1000 name=src1 src1.vfsrc ! queue  ! appsink drop=true name=asink max-buffers=2 emit-signals=true sync=false src1.vidsrc ! video/x-h264,width=1280,height=720,framerate=30/1,stream-format=byte-stream ! queue ! h264parse ! muxout.video_0   alsasrc do-timestamp=true device="plughw:CARD=C920,DEV=0" ! audio/x-raw,format=S16LE,rate=32000,depth=16,channels=1 ! queue ! voaacenc ! queue ! aacparse ! muxout.audio_0 mp4mux name=muxout ! filesink sync=false location=%s' % location1)

But when I convert the filesink to a 'splitmuxsink', it only creates previews, and does not start the file recording side of the stream. 但是,当我将文件接收器转换为“ splitmuxsink”时,它仅创建预览,而不启动流的文件记录端。 I do not know how (programmatically in Python) to set the attributes of splitmuxsink to replicate the sync=false that I am doing on the filesink plugin. 我不知道如何(以编程方式在Python中)设置splitmuxsink的属性来复制我在filesink插件上所做的sync = false。 Do I attach to a pad on splitmuxsink, or somehow setup the sink=xxx label and get_static_pad or element to then adjust the properties of that 'child' element? 我是否要附加到splitmuxsink上的焊盘上,还是以某种方式设置接收器= xxx标签和get_static_pad或元素,然后调整该“子”元素的属性? I believe this problem is what is causing the file splitting part of the pipeline to fail. 我相信此问题是导致管道的文件拆分部分失败的原因。 I am looking for something like: How to resume playing after paused using gstreamer? 我正在寻找类似的东西: 使用gstreamer暂停后如何继续播放? based on this answer: gstreamer pipeline with VADER element stalls on PAUSE when used with a tee 基于以下答案: 与T形支架一起使用时,带有VADER元素的gstreamer管道停在PAUSE上

Pipeline v2 (runs the appsink side, but splitmuxsink stays paused) 管道v2(运行appsink端,但splitmuxsink保持暂停状态)

    self.pipeline=Gst.parse_launch('uvch264src auto-start=true async-handling=false message-forward=true iframe-period=1000 name=src1 src1.vfsrc ! queue  ! appsink drop=true name=asink max-buffers=200 emit-signals=true sync=true src1.vidsrc ! video/x-h264,width=1280,height=720,framerate=30/1,stream-format=byte-stream ! queue  ! h264parse ! queue ! splitmuxsink max-size-time=20000000000 max-size-bytes=5000000 name=muxout location=video2%05d.mp4  alsasrc do-timestamp=true device="plughw:CARD=C920,DEV=0" ! audio/x-raw,forma=S16LE,rate=32000,depth=16,channels=1 ! queue ! voaacenc ! queue ! aacparse ! muxout.audio_0 

As you can see, pipeline v2 has no explicit reference to sync=false as splitmuxsink does not have that property. 如您所见,管道v2没有对sync = false的明确引用,因为splitmuxsink没有该属性。 And so that side does not start after PAUSED. 因此暂停后该侧将不会开始。

I am sure this is just going to be a tiny adjustment to create the right label and set its attributes after my 我确信这只是一个小小的调整,可以创建正确的标签并在我之后设置其属性

    self.muxp = self.pipeline.get_by_name('muxout')

to set the child element to async false, but I just can't see it - the muxout element (my label for splitmuxsink) does not have an async property. 将子元素设置为异步false,但是我看不到-muxout元素(我的splitmuxsink标签)没有async属性。

After correspondence with development team, I was told there was a bug in split muxsink which the developer corrected in 1.8.3. 与开发团队通信后,我被告知开发人员在1.8.3中纠正了分割muxsink中的错误。 An update to 1.8.3 solved the issue. 1.8.3的更新解决了该问题。

I think that one of the problems can be the format of SINK pad of mp4mux. 我认为问题之一可能是mp4mux的SINK pad的格式。 splitmuxsink consists of mp4mux and filesink in the default configuration. splitmuxsink包括在默认配置mp4mux文件接收的。 In your pipeline you produce H264 with stream-format=byte-stream parameter, however, mp4mux expects only stream-format=avc . 在您的管道中,您生成带有stream-format = byte-stream参数的H264,但是, mp4mux期望仅使用stream-format = avc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM