猫史档案馆


【Python作品分享】转码工具【教程贴】

用户:lsk666666lsk666666查看:0 回复:1 评论:0 创建时间:2020-06-06T16:37:24


【作品展示】

center_image

 

【作品介绍】

一个基于FFmpeg的超级简单的转码工具。只支持mp4 to mp3(其实可以通过改代码来更改转换模式)

我写他是为了把从在B站上缓存下来的音乐视频转换为MP3来听。

封面图为运行效果。

其中FFmpeg是我自己在我的Ubuntu WSL上编译的,耗时大约2至喵时。pip上应该是没有FFmpeg的python库。

参考:

https://blog.csdn.net/gobitan/article/details/50489339?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineL

 

【作品源代码】

import os
import sys

command1="ffmpeg -i \""
command2="\" -f mp3 -vn \""
command3="\""

for root,dirs,files in os.walk("."):
	for file in files:
		if ".mp4" in file:
			command = command1+file+command2+file.replace(".mp4",".mp3")+command3
			print(command)
			os.system(command)

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
lsk666666lsk666666

搞一下无和谐的参考链接:

https://blog.csdn.net/gobitan/article/details/50489339?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.nonecase

点赞0


评论