python将h264文件视频转为mp4格式


import os


def h264ToMp4(sourcePath, tagPath):
    cmd = 'ffmpeg -f h264 -i ' + sourcePath + ' -vcodec copy ' + tagPath
    print(">>cmd:\n %s" % (cmd))
    result = os.popen(cmd).read().strip()
    print(">>result :", result)

for i in os.listdir("1"):
    re=i.split(".")[0]+".mp4"
    source=os.path.join("1",i)
    h264ToMp4(source,re)

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM