【问题标题】:Convert video stream format转换视频流格式
【发布时间】:2022-11-23 05:07:36
【问题描述】:

如何使用 python 将 H.265 视频流格式转换为 H.264? 我不知道如何执行约定 我必须在 Windows 上通过基于 python 的 gstreamer 执行它 谢谢

【问题讨论】:

    标签: video


    【解决方案1】:

    类似的东西作为一个例子

    import gi
    gi.require_version('Gst', '1.0')
    from gi.repository import Gst
    
    Gst.init(None)
    pipeline = Gst.parse_launch("filesrc location=test.m4v ! decodebin ! video/x-raw ! x264enc ! mp4mux ! filesink location=output.mp4")
    pipeline.set_state(Gst.State.PLAYING)
    bus = pipeline.get_bus()
    bus = pipeline.get_bus()
    msg = bus.timed_pop_filtered(
        Gst.CLOCK_TIME_NONE,
        Gst.MessageType.ERROR | Gst.MessageType.EOS
    )
    
    if msg:
        t = msg.type
        if t == Gst.MessageType.ERROR:
            err, dbg = msg.parse_error()
            print("ERROR:", msg.src.get_name(), " ", err.message)
            if dbg:
                print("debugging info:", dbg)
        elif t == Gst.MessageType.EOS:
            print("End-Of-Stream reached")
        else:
            # this should not happen. we only asked for ERROR and EOS
            print("ERROR: Unexpected message received.")
    
    pipeline.set_state(Gst.State.NULL)
    

    此致

    【讨论】:

      猜你喜欢
      • 2010-10-22
      • 2010-12-07
      • 2018-08-20
      • 2011-01-12
      • 2010-10-30
      • 2015-02-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多