如何以编程方式将mp3转换为可在iTunes上播放的AAC/M4A文件? [英] How do I programmatically convert mp3 to an itunes-playable aac/m4a file?

查看:84
本文介绍了如何以编程方式将mp3转换为可在iTunes上播放的AAC/M4A文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一种以编程方式或通过命令行将mp3转换为aac的方法,但是没有运气.理想情况下,我会从Rails应用程序中调用一段代码,将mp3转换为aac.我安装了ffmpeg和libfaac,并能够使用以下命令创建aac文件:

I've been looking for a way to convert an mp3 to aac programmatically or via the command line with no luck. Ideally, I'd have a snippet of code that I could call from my rails app that converts an mp3 to an aac. I installed ffmpeg and libfaac and was able to create an aac file with the following command:

ffmpeg -i test.mp3 -acodec libfaac -ab 163840 dest.aac

当我将输出文件的名称更改为dest.m4a时,它无法在iTunes中播放.

When i change the output file's name to dest.m4a, it doesn't play in iTunes.

谢谢!

推荐答案

FFmpeg 提供AAC编码工具(如果已将它们编译进来).如果使用Windows,则可以从此处获取完整的二进制文件>

FFmpeg provides AAC encoding facilities if you've compiled them in. If you are using Windows you can grab full binaries from here

ffmpeg -i source.mp3 -acodec libfaac -ab 128k dest.aac

我不确定你怎么从红宝石中称呼它.

I'm not sure how you would call this from ruby.

此外,请确保正确设置比特率.

Also, be sure to set the bitrate appropriately.

这篇关于如何以编程方式将mp3转换为可在iTunes上播放的AAC/M4A文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆