Installation
To install this package:
Usage
First, we will setup the notification and storage settings:
import coconut
coconut.api_key = 'k-api-key'
coconut.notification = {
'type': 'http',
'url': 'https://yoursite/api/coconut/webhook'
}
coconut.storage = {
'service': 's3',
'bucket': 'my-bucket',
'region': 'us-east-1',
'credentials': {
'access_key_id': 'access-key',
'secret_access_key': 'secret-key'
}
}
Creating a job
Creating complexe job is easy. In this example, we create 2 webp, 1 mp4 video and HLS outputs.
coconut.Job.create({
'input': { 'url': 'https://mysite/path/file.mp4' },
'outputs': {
'webp': [
{
'key': 'webp:cover',
'path': '/cover_%05d.webp',
'number': 10,
'format': {
'resolution': '600x'
}
},
{
'key': 'webp:thumbs',
'path': '/thumbs_%05d.webp',
'interval': 10,
'format': {
'resolution': '200x'
},
'sprite': {
'limit': 100,
'columns': 10
},
'vtt': {
'filename': 'thumbs.vtt'
}
},
],
'mp4': [
{
'key': 'mp4',
'path': '/video.mp4',
'format': {
'quality': 4
}
}
],
'httpstream': {
'hls': { 'path': 'hls/' }
}
}
})