为什么 AWS MediaConverter 验证失败?
Why is AWS MediaConverter validation failing?
我正在尝试通过 AWS 设置 wav -> mp3 转换,我已经仔细阅读了文档,但我找不到任何关于我面临的问题的信息,所以希望有人能在这里提供帮助。这是我在 AWS 上开始转换的代码:
$job_settings = '{
"TimecodeConfig": {
"Source": "ZEROBASED"
},
"OutputGroups": [
{
"Name": "File Group",
"Outputs": [
{
"ContainerSettings": {
"Container": "RAW"
},
"AudioDescriptions": [
{
"AudioTypeControl": "FOLLOW_INPUT",
"AudioSourceName": "Audio Selector 1",
"CodecSettings": {
"Codec": "MP3",
"Mp3Settings": {
"Bitrate": 192000,
"Channels": 2,
"RateControlMode": "CBR",
"SampleRate": 48000
}
},
"LanguageCodeControl": "FOLLOW_INPUT"
}
]
}
],
"OutputGroupSettings": {
"Type": "FILE_GROUP_SETTINGS",
"FileGroupSettings": {
"Destination": "{DESTINATION}"
}
}
}
],
"AdAvailOffset": 0,
"Inputs": [
{
"AudioSelectors": {
"Audio Selector 1": {
"Tracks": [
1
],
"Offset": 0,
"DefaultSelection": "DEFAULT",
"SelectorType": "TRACK",
"ProgramSelection": 1
}
},
"FilterEnable": "AUTO",
"PsiControl": "USE_PSI",
"FilterStrength": 0,
"DeblockFilter": "DISABLED",
"DenoiseFilter": "DISABLED",
"InputScanType": "AUTO",
"TimecodeSource": "ZEROBASED",
"FileInput": "{INPUT}"
}
]
}';
//Job starts here
$job_settings = json_decode($job_settings, true);
$convert_client = new MediaConvertClient(array(
'version' => '2017-08-29',
'region' => $this->login_details->region,
'credentials' => $this->credentials
));
try {
$res = $convert_client->describeEndpoints([]);
} catch(AwsException $e) {
//echo $e->getMessage();
return null;
}
//print_r($res);
$single_endpoint = $res['Endpoints'][0]['Url'];
$convert_client = new MediaConvertClient(array(
'version' => '2017-08-29',
'region' => $this->login_details->region,
'credentials' => $this->credentials,
'endpoint' => $single_endpoint
));
$res = $client->createJob(array(
"Role" => "arn:aws:iam::{$this->login_details->account_number}:role/MediaConvert_Default_Role",
"Settings" => $job_settings,
"Queue" => "arn:aws:mediaconvert:{$this->login_details->region}:{$this->login_details->account_number}:queues/Default"
));
我通过在 AWS 控制台上创建一个转换作业并复制该作业的 JSON 来获取 JSON,目标和输入标签在解码之前在 json 中被替换为assoc 数组但是我收到以下错误:
Error executing "CreateJob" on "aws_url"; AWS HTTP error: Client error: POST aws_url
resulted in a 400 Bad Request
response: { "errorType": "BadRequestException", "httpStatus" : 400, "requestId" : "-----------", (truncated...) BadRequestException (client): /outputGroups/0/outputs/0/audioDescriptions/0/codecSettings: Should match exactly one schema defined in "oneOf" | /outputGroups/0/outputs/0/audioDescriptions/0/codecSettings: Should have at least 2 properties | /outputGroups/0/outputs/0/audioDescriptions/0/codecSettings/codec: Should be equal to one of the allowed values in ["PASSTHROUGH","OPUS","VORBIS"]
这是使用 aws-3.93.3 PHP SDK。知道为什么会这样吗?当然,如果 运行 通过控制台,工作运行得很好。
其实我只是发现了我怀疑的情况;此版本的库尚不支持 MP3 提取,如下所述:
https://github.com/aws/aws-sdk-php/blob/master/CHANGELOG.md
更新到最新版本解决了这个问题。
我正在尝试通过 AWS 设置 wav -> mp3 转换,我已经仔细阅读了文档,但我找不到任何关于我面临的问题的信息,所以希望有人能在这里提供帮助。这是我在 AWS 上开始转换的代码:
$job_settings = '{
"TimecodeConfig": {
"Source": "ZEROBASED"
},
"OutputGroups": [
{
"Name": "File Group",
"Outputs": [
{
"ContainerSettings": {
"Container": "RAW"
},
"AudioDescriptions": [
{
"AudioTypeControl": "FOLLOW_INPUT",
"AudioSourceName": "Audio Selector 1",
"CodecSettings": {
"Codec": "MP3",
"Mp3Settings": {
"Bitrate": 192000,
"Channels": 2,
"RateControlMode": "CBR",
"SampleRate": 48000
}
},
"LanguageCodeControl": "FOLLOW_INPUT"
}
]
}
],
"OutputGroupSettings": {
"Type": "FILE_GROUP_SETTINGS",
"FileGroupSettings": {
"Destination": "{DESTINATION}"
}
}
}
],
"AdAvailOffset": 0,
"Inputs": [
{
"AudioSelectors": {
"Audio Selector 1": {
"Tracks": [
1
],
"Offset": 0,
"DefaultSelection": "DEFAULT",
"SelectorType": "TRACK",
"ProgramSelection": 1
}
},
"FilterEnable": "AUTO",
"PsiControl": "USE_PSI",
"FilterStrength": 0,
"DeblockFilter": "DISABLED",
"DenoiseFilter": "DISABLED",
"InputScanType": "AUTO",
"TimecodeSource": "ZEROBASED",
"FileInput": "{INPUT}"
}
]
}';
//Job starts here
$job_settings = json_decode($job_settings, true);
$convert_client = new MediaConvertClient(array(
'version' => '2017-08-29',
'region' => $this->login_details->region,
'credentials' => $this->credentials
));
try {
$res = $convert_client->describeEndpoints([]);
} catch(AwsException $e) {
//echo $e->getMessage();
return null;
}
//print_r($res);
$single_endpoint = $res['Endpoints'][0]['Url'];
$convert_client = new MediaConvertClient(array(
'version' => '2017-08-29',
'region' => $this->login_details->region,
'credentials' => $this->credentials,
'endpoint' => $single_endpoint
));
$res = $client->createJob(array(
"Role" => "arn:aws:iam::{$this->login_details->account_number}:role/MediaConvert_Default_Role",
"Settings" => $job_settings,
"Queue" => "arn:aws:mediaconvert:{$this->login_details->region}:{$this->login_details->account_number}:queues/Default"
));
我通过在 AWS 控制台上创建一个转换作业并复制该作业的 JSON 来获取 JSON,目标和输入标签在解码之前在 json 中被替换为assoc 数组但是我收到以下错误:
Error executing "CreateJob" on "aws_url"; AWS HTTP error: Client error:
POST aws_url
resulted in a400 Bad Request
response: { "errorType": "BadRequestException", "httpStatus" : 400, "requestId" : "-----------", (truncated...) BadRequestException (client): /outputGroups/0/outputs/0/audioDescriptions/0/codecSettings: Should match exactly one schema defined in "oneOf" | /outputGroups/0/outputs/0/audioDescriptions/0/codecSettings: Should have at least 2 properties | /outputGroups/0/outputs/0/audioDescriptions/0/codecSettings/codec: Should be equal to one of the allowed values in ["PASSTHROUGH","OPUS","VORBIS"]
这是使用 aws-3.93.3 PHP SDK。知道为什么会这样吗?当然,如果 运行 通过控制台,工作运行得很好。
其实我只是发现了我怀疑的情况;此版本的库尚不支持 MP3 提取,如下所述:
https://github.com/aws/aws-sdk-php/blob/master/CHANGELOG.md
更新到最新版本解决了这个问题。