One of feederd‘s roles is hosting a web-based JSON API for your custom applications to communicate through. With this API, you may do such things as:
By using a simple web-based API, you are free to either use one of the existing client API libraries, or write your own.
The following API client libraries are for forming and sending JSON queries to media-nommer’s web API. This is important for sending and checking on encoding jobs. Your applications will use the API to make media-nommer do something (other than stare at you blankly).
If you create a library of your own, let us know via the issue tracker and we’ll add yours to the list.
All API calls are sent via POST with the body being JSON. Responses are also JSON-formatted.
Note
You should send these calls to the host/port that your feederd is running on. This defaults to 8001, but may specify when you call the twistd command to start the daemon.
This call submits a job for encoding. Here is an example call with POST body:
{
"source_path": "s3://AWS_ID:AWS_SECRET_KEY@BUCKET/KEYNAME.mp4",
"dest_path": "s3://AWS_ID:AWS_SECRET_KEY@OTHER_BUCKET/KEYNAME.mp4",
"notify_url": "http://myapp.somewhere.com/encoding/job_done/",
"job_options": {
"nommer": "media_nommer.ec2nommerd.nommers.ffmpeg.FFmpegNommer",
"options": [
{
'outfile_options': [
('vcodec', 'libx264'),
('preset', 'medium'),
('vprofile', 'baseline'),
('b', '400k'),
('vf', "yadif,scale='640:trunc(ow/a/2)*2'"),
('pass', '1'),
('f', 'mp4'),
('an', None),
],
},
{
'outfile_options': [
('vcodec', 'libx264'),
('preset', 'medium'),
('vprofile', 'baseline'),
('b', '400k'),
('vf', "yadif,scale='640:trunc(ow/a/2)*2'"),
('pass', '2'),
('acodec', 'libfaac'),
('ab', '128k'),
('ar', '48000'),
('async', '480'),
('ac', '2'),
('f', 'mp4'),
],
'move_atom_to_front': True,
},
],
},
}
To further elaborate:
The response to your request is also JSON-formatted, and looks like this:
{
"success": true,
"job_id": "1f40fc92da241694750979ee6cf582f2d5d7d28e1833"
}
If an error is encountered, success will be false, additional message and error_code keys will be set:
{
"false": true,
"error_code": "BADINPUT",
"message": "Bad input file. Unable to encode."
}