admin管理员组文章数量:1290954
Using AWS MediaConvert, I'm trying to stitch two video files together with the same characteristics, an mp4 container with H.264 video codec and AAC audio codec. To ease the process, I tried to concatenate the same file.
While FFmpeg does this without re-encoding the input files, I'm failing to achieve this with AWS MediaConvert. I'm using the Ruby SDK, gem aws-sdk-mediaconvert (1.84.0), to queue jobs to AWS MediaConvert.
Here are the job settings I've tried so far.
Container and codecs explicitly set in the output: mp4, H.264, AAC
{
"Queue": "arn:aws:mediaconvert:us-east-1:123456789012:queues/Default",
"Role": "arn:aws:iam::123456789012:role/MediaConvertRole",
"Settings": {
"Inputs": [
{
"FileInput": "s3://s3-bucket/input1.mp4",
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT"
}
}
},
{
"FileInput": "s3://s3-bucket/input1.mp4",
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT"
}
}
}
],
"OutputGroups": [
{
"Name": "File Group",
"Outputs": [
{
"ContainerSettings": {
"Container": "MP4"
},
"VideoDescription": {
"CodecSettings": {
"Codec": "H_264",
"H264Settings": {}
}
},
"AudioDescriptions": [
{
"CodecSettings": {
"Codec": "AAC"
}
}
]
}
],
"OutputGroupSettings": {
"Type": "FILE_GROUP_SETTINGS",
"FileGroupSettings": {
"Destination": "s3://s3-bucket/output.mp4"
}
}
}
]
}
}
Job isn't queued and fails with this error:
/outputGroups/0/outputs/0/videoDescription/codecSettings/h264Settings: Your job contains values for the following settings that are incompatible: Rate control mode, Bitrate, and Max bitrate. Adjust your settings and resubmit your job. Some valid combinations of settings are these: Set Rate control mode to QVBR, specify a value for Max bitrate, and don't specify a value for Bitrate. Or, set Rate control mode to CBR, specify a value for Bitrate, and don't specify a value for Max bitrate. (Aws::MediaConvert::Errors::BadRequestException)
However, from my testing, setting any value in the h264Settings
forces the transcoding. That is, when setting proper values within Outputs.VideoDescription.CodecSettings.H264Settings
, the job would be queued and would complete, but transcoding cannot be avoided.
Container and codecs explicitly set in the output: mp4, H.264, AAC, h264Settings
removed from the Outputs.VideoDescription.CodecSettings
{
"Queue": "arn:aws:mediaconvert:us-east-1:123456789012:queues/Default",
"Role": "arn:aws:iam::123456789012:role/MediaConvertRole",
"Settings": {
"Inputs": [
{
"FileInput": "s3://s3-bucket/input1.mp4",
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT"
}
}
},
{
"FileInput": "s3://s3-bucket/input1.mp4",
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT"
}
}
}
],
"OutputGroups": [
{
"Name": "File Group",
"Outputs": [
{
"ContainerSettings": {
"Container": "MP4"
},
"VideoDescription": {
"CodecSettings": {
"Codec": "H_264",
}
},
"AudioDescriptions": [
{
"CodecSettings": {
"Codec": "AAC"
}
}
]
}
],
"OutputGroupSettings": {
"Type": "FILE_GROUP_SETTINGS",
"FileGroupSettings": {
"Destination": "s3://s3-bucket/output.mp4"
}
}
}
]
}
}
Job isn't queued and fails with this error:
/outputGroups/0/outputs/0/videoDescription/codecSettings: Should match exactly one schema defined in "oneOf" | /outputGroups/0/outputs/0/videoDescription/codecSettings: Should have at least 2 properties | /outputGroups/0/outputs/0/videoDescription/codecSettings/codec: Must be PASSTHROUGH (Aws::MediaConvert::Errors::BadRequestException)
Container and codecs explicitly set in the output: mp4, PASSTHROUGH, PASSTHROUGH
{
"Queue": "arn:aws:mediaconvert:us-east-1:123456789012:queues/Default",
"Role": "arn:aws:iam::123456789012:role/MediaConvertRole",
"Settings": {
"Inputs": [
{
"FileInput": "s3://s3-bucket/input1.mp4",
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT"
}
}
},
{
"FileInput": "s3://s3-bucket/input1.mp4",
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT"
}
}
}
],
"OutputGroups": [
{
"Name": "File Group",
"Outputs": [
{
"ContainerSettings": {
"Container": "MP4"
},
"VideoDescription": {
"CodecSettings": {
"Codec": "PASSTHROUGH",
}
},
"AudioDescriptions": [
{
"CodecSettings": {
"Codec": "PASSTHROUGH"
}
}
]
}
],
"OutputGroupSettings": {
"Type": "FILE_GROUP_SETTINGS",
"FileGroupSettings": {
"Destination": "s3://s3-bucket/output.mp4"
}
}
}
]
}
}
Job isn't queued and fails with this error:
/outputGroups/0/outputs/0: You specified a combination of output container and codec that isn't valid. For a list of supported codec and container combinations, see . (Aws::MediaConvert::Errors::BadRequestException)
From a link inside the documentation above (.html), I can see that the mp4
container looks incompatible with the PASSTHROUGH
codec option.
And indeed, setting the container to mov
instead of mp4
would queue the job but it eventually fails with the error below.
This is somehow expected because I wouldn't think MediaConvert would re-mux from mp4
to mov
, and the AC3 or EAC3 codec is expected in the input anyway.
I wonder if stitching mp4 (H.264 / AAC) files is possible with MediaConvert without transcoding or if I just go for FFmpeg instead.
Using AWS MediaConvert, I'm trying to stitch two video files together with the same characteristics, an mp4 container with H.264 video codec and AAC audio codec. To ease the process, I tried to concatenate the same file.
While FFmpeg does this without re-encoding the input files, I'm failing to achieve this with AWS MediaConvert. I'm using the Ruby SDK, gem aws-sdk-mediaconvert (1.84.0), to queue jobs to AWS MediaConvert.
Here are the job settings I've tried so far.
Container and codecs explicitly set in the output: mp4, H.264, AAC
{
"Queue": "arn:aws:mediaconvert:us-east-1:123456789012:queues/Default",
"Role": "arn:aws:iam::123456789012:role/MediaConvertRole",
"Settings": {
"Inputs": [
{
"FileInput": "s3://s3-bucket/input1.mp4",
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT"
}
}
},
{
"FileInput": "s3://s3-bucket/input1.mp4",
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT"
}
}
}
],
"OutputGroups": [
{
"Name": "File Group",
"Outputs": [
{
"ContainerSettings": {
"Container": "MP4"
},
"VideoDescription": {
"CodecSettings": {
"Codec": "H_264",
"H264Settings": {}
}
},
"AudioDescriptions": [
{
"CodecSettings": {
"Codec": "AAC"
}
}
]
}
],
"OutputGroupSettings": {
"Type": "FILE_GROUP_SETTINGS",
"FileGroupSettings": {
"Destination": "s3://s3-bucket/output.mp4"
}
}
}
]
}
}
Job isn't queued and fails with this error:
/outputGroups/0/outputs/0/videoDescription/codecSettings/h264Settings: Your job contains values for the following settings that are incompatible: Rate control mode, Bitrate, and Max bitrate. Adjust your settings and resubmit your job. Some valid combinations of settings are these: Set Rate control mode to QVBR, specify a value for Max bitrate, and don't specify a value for Bitrate. Or, set Rate control mode to CBR, specify a value for Bitrate, and don't specify a value for Max bitrate. (Aws::MediaConvert::Errors::BadRequestException)
However, from my testing, setting any value in the h264Settings
forces the transcoding. That is, when setting proper values within Outputs.VideoDescription.CodecSettings.H264Settings
, the job would be queued and would complete, but transcoding cannot be avoided.
Container and codecs explicitly set in the output: mp4, H.264, AAC, h264Settings
removed from the Outputs.VideoDescription.CodecSettings
{
"Queue": "arn:aws:mediaconvert:us-east-1:123456789012:queues/Default",
"Role": "arn:aws:iam::123456789012:role/MediaConvertRole",
"Settings": {
"Inputs": [
{
"FileInput": "s3://s3-bucket/input1.mp4",
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT"
}
}
},
{
"FileInput": "s3://s3-bucket/input1.mp4",
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT"
}
}
}
],
"OutputGroups": [
{
"Name": "File Group",
"Outputs": [
{
"ContainerSettings": {
"Container": "MP4"
},
"VideoDescription": {
"CodecSettings": {
"Codec": "H_264",
}
},
"AudioDescriptions": [
{
"CodecSettings": {
"Codec": "AAC"
}
}
]
}
],
"OutputGroupSettings": {
"Type": "FILE_GROUP_SETTINGS",
"FileGroupSettings": {
"Destination": "s3://s3-bucket/output.mp4"
}
}
}
]
}
}
Job isn't queued and fails with this error:
/outputGroups/0/outputs/0/videoDescription/codecSettings: Should match exactly one schema defined in "oneOf" | /outputGroups/0/outputs/0/videoDescription/codecSettings: Should have at least 2 properties | /outputGroups/0/outputs/0/videoDescription/codecSettings/codec: Must be PASSTHROUGH (Aws::MediaConvert::Errors::BadRequestException)
Container and codecs explicitly set in the output: mp4, PASSTHROUGH, PASSTHROUGH
{
"Queue": "arn:aws:mediaconvert:us-east-1:123456789012:queues/Default",
"Role": "arn:aws:iam::123456789012:role/MediaConvertRole",
"Settings": {
"Inputs": [
{
"FileInput": "s3://s3-bucket/input1.mp4",
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT"
}
}
},
{
"FileInput": "s3://s3-bucket/input1.mp4",
"AudioSelectors": {
"Audio Selector 1": {
"DefaultSelection": "DEFAULT"
}
}
}
],
"OutputGroups": [
{
"Name": "File Group",
"Outputs": [
{
"ContainerSettings": {
"Container": "MP4"
},
"VideoDescription": {
"CodecSettings": {
"Codec": "PASSTHROUGH",
}
},
"AudioDescriptions": [
{
"CodecSettings": {
"Codec": "PASSTHROUGH"
}
}
]
}
],
"OutputGroupSettings": {
"Type": "FILE_GROUP_SETTINGS",
"FileGroupSettings": {
"Destination": "s3://s3-bucket/output.mp4"
}
}
}
]
}
}
Job isn't queued and fails with this error:
/outputGroups/0/outputs/0: You specified a combination of output container and codec that isn't valid. For a list of supported codec and container combinations, see https://docs.aws.amazon/console/mediaconvert/reference-codecs-containers. (Aws::MediaConvert::Errors::BadRequestException)
From a link inside the documentation above (https://docs.aws.amazon/mediaconvert/latest/ug/video-passthrough.html), I can see that the mp4
container looks incompatible with the PASSTHROUGH
codec option.
And indeed, setting the container to mov
instead of mp4
would queue the job but it eventually fails with the error below.
This is somehow expected because I wouldn't think MediaConvert would re-mux from mp4
to mov
, and the AC3 or EAC3 codec is expected in the input anyway.
I wonder if stitching mp4 (H.264 / AAC) files is possible with MediaConvert without transcoding or if I just go for FFmpeg instead.
Share Improve this question asked Feb 13 at 17:26 Philippe SultanPhilippe Sultan 2,37820 silver badges25 bronze badges1 Answer
Reset to default 0I am currently faced with the same issue and I believe MediaConvert is only allowing you to passthrough mezzanine video formats like: AVC Intra, Apple ProRes, VC3, and JPEG2000 but not AVC.
Hence you cannot use it to simply cut the video without re-transcoding it.
I think the best approach would be for you to use ffmpeg. You can also create a Lambda function in AWS and add ffmpeg
as a layer and run it through an API gateway. I think that would be the most cost-effective solution.
本文标签: aws media convertStitch mp4 files with AWS MediaConvert without transcodingStack Overflow
版权声明:本文标题:aws media convert - Stitch mp4 files with AWS MediaConvert without transcoding - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741513365a2382738.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论