使用python将mp4转换为.wav或mp3

2024-03-29 12:51:07 发布

您现在位置:Python中文网/ 问答频道 /正文

有没有人有过将mp4文件转换成.wav或mp3文件的经验?我可以在Linux(bash)中做到这一点,但是我尝试用Python做我在其他语言中做的所有事情,称我为一个爱好者。我一直在查看Pymedia库,但到目前为止还没有取得任何进展。


Tags: 文件bash语言linux经验事情mp3mp4
2条回答

你可能会发现python audio tools有些用处。它们是从命令行设计的,但是作为python代码,您可以简单地导入模块并将其集成到另一个程序中。这是API documentation。从“关于”页:

Python Audio Tools are a collection of audio handling programs which work from the command line. These include programs for CD extraction, track conversion from one audio format to another, track renaming and retagging, track identification, CD burning from tracks, and more. Supports internationalized track filenames and metadata using Unicode. Works with high-definition, multi-channel audio as well as CD-quality. Track conversion uses multiple CPUs or CPU cores if available to greatly speed the transcoding process. Track metadata can be retrieved from FreeDB, MusicBrainz or compatible servers.

您可以对GStreamer使用Python绑定,并创建一个管道来执行转换:

更多信息请点击此处:

http://pygstdocs.berlios.de/pygst-tutorial/pipeline.html

另一个SO问题中的管道示例:

converting wav to mp3 (and vice versa) using GStreamer

相关问题 更多 >