Method: ActiveEncode::EngineAdapters::MediaConvertAdapter#create
- Defined in:
- lib/active_encode/engine_adapters/media_convert_adapter.rb
#create(input_url, options = {}) ⇒ Object
Required options:
-
output_prefix: The S3 key prefix to use as the base for all outputs. Will becombined with configured `output_bucket` to be passed to MediaConvert `destination`. Alternately see `destination` arg; one or the other is required. -
destination: The full s3:// URL to be passed to MediaConvertdestinationas outputlocation an filename base. `output_bucket` config is ignored if you pass `destination`. Alternately see `output_prefix` arg; one or the other is required. -
outputs: An array of ‘modifier` options defining how to transcode andname the outputs. The "modifier" option will be passed as `name_modifier` to AWS, to be added as a suffix on to `output_prefix` to create the filenames for each output.
Optional options:
-
masterfile_bucket: All input will first be copied to this bucket, before being passedto MediaConvert. You can skip this copy by passing `use_original_url` option, and an S3-based input. `masterfile_bucket` **is** required unless use_original_url is true and an S3 input source. -
use_original_url: Iftrue, any S3 URL passed in as input will be passed directly toMediaConvert as the file input instead of copying the source to the `masterfile_bucket`. -
media_type:audioorvideo. Defaultvideo. Triggers use of a correspoindingtemplate for arguments sent to AWS create_job API. -
output_type: One of:hls,dash_iso,file,ms_smooth,cmaf. Defaulthls.Triggers use of a corresponding template for arguments sent to AWS create_job API. -
output_group_destination_settings: A hash of additionaldestination_settingsto besent to MediaConvert with the output_group. Can include `s3_settings` key with `access_control` and `encryption` settings. See examples at: https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/MediaConvert/Client.html#create_job-instance_method
Example:
output_prefix: "path/to/output/files",
outputs: [
{preset: "System-Avc_16x9_1080p_29_97fps_8500kbps", modifier: "-1080",
"System-Avc_16x9_720p_29_97fps_5000kbps", modifier: "-720",
"System-Avc_16x9_540p_29_97fps_3500kbps", modifier: "-540"
]
}
}
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/active_encode/engine_adapters/media_convert_adapter.rb', line 220 def create(input_url, = {}) input_url = s3_uri(input_url, ) input = [:media_type] == :audio ? make_audio_input(input_url) : make_video_input(input_url) create_job_params = { queue: queue, role: role, settings: { inputs: [input], output_groups: make_output_groups() } } response = mediaconvert.create_job(create_job_params) job = response.job build_encode(job) end |