将 mp3 文件转换为 Amazon Alexa SSML 所需的编解码器版本(MPEG 版本 2)和比特率 (48 kbps) 的正确命令是什么? [英] What is the right command to convert an mp3 file to the required codec version (MPEG version 2) and bit rate (48 kbps) for Amazon Alexa SSML?

查看:19
本文介绍了将 mp3 文件转换为 Amazon Alexa SSML 所需的编解码器版本(MPEG 版本 2)和比特率 (48 kbps) 的正确命令是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 mp3 文件转换为 Amazon Alexa SSML 标记语言中的音频标签所期望的格式,如下所述:https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speech-synthesis-标记语言-ssml-reference

I am trying to convert an mp3 file to the format expected by the audio tag in the Amazon Alexa SSML markup language as described here: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speech-synthesis-markup-language-ssml-reference

文档推荐使用 https://www.ffmpeg.org/ffmpeg.html

我尝试了此命令,但找不到要使用的正确编解码器:ffmpeg -y -i input.mp3 -ar 44100 -ab 48k -codec:a mpeg2 -ac 1 output.mp3

I tried this command but can't find the right codec to use: ffmpeg -y -i input.mp3 -ar 44100 -ab 48k -codec:a mpeg2 -ac 1 output.mp3

我知道我需要转换文件,因为 Alexa 失败并出现以下错误:音频不是受支持的 MPEG 版本

I know I need to convert the file because Alexa fails with the following error: The audio is not of a supported MPEG version

推荐答案

亚马逊要求这样做有点令人困惑,坦率地说有点奇怪.mp3 文件可以是 mpeg1 或 mpeg2 或 mpeg-2.5(非标准,但得到广泛支持).为此,版本之间的主要区别是比特率和采样率.亚马逊需要 48kbps(所有 mpeg 版本都支持).其次,mpeg-2 仅支持 22050 Hz、24000 Hz 和 16000 Hz 的采样率.因此,重新采样到这些频率之一应该会强制 ffmpeg 到 MPEG-2 第 3 层.

Its a little confusing, and frankly a little odd that amazon requires this. mp3 files can be mpeg1 or mpeg2 or mpeg-2.5 (non standard, but widely supported). For this purpose, the main differences between the versions are bitrate and sample rate. Amazon requires 48kbps (which is supported in all mpeg versions). Next, mpeg-2 only supports sample rates of 22050 Hz, 24000 Hz, and 16000 Hz. So resampling to one of those frequencies should force ffmpeg to MPEG-2 layer 3.

ffmpeg -y -i input.mp3 -ar 16000 -ab 48k -codec:a libmp3lame -ac 1 output.mp3

更多信息在这里和这里:

more info here and here:

http://www.mp3-tech.org/programmer/frame_header.html

https://en.wikipedia.org/wiki/MP3

这篇关于将 mp3 文件转换为 Amazon Alexa SSML 所需的编解码器版本(MPEG 版本 2)和比特率 (48 kbps) 的正确命令是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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