ffmpeg 常用命令

提取视频(去音频)

cmdLine='ffmpeg -i temp.mp4 -vcodec copy -an mav.mp4'
returnCmd = subprocess.call(cmdLine, shell=True)
print(returnCmd)

提取音频(aac m4a)

cmdLine='ffmpeg -i temp.mp4 -acodec copy -vn temp.m4a'
returnCmd = subprocess.call(cmdLine, shell=True)
print(returnCmd)

转mp3格式

cmdLine='ffmpeg -i temp.m4a temp.mp3 -y'
returnCmd = subprocess.call(cmdLine, shell=True)
print(returnCmd)

或者直接提取mp3

cmdLine='ffmpeg -i temp.mp4 temp.mp3 -y'
returnCmd = subprocess.call(cmdLine, shell=True)
print(returnCmd)

然后发现mp3格式的音频时长对不上

你可能感兴趣的:(ffmpeg 常用命令)