简体   繁体   English

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

[英]Convert mp4 to .wav or mp3 with python

Does anybody have experience with converting mp4 files to .wav or mp3 files? 有没有人有将mp4文件转换为.wav或mp3文件的经验? I am able to do this in Linux (bash), but I try to do everything in Python that I do in other languages, call me an enthusiast. 我可以在Linux(bash)中执行此操作,但我尝试用其他语言执行Python中的所有操作,称我为发烧友。 I have been looking over the Pymedia library, but have not made progress as of yet. 我一直在查看Pymedia库,但尚未取得进展。

You can use Python bindings for GStreamer, and create a pipeline to do the conversion: 您可以为GStreamer使用Python绑定,并创建一个管道来进行转换:

More info here: 更多信息:

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

Example of pipeline in another SO question: 另一个SO问题中的管道示例:

converting wav to mp3 (and vice versa) using GStreamer 使用GStreamer将wav转换为mp3(反之亦然)

You might find the python audio tools of some use. 您可能会发现某些使用的python音频工具 They are designed to work from command line, but being python code you can simply import the modules and integrate it in another program. 它们被设计为从命令行工作,但是作为python代码,您可以简单地导入模块并将其集成到另一个程序中。 This is the API documentation . 这是API文档 From the "About" page: 从“关于”页面:

Python Audio Tools are a collection of audio handling programs which work from the command line. Python Audio Tools是一组音频处理程序,可以在命令行中运行。 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. 其中包括CD提取程序,从一种音频格式到另一种音频格式的轨道转换,轨道重命名和重新标记,轨道识别,轨道CD刻录等。 Supports internationalized track filenames and metadata using Unicode. 使用Unicode支持国际化的跟踪文件名和元数据。 Works with high-definition, multi-channel audio as well as CD-quality. 适用于高清,多声道音频以及CD质量。 Track conversion uses multiple CPUs or CPU cores if available to greatly speed the transcoding process. 跟踪转换使用多个CPU或CPU核心(如果可用),以大大加快转码过程。 Track metadata can be retrieved from FreeDB, MusicBrainz or compatible servers. 可以从FreeDB,MusicBrainz或兼容服务器检索跟踪元数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM