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 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
154 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.4.6 | ||
1.4.7 |
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
74 changes: 74 additions & 0 deletions
74
bitcodin/test/job/testcase_create_job_keep_aspect_ratio.py
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,74 @@ | ||
__author__ = 'David Moser <david.moser@bitmovin.com>' | ||
|
||
import unittest | ||
from bitcodin import create_job | ||
from bitcodin import create_input | ||
from bitcodin import create_encoding_profile | ||
from bitcodin import delete_input | ||
from bitcodin import delete_encoding_profile | ||
from bitcodin import Job | ||
from bitcodin import Input | ||
from bitcodin import AudioStreamConfig | ||
from bitcodin import VideoStreamConfig | ||
from bitcodin import EncodingProfile | ||
from bitcodin.test.config import test_video_url | ||
from bitcodin.test.bitcodin_test_case import BitcodinTestCase | ||
|
||
|
||
class CreateJobKeepAspectRatioTestCase(BitcodinTestCase): | ||
def setUp(self): | ||
super(CreateJobKeepAspectRatioTestCase, self).setUp() | ||
input_url = test_video_url | ||
input = Input(input_url) | ||
self.input = create_input(input) | ||
video_configs = list() | ||
|
||
video_configs.append(VideoStreamConfig( | ||
default_stream_id=0, | ||
bitrate=4800000, | ||
profile='Main', | ||
preset='premium', | ||
height=600, | ||
width=1920 | ||
)) | ||
video_configs.append(VideoStreamConfig( | ||
default_stream_id=0, | ||
bitrate=2400000, | ||
profile='Main', | ||
preset='premium', | ||
width=1024 | ||
)) | ||
video_configs.append(VideoStreamConfig( | ||
default_stream_id=0, | ||
bitrate=1200000, | ||
profile='Main', | ||
preset='premium', | ||
height=720 | ||
)) | ||
|
||
audio_stream_config = AudioStreamConfig(default_stream_id=0, bitrate=192000) | ||
|
||
encoding_profile = EncodingProfile('API Test Profile', video_configs, [audio_stream_config]) | ||
self.encoding_profile = create_encoding_profile(encoding_profile) | ||
self.manifests = ['m3u8', 'mpd'] | ||
|
||
def runTest(self): | ||
job = Job( | ||
input_id=self.input.input_id, | ||
encoding_profile_id=self.encoding_profile.encoding_profile_id, | ||
manifest_types=self.manifests | ||
) | ||
self.job = create_job(job) | ||
self.assertEquals(self.job.input.input_id, job.inputId) | ||
self.assertEquals(self.job.input.url, self.input.url) | ||
self.assertEquals(self.job.encoding_profiles[0].encoding_profile_id, job.encodingProfileId) | ||
self.wait_until_job_finished(self.job.job_id) | ||
|
||
def tearDown(self): | ||
delete_input(self.input.input_id) | ||
delete_encoding_profile(self.encoding_profile.encoding_profile_id) | ||
super(CreateJobTestCase, self).tearDown() | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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,66 @@ | ||
#!/usr/bin/env python | ||
from time import sleep | ||
|
||
import bitcodin | ||
|
||
bitcodin.api_key = 'INSERT YOUR API KEY HERE' | ||
|
||
input_obj = bitcodin.Input(url='http://bitbucketireland.s3.amazonaws.com/Sintel-original-short.mkv') | ||
print("INPUT REQUEST: %s\n\n" % input_obj.to_json()) | ||
input_result = bitcodin.create_input(input_obj) | ||
print("INPUT RESULT: %s\n\n" % input_result.to_json()) | ||
|
||
video_configs = list() | ||
|
||
# If height and width are given, aspect ratio will not be kept | ||
video_configs.append(bitcodin.VideoStreamConfig( | ||
default_stream_id=0, | ||
bitrate=4800000, | ||
profile='Main', | ||
preset='premium', | ||
height=600, | ||
width=1920 | ||
)) | ||
|
||
# If only width or only height is provided aspect ratio will be determined automatically | ||
video_configs.append(bitcodin.VideoStreamConfig( | ||
default_stream_id=0, | ||
bitrate=2400000, | ||
profile='Main', | ||
preset='premium', | ||
width=1024 | ||
)) | ||
video_configs.append(bitcodin.VideoStreamConfig( | ||
default_stream_id=0, | ||
bitrate=1200000, | ||
profile='Main', | ||
preset='premium', | ||
height=720 | ||
)) | ||
|
||
audio_configs = [bitcodin.AudioStreamConfig(default_stream_id=0, bitrate=192000)] | ||
|
||
encoding_profile_obj = bitcodin.EncodingProfile('API Test Profile', video_configs, audio_configs) | ||
print("ENCODING PROFILE REQUEST %s\n\n" % encoding_profile_obj.to_json()) | ||
|
||
encoding_profile_result = bitcodin.create_encoding_profile(encoding_profile_obj) | ||
print("ENCODING PROFILE RESULT %s\n\n" % encoding_profile_result.to_json()) | ||
|
||
manifests = ['mpd', 'm3u8'] | ||
|
||
job = bitcodin.Job( | ||
input_id=input_result.input_id, | ||
encoding_profile_id=encoding_profile_result.encoding_profile_id, | ||
manifest_types=manifests, | ||
speed='premium' | ||
) | ||
print("JOB: %s" % job.to_json()) | ||
|
||
job_result = bitcodin.create_job(job) | ||
while job_result.status != 'Finished' and job_result.status != 'Error': | ||
job_result = bitcodin.get_job(job_result.job_id) | ||
print(job_result.to_json()) | ||
sleep(5) | ||
|
||
print(job_result.to_json()) | ||
print("Job Finished!") |
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