コード例 #1
0
def convertmedia(src, dst, opts):
    """
    read src file, convert format to dst file
    format detail is set in opts
    """

    cline = _makeffmpegcmd(src, dst, opts)
    print(cline)
    handle = runcmd.CmdHandler(runcmd._runcmdunsafe(cline), stdout = False, stderr = True)
    return handle
コード例 #2
0
def getinfo(fname):
    """
    get media files info
    """
    fpath = os.path.abspath(fname);
    if not os.path.isfile(fpath):
        raise Exception("%s is not a valid file"%(fpath))

    fprobe = "ffprobe %s"%(fpath.replace(' ',r'\ '))
    #pro, s_in, s_err = _runcmd(fprobe)
    handle = runcmd.CmdHandler(runcmd._runcmdunsafe(fprobe),
                                stdout = False,
                                stderr = False)
    handle.wait()
    return _getmediainfo(handle.stderr)