ffmpeg视频格式转换

import os

mp4_dir_path = r'F:\2023_02_21\du_zhan\转换视频\mp4'
gp3_dir_path = r'F:\2023_02_21\du_zhan\转换视频\3gp'
for f in os.listdir(mp4_dir_path):
    mp4_full_path = os.path.join(mp4_dir_path,f)
    gp3_full_path = os.path.join(gp3_dir_path,f.split('.mp4')[0]+'.3gp')

    #query = 'ffmpeg -i {} -s 720x1280 -r 29.97 -vcodec h264 -maxrate 1500k -profile:v baseline -level 3.1 -acodec amr_wb -sample_fmt s16 -b:a 23850 -ac 1 -ar 16000 {}'.format(mp4_full_path,gp3_full_path)
    query = 'ffmpeg -i {} -s 720x1280 -r 29.97 -vcodec h264 -maxrate 1500k -profile:v baseline -level 3.1 -acodec amr_wb -ab 23850 -ac 1 -ar 16000 {}'.format(mp4_full_path,gp3_full_path)
                            # 分辨率    视频帧率   #视频编码格式   #最大码率阈值  #设置音视频的profile  #设置音视频的level #音频编解码  #音频码率  #单声道 #音频采样率
    os.popen(query).read()
    print(f)

 

ffmpeg使用说明:
https://blog.csdn.net/weixin_42081389/article/details/100543007
https://mp.weixin.qq.com/s?__biz=Mzg3OTE1NTA2OA==&mid=2247486246&idx=1&sn=3f5e779837927e68b12627846618ec04&chksm=cf098935f87e0023becaba0193c016d76a3e9b9924624cf91bee2accd57ae511ebe68cc69492&scene=27
https://baijiahao.baidu.com/s?id=1725544318667149343&wfr=spider&for=pc

 

ffmpeg参考资料

链接:https://caiyun.139.com/m/i?0Y5CsLjkEiBCh
提取码:RpB4
复制内容打开移动云盘PC客户端,操作更方便哦

posted @ 2023-02-27 09:39  lvye001  阅读(136)  评论(0编辑  收藏  举报