|
1 | 1 | Usage |
2 | 2 | ===== |
3 | 3 |
|
4 | | -Here is some basic usage information:: |
5 | | - |
6 | | - import zencoder |
7 | | - zen = zencoder.Zencoder() |
8 | | - zen.jobs.list() |
9 | | - |
10 | | - from zencoder import Zencoder |
11 | | - zen = Zencoder('abc123') # enter your api key |
12 | | - |
13 | | - # creates an encoding job with the defaults |
14 | | - job = zen.job.create('http://input-file/movie.avi') |
15 | | - print job.code |
16 | | - print job.body |
17 | | - print job.body['id'] |
18 | | - |
19 | | - # get the transcode progress of the first output |
20 | | - progress = zen.output.progress(job.body['outputs'][0]['id']) |
21 | | - print progress.body |
22 | | - |
23 | | - |
24 | | - # configure your outputs with dictionaries |
25 | | - iphone = { |
26 | | - 'label': 'iPhone', |
27 | | - 'url': 's3://output-bucket/output-file-1.mp4', |
28 | | - 'width': 480, |
29 | | - 'height': 320 |
30 | | - } |
31 | | - web = { |
32 | | - 'label': 'web', |
33 | | - 'url': 's3://output-bucket/output-file.vp8', |
34 | | - 'video_codec':, 'vp8' |
35 | | - } |
36 | | - # the outputs kwarg requires an iterable |
37 | | - outputs = (iphone, web) |
38 | | - another_job = zen.job.create(input_url, outputs=outputs) |
| 4 | +Create an instance of `Zencoder`:: |
| 5 | + |
| 6 | + from zencoder import Zencoder |
| 7 | + zen = Zencoder('abc123') # enter your api key |
| 8 | + |
| 9 | +Submit a job to Zencoder:: |
| 10 | + |
| 11 | + # creates an encoding job with the defaults |
| 12 | + job = zen.job.create('http://input-file/movie.avi') |
| 13 | + print job.code |
| 14 | + print job.body |
| 15 | + print job.body['id'] |
| 16 | + |
| 17 | +Return output progress:: |
| 18 | + |
| 19 | + # get the transcode progress of the first output |
| 20 | + progress = zen.output.progress(job.body['outputs'][0]['id']) |
| 21 | + print progress.body |
| 22 | + |
| 23 | +Create a new job with multiple outputs:: |
| 24 | + |
| 25 | + # configure your outputs with dictionaries |
| 26 | + iphone = { |
| 27 | + 'label': 'iPhone', |
| 28 | + 'url': 's3://output-bucket/output-file-1.mp4', |
| 29 | + 'width': 480, |
| 30 | + 'height': 320 |
| 31 | + } |
| 32 | + web = { |
| 33 | + 'label': 'web', |
| 34 | + 'url': 's3://output-bucket/output-file.vp8', |
| 35 | + 'video_codec':, 'vp8' |
| 36 | + } |
| 37 | + |
| 38 | + # the outputs kwarg requires an iterable |
| 39 | + outputs = (iphone, web) |
| 40 | + another_job = zen.job.create(input_url, outputs=outputs) |
39 | 41 |
|