有没有一种方法可以在python gstreamer mp4mux管道中添加EOS

时间:2019-05-15 14:41:30

标签: python c gstreamer-1.0

我正在运行 rtspsrc filesink 管道。在终端中,我必须输入-e来指示该流的末尾。当我在命令中输入-e时,可以成功播放创建的mp4。

此命令创建的视频将播放:

  

gst-launch-1.0 -e rtspsrc location = rtsp://192.168.1.0:1 / stream! rtph264depay! h264parse! mp4mux! filesink location = file.mp4

但是,当我不使用-e时,创建的视频将无法播放

此命令创建的视频无法播放:

  

gst-launch-1.0 rtspsrc location = rtsp://192.168.1.0:1 / stream! rtph264depay! h264parse! mp4mux! filesink location = file.mp4

问题不是使用命令,而是将python代码写入上述命令。在终端机中,我可以-e指示EOS ,但是如何在python代码中指示EOS

bus = self.pipeline.get_bus()

terminate = False

while True:

 msg = bus.timed_pop_filtered(

      Gst.CLOCK_TIME_NONE,

      Gst.MessageType.STATE_CHANGED | Gst.MessageType.EOS | 

       Gst.MessageType.ERROR

       )
msg_type = msg.type
if msg_type == Gst.MessageType.ERROR:

   error, debug = msg.parse_error()

   print("Error: ", msg.src.get_name(), " ", error.message)

   if debug:

      print("Debugging info", debug)

    terminate = True

elif msg_type == Gst.MessageType.EOS:

   print("End of file reached")

   terminate = True[enter image description here][1]

0 个答案:

没有答案