Create a job. A job is what defines what we are merging.
job = MediaMerge::Job.new
Create an input. An input defines a media source.
sub_input = MediaMerge::Input.new('sample (en).mkv')
Input#tracks returns an array of Track objects.
sub_input.tracks.each do |track|
if track.subtitle? && track.lang_code == :en
# Sets this track to be copied and the options
track.copy(name: 'English Sub', default: true)
end
end
Another way to define an input.
video_audio_input = MediaMerge::Input.new('sample [bluray].mkv'
copy: {
type: [ :video, audio: { lang_code: :ja } ]
}
})
After defining the inputs we add them to the job.
job.inputs.push(video_audio_input, sub_input)