AWS Media Converter确实会每个文件创建新的作业。如果您想转换多个文件并将它们作为一项作业处理,则需要编写代码以将多个文件添加到同一个作业中。以下是一个示例Python代码,它将两个文件添加到同一个作业中:
import boto3
import time
# Setup AWS SDK clients
mc = boto3.client('mediaconvert')
s3 = boto3.client('s3')
# Variables for location of input and output files
input_bucket = 'input-bucket'
input_key_1 = 'file1.mp4'
input_key_2 = 'file2.mp4'
output_bucket = 'output-bucket'
output_prefix = 'output/'
# Create a new MediaConvert job
job_settings = {
'OutputGroups': [
{
'Name': 'File group',
'OutputGroupSettings': {
'Type': 'FILE_GROUP_SETTINGS',
'FileGroupSettings': {}
},
'Outputs': [
{
'NameModifier': '_output1',
'ContainerSettings': {
'Container': 'MP4',
'Mp4Settings': {}
},
'VideoDescription': {
'ScalingBehavior': 'DEFAULT',
'TimecodeInsertion': 'DISABLED',
'AntiAlias': 'ENABLED',
'Sharpness': 50,
'CodecSettings': {
'Codec': 'H_264',
'H264Settings': {
'InterlaceMode': 'PROGRESSIVE'
}
},
'DropFrameTimecode': 'ENABLED',
'Height': 720,
'Width': 1280,
'RespondToAfd': 'NONE',
'ColorMetadata': 'INSERT'
}
},
{
'NameModifier': '_output2',
'ContainerSettings': {
'Container': 'MP4',
'Mp4Settings': {}
},
'VideoDescription': {
'ScalingBehavior': 'DEFAULT',
'TimecodeInsertion': 'DISABLED',
'AntiAlias': 'ENABLED',
'Sharpness': 50,
'CodecSettings': {
'Codec': 'H_264',