This repository has been archived by the owner on Jul 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created example for multiple audio streams feature, changed example c…
…lass names
- Loading branch information
Dominic Miglar
committed
Aug 19, 2015
1 parent
824c152
commit 27ec5fc
Showing
6 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib") | ||
require 'bitcodin' | ||
require 'json' | ||
|
||
class CreateJobWithMultipleAudioStreams | ||
|
||
# create bitcodinAPI | ||
@apiKey = "YOUR_API_KEY" | ||
|
||
# INPUT | ||
@bitAPI = Bitcodin::BitcodinAPI.new(@apiKey) | ||
# create http config | ||
@httpConfig = Bitcodin::HTTPInputConfig.new('http://bitbucketireland.s3.amazonaws.com/Sintel-two-audio-streams-short.mkv') | ||
begin | ||
response = @bitAPI.createInput(@httpConfig) | ||
responseData = JSON.parse(response) | ||
@inputId = responseData['inputId'] | ||
rescue Exception => e | ||
puts "Could not create Input." | ||
puts e.message | ||
puts e.backtrace.inspect | ||
return nil | ||
end | ||
puts "Created input with ID: #{@inputId}." | ||
|
||
|
||
# ENCODING PROFILE | ||
@bitAPI = Bitcodin::BitcodinAPI.new(@apiKey) | ||
# create encoding profile | ||
videoStreamConfig1 = Bitcodin::VideoStreamConfig.new(0, 1024000, Profile::MAIN, Preset::STANDARD, 480, 204) | ||
videoStreamConfigs = [videoStreamConfig1] | ||
audioStreamConfig1 = Bitcodin::AudioStreamConfig.new(0, 256000) | ||
audioStreamConfig2 = Bitcodin::AudioStreamConfig.new(1, 256000) | ||
audioStreamConfigs = [audioStreamConfig1, audioStreamConfig2] | ||
encodingProfile = Bitcodin::EncodingProfile.new('MULTIPLE AUDIO STREAMS PROFILE', videoStreamConfigs, audioStreamConfigs) | ||
# parse response to get encoding profile ID | ||
response = bitcodinAPI.createEncodingProfile(encodingProfile) | ||
responseData = JSON.parse(response) | ||
@encodingProfileId = responseData['encodingProfileId'] | ||
|
||
|
||
|
||
# JOB | ||
@bitAPI = Bitcodin::BitcodinAPI.new(@apiKey) | ||
# create job config | ||
manifestTypes = [] | ||
manifestTypes.push(Bitcodin::ManifestType::MPEG_DASH_MPD) | ||
manifestTypes.push(Bitcodin::ManifestType::HLS_M3U8) | ||
|
||
# create audio metadata | ||
audioMetaDataConfiguration0 = AudioMetaDataConfiguration.new(0, 'de', 'Just Sound') | ||
audioMetaDataConfiguration1 = AudioMetaDataConfiguration.new(1, 'en', 'Sound and Voice') | ||
|
||
@job = Bitcodin::Job.new(@inputId, @encodingProfileId, manifestTypes, 'standard', nil, nil, [audioMetaDataConfiguration0, audioMetaDataConfiguration1]) | ||
|
||
# create job | ||
begin | ||
response = @bitAPI.createJob(@job) | ||
responseData = JSON.parse(response) | ||
@jobId = responseData['jobId'] | ||
rescue Exception => e | ||
puts "Could not create Job." | ||
puts e.message | ||
puts e.backtrace.inspect | ||
return nil | ||
end | ||
|
||
puts "Created job with ID: #{@jobId}." | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters