Developer API
Overview
Gomi provides a RESTful API for easy developer integration.
Common use cases:
- Encode videos as they are uploaded to your website
- Bulk encode large video/audio libraries
Security
Users must authenticate by providing a valid API Key. You can manage your api keys
from your account details page.
You're encouraged to connect over SSL (https) so your communications are encrypted.
Typical Workflow
If you were developing a youtube style site:
- User uploads a video that you want to make available in multiple video formats. (e.g High, Medium, Low, iPhone, iPad)
- Create a record in your application for each output format you are intending to deliver
- Call Create Encoding Job method once to create all the encoding jobs, passing in your own CustomerReferenceID's for tracking.
- Receive Job Completion Notifications when video is ready so you can update your application accordingly.
Create Encoding Job
Instructs Gomi to Ingest a video from a url and immediately encode it into one or more output formats. The encoded Output Media can be delivered to your server.
POST
http://api.gomi.com/api/v1/job/create?ApiKey={apikey}
Expected Request Body JSON XML
Host: api.gomi.com
Content-Type: application/json
Content-Length: length
{
"ApiKey":"String", //required
"SourceMediaURL":"String", //required
"OutputJobs":[
{
"OutputFormatID":0, //required
"Title":"String", //optional
"CustomerReferenceID":"String", //optional
"Metadata":"String", //optional
"DeliveryLocation":"String", //optional
"NotificationEmailAddress":"String", //optional
"PingUrl":"String", //optional
"AudioBitrate":128, //optional
"AudioChannelsID":2, //optional
"AudioCodecCode":"String", //optional
"AudioSampleRateID":48000, //optional
"DeInterlace":false, //optional
"FrameRateID":10, //optional
"Width":720, //optional
"Height":576, //optional
"KeepAspectRatio":true, //optional
"VideoResizeMethodCode":"String", //optional
"MediaContainerCode":"String", //optional
"TwoPassEncoding":false, //optional
"VideoBitrate":1024, //optional
"VideoCodecCode":"String" //optional
"OverlayOffsetFrom":"String" //optional
"OverlayImageUri":"String" //optional
"OverlayOffsetX":10 //optional
"OverlayOffsetY":10 //optional
"NewFilename":"String" //optional
"ForcedKeyFrameInterval":0 //optional
"FixedKeyFrameInterval":false //optional
}
]
}
Host: api.gomi.com
Content-Type: application/xml
Content-Length: length
<CreateJob xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TranscodeEngine.API.v1.Models">
<ApiKey>String</ApiKey>
<SourceMediaURL>String</SourceMediaURL>
<OutputJobs>
<OutputJobItem>
<OutputFormatID>0</OutputFormatID>
<Title>String</Title>
<CustomerReferenceID>String</CustomerReferenceID>
<Metadata>String</Metadata>
<DeliveryLocation>String</DeliveryLocation>
<PingUrl>String</PingUrl>
<NotificationEmailAddress>String</NotificationEmailAddress>
<AudioBitrate i:nil="true" />
<AudioChannelsID i:nil="true" />
<AudioCodecCode>String</AudioCodecCode>
<AudioSampleRateID i:nil="true" />
<DeInterlace i:nil="true" />
<FrameRateID i:nil="true" />
<Width i:nil="true" />
<Height i:nil="true" />
<KeepAspectRatio i:nil="true" />
<VideoResizeMethodCode>String</VideoResizeMethodCode>
<MediaContainerCode>String</MediaContainerCode>
<TwoPassEncoding i:nil="true" />
<VideoBitrate i:nil="true" />
<VideoCodecCode>String</VideoCodecCode>
<OverlayOffsetFrom>String</OverlayOffsetFrom>
<OverlayImageUri>String</OverlayOffsetUri>
<OverlayOffsetX i:nil="true" />
<OverlayOffsetY i:nil="true" />
<NewFilename>String</NewFilename>
<ForcedKeyFrameInterval i:nil="true" />
<FixedKeyFrameInterval i:nil="true" />
</OutputJobItem>
</OutputJobs>
</CreateJob>
Parameters
{ApiKey}
{format}
SourceMediaURL
Advanced: Gomi supports joining multiple video files together. To use this functionality, just specify multiple Url's separated by the pipe "|" character.
e.g. http://yourserver/yourfile.avi|http://anotherserver/path/anotherfile.wmv
Gomi will automatically import the files in parallel & join them during encoding.
OutputFormatID
Title
CustomerReferenceID
DeliveryLocation
Metadata
Accepts a string containing Url encoded key-value pairs of metadata tags in the format: "Key1=Value1&Key2=Value2". This is the same as a standard Url querystring.
e.g. "title=MyTitle&album=MyAlbum" Optional
PingUrl
NotificationEmailAddress
MediaContainerCode
Valid Values:
For audio & video: 3g2, 3gp, avi, dvd-ntsc-iso, dvd-ntsc-mpg, dvd-pal-iso, dvd-pal-mpg, fl9, flv, matroska, mov, mp4, mpegts, mxf, ogg, webm, wmv, wmv9
For video only:mjpeg, mpeg2video
For audio only: aac, flac, m4a, mp3, wav, wma
VideoCodecCode
Valid Values:
copy (copy source stream)
none (no audio)
flv, h263, h264, h264base, huffyuv, libtheora, libvpx, mjpeg, mpeg1video, mpeg2video, mpeg4, mpgNtscDvd, mpgPalDvd, VC-1, VC-1Adv, VC-1Simple, wmv1, wmv2, xvid
Width
Note, if Width is specified but Height is 0, scales the video to the specified Width while maintaining proportions.
Height
Note, if Height is specified but Width is 0, scales the video to the specified height while maintaining proportions.
KeepAspectRatio
When set to true, attempts to maintain the video's pixel aspect ratio by Cropping and/or Padding the output video. The combination or cropping/padding is controlled by the ResizeMethod parameter.
WMV9 Only: When KeepAspectRatio is true, resizes the video to the largest size that fits within the output Width/Height box while maintaining aspect ratio without cropping or padding.
VideoBitrate
VideoResizeMethodCode
Valid Values:
Auto (Pads a little and Crops a little as necessary to maintain original aspect ratio)
Letterbox (Pads as necessary to maintain original aspect ratio)
PanScan (Crops as necessary to maintain original aspect ratio)
FrameRateID
Valid Values:
-1 (same as source)
10000 (10.0 frames per second)
11988 (11.988 frames per second)
12000 (12.0 frames per second)
14985 (14.985 frames per second)
15000 (15.0 frames per second)
20000 (20.0 frames per second)
23976 (23.976 frames per second)
24000 (24.0 frames per second)
25000 (25.0 frames per second)
29970 (29.97 frames per second)
30000 (30.0 frames per second)
AudioCodecCode
Valid Values:
copy (copy source stream)
none (no audio)
aac, ac3, amr-nb, flac, mp2, mp3, pcm-s16BE, pcm-s16LE, pcm-u8, vorbis, wmaLossless, wmaProfessional, wmaStandard, wmav2, wmaVoice
AudioBitrate
AudioSampleRateID
Valid Values:
-1 (same as source)
8000 (8,000 hz)
11025 (11,025 hz)
16000 (16,000 hz)
22000 (22,000 hz)
22050 (22,050 hz)
24000 (24,000 hz)
32000 (32,000 hz)
44000 (44,000 hz)
44100 (44,100 hz)
48000 (48,000 hz)
192000 (192,000 hz)
AudioChannelsID
Valid Values:
1 (Mono)
2 (Stereo)
OverlayOffsetFrom
Valid values: TopLeft, TopRight, BottomLeft, BottomRight, Center
OverlayImageUri
OverlayOffsetX
e.g. if OverlayOffsetX = 10 and OverlayOffsetFrom=BottomRight, the overlay image will be rendered with a 10 pixels gap to the left of the bottom right corner.
OverlayOffsetY
e.g. if OverlayOffsetY = 10 and OverlayOffsetFrom=BottomRight, the overlay image will be rendered with a 10 pixels gap above the bottom right corner.
NewFilename
Gomi will still append the standard file extension to the value provided here for the specified output media container.
You can also include a few predefined variables:
"[OutputMediaAssetID]" - will be replaced with the Gomi's output media asset ID. e.g "[OutputMediaAssetID]-mynewfilename" will become 42345254-mynewfilename
"[SourceMediaFilename]" - will be replaced with the source filename of the input media.
Gomi by default uses a naming convention of "[OutputMediaAssetID]-[SourceMediaFilename]". The OutputMediaAssetID helps to ensure unique filenames when files are delivered to your server.
ForcedKeyFrameInterval
By setting this value you force the encoder to place a keyframe at the specfied frame interval. e.g. specifying 60 forces a keyframe every 60 frames.
You should set this when targetting certain adaptive streaming protocols such as Apple HLS, Microsoft Smooth Streaming & Adobe Dynamic Streaming.
Setting ForcedKeyFrameInterval still allows other key frames to be inserted by the encoder such as at scene changes. This behaviour can be modified by the "FixedKeyFrameInterval" parameter.
FixedKeyFrameInterval
Defaults to false. When set to true, does not allow the encoder to insert extra key frames except those specified by the FixedKeyFrameInterval parameter
This is often desirable when targeting the adaptive streaming protocols.
Response Body JSON XML
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{
"IngestJobID":0,
"IngestJobStatusLocation":"ingest/0",
"InputMediaID":"String",
"OutputJobs":[
{
"JobID":0,
"CustomerReferenceID":"String",
"Success":false,
"JobStatusLocation":"job/0"
}
],
"Success":false,
"ErrorCode":"String",
"Message":"String"
}
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<CreateJobResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TranscodeEngine.API.v1.Models">
<ErrorCode>String</ErrorCode>
<Message>String</Message>
<IngestJobID>0</IngestJobID>
<IngestJobStatusLocation>ingest/0</IngestJobStatusLocation>
<InputMediaID>String</InputMediaID>
<OutputJobs>
<JobCreationStatus>
<CustomerReferenceID>String</CustomerReferenceID>
<ErrorCode>String</ErrorCode>
<ErrorMessage>String</ErrorMessage>
<JobID>0</JobID>
<JobStatusLocation>job/0</JobStatusLocation>
<Success>false</Success>
</JobCreationStatus>
</OutputJobs>
<Success>false</Success>
</CreateJobResponse>
Note: Look at the 'Success' value in the response to determine if the request was successful. If not, details will be provided in the ErrorCode and Message fields.
Get All Input Media
When you upload or transfer a remote file into Gomi for encoding, it appears as
Input Media.
Input Media is stored temporarily (3 days). Results from this query are paged.
Request
GET
http://api.gomi.com/api/v1/media/input?ApiKey={apikey}
Parameters
{ApiKey}
{format}
{pageSize}
{pageNumber}
Response JSON XML
{
"InputAssets":[
{
"DateCreatedUTC":"/Date(1329597731598+0000)/",
"DateUpdatedUTC":"/Date(1329597731598+0000)/",
"FileURL":"http://www.gomi.com/download/2/sourcemedia/399/tgwxngv/jkhkj.avi",
"InputMediaID":399,
"MimeType":"video/avi",
"Self":"media/input/399",
"SizeBytes":793340,
"SourceFilename":"jkhkj.avi",
"Status":"available",
"ThumbnailURL":"http://s3-us-west-1.amazonaws.com/gomi-dev1/sourcemedia/399/tgwxngv/399-image00001.jpg",
"Title":"",
"info":{
"AudioTrack":{
"AudioBitrateKbps":64,
"AudioChannelCount":2,
"AudioCodec":"MPEG Audio",
"AudioSampleRateHz":48000
},
"DurationSeconds":19,
"MediaContainerFormat":"AVI",
"TotalBitrateKbps":328,
"VideoTrack":{
"FrameRate":29.969999999999999,
"VideoCodec":"MPEG Audio"
}
}
},
{
"DateCreatedUTC":"/Date(1329596274433+0000)/",
"DateUpdatedUTC":"/Date(1329596274433+0000)/",
"FileURL":"http://www.gomi.com/download/2/sourcemedia/396/ycpgrbo/BMP2_PSP.vob",
"InputMediaID":396,
"MimeType":"video/mpeg",
"Self":"media/input/396",
"SizeBytes":1300480,
"SourceFilename":"BMP2_PSP.vob",
"Status":"available",
"ThumbnailURL":"http://s3-us-west-1.amazonaws.com/gomi-dev1/sourcemedia/396/ycpgrbo/396-image00001.jpg",
"Title":"",
"info":{
"AudioTrack":{
"AudioBitrateKbps":96,
"AudioChannelCount":2,
"AudioCodec":"AC-3",
"AudioSampleRateHz":48000
},
"DurationSeconds":19,
"MediaContainerFormat":"MPEG-PS",
"TotalBitrateKbps":537,
"VideoTrack":{
"FrameRate":29.969999999999999,
"VideoCodec":"AC-3"
}
}
}
],
"PageNumber":1,
"PageSize":20,
"Success":true,
"TotalAssetCount":2,
"ErrorCode":"",
"Message":""
}
<GetInputListResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TranscodeEngine.API.v1.Models">
<ErrorCode i:nil="true" />
<Message i:nil="true" />
<InputAssets>
<InputAsset>
<DateCreatedUTC>2012-02-19T07:42:11.5982317</DateCreatedUTC>
<DateUpdatedUTC>2012-02-19T07:42:11.5982317</DateUpdatedUTC>
<FileURL>http://www.gomi.com/download/2/sourcemedia/399/tgwxngv/jkhkj.avi</FileURL>
<InputMediaID>399</InputMediaID>
<MimeType>video/avi</MimeType>
<Self>media/input/399</Self>
<SizeBytes>793340</SizeBytes>
<SourceFilename>jkhkj.avi</SourceFilename>
<Status>available</Status>
<ThumbnailURL>http://s3-us-west-1.amazonaws.com/gomi-dev1/sourcemedia/399/tgwxngv/399-image00001.jpg</ThumbnailURL>
<Title />
<info>
<AudioTrack>
<AudioBitrateKbps>64</AudioBitrateKbps>
<AudioChannelCount>2</AudioChannelCount>
<AudioCodec>MPEG Audio</AudioCodec>
<AudioSampleRateHz>48000</AudioSampleRateHz>
</AudioTrack>
<DurationSeconds>19</DurationSeconds>
<MediaContainerFormat>AVI</MediaContainerFormat>
<TotalBitrateKbps>328</TotalBitrateKbps>
<VideoTrack>
<FrameRate>29.97000</FrameRate>
<Height i:nil="true" />
<VideoBitrateKbps i:nil="true" />
<VideoCodec>MPEG Audio</VideoCodec>
<Width i:nil="true" />
</VideoTrack>
</info>
</InputAsset>
<InputAsset>
<DateCreatedUTC>2012-02-19T07:17:54.4338866</DateCreatedUTC>
<DateUpdatedUTC>2012-02-19T07:17:54.4338866</DateUpdatedUTC>
<FileURL>http://www.gomi.com/download/2/sourcemedia/396/ycpgrbo/BMP2_PSP.vob</FileURL>
<InputMediaID>396</InputMediaID>
<MimeType>video/mpeg</MimeType>
<Self>media/input/396</Self>
<SizeBytes>1300480</SizeBytes>
<SourceFilename>BMP2_PSP.vob</SourceFilename>
<Status>available</Status>
<ThumbnailURL>http://s3-us-west-1.amazonaws.com/gomi-dev1/sourcemedia/396/ycpgrbo/396-image00001.jpg</ThumbnailURL>
<Title />
<info>
<AudioTrack>
<AudioBitrateKbps>96</AudioBitrateKbps>
<AudioChannelCount>2</AudioChannelCount>
<AudioCodec>AC-3</AudioCodec>
<AudioSampleRateHz>48000</AudioSampleRateHz>
</AudioTrack>
<DurationSeconds>19</DurationSeconds>
<MediaContainerFormat>MPEG-PS</MediaContainerFormat>
<TotalBitrateKbps>537</TotalBitrateKbps>
<VideoTrack>
<FrameRate>29.97000</FrameRate>
<Height i:nil="true" />
<VideoBitrateKbps i:nil="true" />
<VideoCodec>AC-3</VideoCodec>
<Width i:nil="true" />
</VideoTrack>
</info>
</InputAsset>
</InputAssets>
<PageNumber>1</PageNumber>
<PageSize>20</PageSize>
<Success>true</Success>
<TotalAssetCount>2</TotalAssetCount>
</GetInputListResponse>
Note: Look at the 'Success' value in the response to determine if the request was successful. If not, details will be provided in the ErrorCode and Message fields.
Get Input Item
Retrieves the metadata for an individual input asset.
Request
GET
http://api.gomi.com/api/v1/media/input/{InputMediaID}?ApiKey={apikey}&format={json|xml}
Parameters
{InputMediaID}
{ApiKey}
{format}
Response JSON XML
{
"asset":
{
"DateCreatedUTC":"/Date(1329597731598+0000)/",
"DateUpdatedUTC":"/Date(1329597731598+0000)/",
"FileURL":"http://www.gomi.com/download/2/sourcemedia/399/tgwxngv/jkhkj.avi",
"InputMediaID":399,
"MimeType":"video/avi",
"Self":"media/input/399",
"SizeBytes":793340,
"SourceFilename":"jkhkj.avi",
"Status":"available",
"ThumbnailURL":"http://s3-us-west-1.amazonaws.com/gomi-dev1/sourcemedia/399/tgwxngv/399-image00001.jpg",
"Title":"",
"info":{
"AudioTrack":{
"AudioBitrateKbps":64,
"AudioChannelCount":2,
"AudioCodec":"MPEG Audio",
"AudioSampleRateHz":48000
},
"DurationSeconds":19,
"MediaContainerFormat":"AVI",
"TotalBitrateKbps":328,
"VideoTrack":{
"FrameRate":29.969999999999999,
"VideoCodec":"MPEG Audio"
}
}
},
"Success":true,
"ErrorCode":"",
"Message":""
}
<GetInputItemResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TranscodeEngine.API.v1.Models">
<ErrorCode i:nil="true" />
<Message i:nil="true" />
<InputAsset>
<DateCreatedUTC>2012-02-19T07:42:11.5982317</DateCreatedUTC>
<DateUpdatedUTC>2012-02-19T07:42:11.5982317</DateUpdatedUTC>
<FileURL>http://www.gomi.com/download/2/sourcemedia/399/tgwxngv/jkhkj.avi</FileURL>
<InputMediaID>399</InputMediaID>
<MimeType>video/avi</MimeType>
<Self>media/input/399</Self>
<SizeBytes>793340</SizeBytes>
<SourceFilename>jkhkj.avi</SourceFilename>
<Status>available</Status>
<ThumbnailURL>http://s3-us-west-1.amazonaws.com/gomi-dev1/sourcemedia/399/tgwxngv/399-image00001.jpg</ThumbnailURL>
<Title />
<info>
<AudioTrack>
<AudioBitrateKbps>64</AudioBitrateKbps>
<AudioChannelCount>2</AudioChannelCount>
<AudioCodec>MPEG Audio</AudioCodec>
<AudioSampleRateHz>48000</AudioSampleRateHz>
</AudioTrack>
<DurationSeconds>19</DurationSeconds>
<MediaContainerFormat>AVI</MediaContainerFormat>
<TotalBitrateKbps>328</TotalBitrateKbps>
<VideoTrack>
<FrameRate>29.97000</FrameRate>
<Height i:nil="true" />
<VideoBitrateKbps i:nil="true" />
<VideoCodec>MPEG Audio</VideoCodec>
<Width i:nil="true" />
</VideoTrack>
</info>
</InputAsset>
<Success>true</Success>
</GetInputItemResponse>
Note: Look at the 'Success' value in the response to determine if the request was successful. If not, details will be provided in the ErrorCode and Message fields.
Get All Output Media
Encoded videos are stored temporarily (2 days) by Gomi, and appear in Output Media.
Results from this query are paged.
Request
GET
http://api.gomi.com/api/v1/media/output?ApiKey={apikey}&format={json|xml}
Parameters
{ApiKey}
{format}
{pageSize}
{pageNumber}
Response JSON XML
{
"TotalAssetCount":9,
"PageSize":2,
"PageNumber":1,
"OutputAssets":[
{
"OutputMediaID":63119,
"Title":"Sample Video",
"SizeBytes":2288718,
"Status":"available",
"ThumbnailURL":"http://s3-us-west-1.amazonaws.com/gomi-test/output/63119/vzggdak/63119-image00001.jpg",
"FileURL":"http://test.gomi.com/download/3/output/63119/vzggdak/63119-hybla-fair.mp4",
"Filename":"63119-hybla-fair.mp4",
"DateCreatedUTC":"\/Date(1329543335793+0000)\/",
"DateUpdatedUTC":"\/Date(1329542969571+0000)\/",
"info":{
"MediaContainerFormat":"MPEG-4",
"TotalBitrateKbps":502,
"DurationSeconds":36,
"VideoTrack":{
"VideoCodec":"AAC",
"FrameRate":15.00000
},
"AudioTrack":{
"AudioCodec":"AAC",
"AudioSampleRateHz":24000,
"AudioChannelCount":2,
"AudioBitrateKbps":96
}
},
"Self":"media/output/63119"
},
{
"OutputMediaID":63118,
"Title":"Another Sample",
"SizeBytes":20031967,
"Status":"available",
"ThumbnailURL":"http://s3-us-west-1.amazonaws.com/gomi-test/output/63118/qhpdiwx/63118-image00001.jpg",
"FileURL":"http://test.gomi.com/download/3/output/63118/qhpdiwx/63118-FCL_1080p.mp4",
"Filename":"63118-FCL_1080p.mp4",
"DateCreatedUTC":"\/Date(1329297178890+0000)\/",
"DateUpdatedUTC":"\/Date(1329297098610+0000)\/",
"info":{
"MediaContainerFormat":"MPEG-4",
"TotalBitrateKbps":2217,
"DurationSeconds":72,
"VideoTrack":{
"VideoCodec":"AAC",
"FrameRate":23.97600
},
"AudioTrack":{
"AudioCodec":"AAC",
"AudioSampleRateHz":48000,
"AudioChannelCount":2,
"AudioBitrateKbps":160
}
},
"Self":"media/output/63118"
}
],
"Success":true,
"ErrorCode":"",
"Message":""
}
<GetOutputListResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TranscodeEngine.API.v1.Models">
<ErrorCode i:nil="true" />
<Message i:nil="true" />
<OutputAssets>
<OutputAsset>
<DateCreatedUTC>2012-02-18T05:35:35.793</DateCreatedUTC>
<DateUpdatedUTC>2012-02-18T05:29:29.5719226</DateUpdatedUTC>
<FileURL>http://test.gomi.com/download/3/output/63119/vzggdak/63119-hybla-fair.mp4</FileURL>
<Filename>63119-hybla-fair.mp4</Filename>
<OutputMediaID>63119</OutputMediaID>
<Self>media/output/63119</Self>
<SizeBytes>2288718</SizeBytes>
<Status>available</Status>
<ThumbnailURL>http://s3-us-west-1.amazonaws.com/gomi-test/output/63119/vzggdak/63119-image00001.jpg</ThumbnailURL>
<Title>test import</Title>
<info>
<AudioTrack>
<AudioBitrateKbps>96</AudioBitrateKbps>
<AudioChannelCount>2</AudioChannelCount>
<AudioCodec>AAC</AudioCodec>
<AudioSampleRateHz>24000</AudioSampleRateHz>
</AudioTrack>
<DurationSeconds>36</DurationSeconds>
<MediaContainerFormat>MPEG-4</MediaContainerFormat>
<TotalBitrateKbps>502</TotalBitrateKbps>
<VideoTrack>
<FrameRate>15.00000</FrameRate>
<Height i:nil="true" />
<VideoBitrateKbps i:nil="true" />
<VideoCodec>AAC</VideoCodec>
<Width i:nil="true" />
</VideoTrack>
</info>
</OutputAsset>
<OutputAsset>
<DateCreatedUTC>2012-02-15T09:12:58.89</DateCreatedUTC>
<DateUpdatedUTC>2012-02-15T09:11:38.6103901</DateUpdatedUTC>
<FileURL>http://test.gomi.com/download/3/output/63118/qhpdiwx/63118-FCL_1080p.mp4</FileURL>
<Filename>63118-FCL_1080p.mp4</Filename>
<OutputMediaID>63118</OutputMediaID>
<Self>media/output/63118</Self>
<SizeBytes>20031967</SizeBytes>
<Status>available</Status>
<ThumbnailURL>http://s3-us-west-1.amazonaws.com/gomi-test/output/63118/qhpdiwx/63118-image00001.jpg</ThumbnailURL>
<Title>sample</Title>
<info>
<AudioTrack>
<AudioBitrateKbps>160</AudioBitrateKbps>
<AudioChannelCount>2</AudioChannelCount>
<AudioCodec>AAC</AudioCodec>
<AudioSampleRateHz>48000</AudioSampleRateHz>
</AudioTrack>
<DurationSeconds>72</DurationSeconds>
<MediaContainerFormat>MPEG-4</MediaContainerFormat>
<TotalBitrateKbps>2217</TotalBitrateKbps>
<VideoTrack>
<FrameRate>23.97600</FrameRate>
<Height i:nil="true" />
<VideoBitrateKbps i:nil="true" />
<VideoCodec>AAC</VideoCodec>
<Width i:nil="true" />
</VideoTrack>
</info>
</OutputAsset>
</OutputAssets>
<PageNumber>1</PageNumber>
<PageSize>2</PageSize>
<Success>true</Success>
<TotalAssetCount>9</TotalAssetCount>
</GetOutputListResponse>
Note: Look at the 'Success' value in the response to determine if the request was successful. If not, details will be provided in the ErrorCode and Message fields.
Get Output Item
Get the details for an individual output media asset.
Request
GET
http://api.gomi.com/api/v1/media/output/{OutputMediaID}?ApiKey={apikey}&format={json|xml}
Parameters
{ApiKey}
{format}
Response JSON XML
{
"asset":{
"OutputMediaID":63119,
"Title":"test import",
"SizeBytes":2288718,
"Status":"available",
"ThumbnailURL":"http://s3-us-west-1.amazonaws.com/gomi-test/output/63119/vzggdak/63119-image00001.jpg",
"FileURL":"http://test.gomi.com/download/3/output/63119/vzggdak/63119-hybla-fair.mp4",
"Filename":"63119-hybla-fair.mp4",
"DateCreatedUTC":"\/Date(1329543335793+0000)\/",
"DateUpdatedUTC":"\/Date(1329542969571+0000)\/",
"info":{
"MediaContainerFormat":"MPEG-4",
"TotalBitrateKbps":502,
"DurationSeconds":36,
"VideoTrack":{
"VideoCodec":"AAC",
"FrameRate":15.00000
},
"AudioTrack":{
"AudioCodec":"AAC",
"AudioSampleRateHz":24000,
"AudioChannelCount":2,
"AudioBitrateKbps":96
}
},
"Self":"media/output/63119"
},
"Success":true,
"ErrorCode":"",
"Message":""
}
<GetOutputItemResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TranscodeEngine.API.v1.Models">
<ErrorCode i:nil="true" />
<Message i:nil="true" />
<Success>true</Success>
<asset>
<DateCreatedUTC>2012-02-18T05:35:35.793</DateCreatedUTC>
<DateUpdatedUTC>2012-02-18T05:29:29.5719226</DateUpdatedUTC>
<FileURL>http://test.gomi.com/download/3/output/63119/vzggdak/63119-hybla-fair.mp4</FileURL>
<Filename>63119-hybla-fair.mp4</Filename>
<OutputMediaID>63119</OutputMediaID>
<Self>media/output/63119</Self>
<SizeBytes>2288718</SizeBytes>
<Status>available</Status>
<ThumbnailURL>http://s3-us-west-1.amazonaws.com/gomi-test/output/63119/vzggdak/63119-image00001.jpg</ThumbnailURL>
<Title>test import</Title>
<info>
<AudioTrack>
<AudioBitrateKbps>96</AudioBitrateKbps>
<AudioChannelCount>2</AudioChannelCount>
<AudioCodec>AAC</AudioCodec>
<AudioSampleRateHz>24000</AudioSampleRateHz>
</AudioTrack>
<DurationSeconds>36</DurationSeconds>
<MediaContainerFormat>MPEG-4</MediaContainerFormat>
<TotalBitrateKbps>502</TotalBitrateKbps>
<VideoTrack>
<FrameRate>15.00000</FrameRate>
<Height i:nil="true" />
<VideoBitrateKbps i:nil="true" />
<VideoCodec>AAC</VideoCodec>
<Width i:nil="true" />
</VideoTrack>
</info>
</asset>
</GetOutputItemResponse>
Note: Look at the 'Success' value in the response to determine if the request was successful. If not, details will be provided in the ErrorCode and Message fields.
Job Completion Notification
When a job completes, whether successfully or unsuccessfully, your app can receive a notification of the outcome. This allows you to update your database, send notifications to your users etc.
Job Notifications follow the 'webhook' convention. They are basic form-urlencoded http post requests made to the URL of your choice. You can set a default ping url in your account settings. You can also override the ping url when you create a job via the api.
HTTP POST Notification Format
POST your_ping_url HTTP/1.1
Content-Type: application/x-www-form-urlencoded
JobID=1234&JobType=Encoding&Result=Success&FileName=your-encoded0-file.mp4&ErrorCode=&ErrorMessage=&
DownloadURL=http%3a%2f%2fgomi.com%2fdownload%2fyour-encoded0-file.mp4&OutputMediaID=14435&CustomerReferenceID=a4tg3fwe
Posted Fields
JobID
JobType
Result
ErrorCode
ErrorMessage
FileName
InputMediaID
DownloadURL
OutputMediaID
CustomerReferenceID
For encoding jobs, the CustomerReferenceID you provided for the output when creating the job.
Get Active Encoding Jobs
Returns information about all your active encoding jobs.
Results from this query are paged.
Request
GET
http://api.gomi.com/api/v1/job/active?ApiKey={apikey}
Parameters
{ApiKey}
{format}
{pageSize}
{pageNumber}
Response JSON XML
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{
"TotalItemCount":1,
"PageSize":20,
"PageNumber":1,
"jobs":[
{
"JobID":63070,
"ThumbnailURL":"http://images.gomi.com/sourcemedia/400/bapegvd/400-image00001.jpg",
"StartedMinutesAgo":0,
"MediaTitle":"",
"Status":"Encoding",
"ImportingProgress":100,
"EncodingProgress":30,
"StoringProgress":0,
"DistributionProgress":0,
"DateCreatedUTC":"\/Date(1331018014070+0000)\/",
"DateUpdatedUTC":"\/Date(1331018014070+0000)\/",
"Self":"job/63070"
}
],
"Success":true,
"ErrorCode":"",
"Message":""
}
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<GetActiveJobsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TranscodeEngine.API.v1.Models">
<ErrorCode i:nil="true" />
<Message i:nil="true" />
<PageNumber>1</PageNumber>
<PageSize>20</PageSize>
<Success>true</Success>
<TotalItemCount>1</TotalItemCount>
<jobs>
<JobStatusItem>
<DateCreatedUTC>2012-03-06T07:13:34.07</DateCreatedUTC>
<DateUpdatedUTC>2012-03-06T07:13:34.07</DateUpdatedUTC>
<DistributionProgress>0</DistributionProgress>
<EncodingProgress>30</EncodingProgress>
<ErrorCode i:nil="true" />
<ErrorMessage i:nil="true" />
<ImportingProgress>100</ImportingProgress>
<JobID>63070</JobID>
<MediaTitle />
<Self>job/63070</Self>
<StartedMinutesAgo>3</StartedMinutesAgo>
<Status>Encoding</Status>
<StoringProgress>0</StoringProgress>
<ThumbnailURL>http://images.gomi.com/sourcemedia/400/bapegvd/400-image00001.jpg</ThumbnailURL>
</JobStatusItem>
</jobs>
</GetActiveJobsResponse>
Response fields
Success
ErrorCode
ErrorMessage
TotalItemCount
PageSize
PageNumber
DateCreatedUTC
DateUpdatedUTC
JobID
ThumbnailURL
JobStatus
ImportProgress
EncodingProgress
StoringProgress
DistributionProgress
MediaTitle
Note: Look at the 'Success' value in the response to determine if the request was successful. If not, details will be provided in the ErrorCode and Message fields.
Create Ingest Job
Instructs Gomi to Ingest a video from a web or ftp server. You can optionally receive
an API notification when the ingest process is completed.
This method is maintly used if you want to split up the encoding process into two
steps; ingest then encoding, allowing you the flexibility to customise your encoding
request based on the input asset's metadata.
POST
http://api.gomi.com/api/v1/ingest/create?ApiKey={apikey}
Expected Request Body JSON XML
Host: api.gomi.com
Content-Type: application/json
Content-Length: length
{
"ApiKey":"String", //required
"SourceMediaURL":"String", //required
"title","String", //optional
"CustomerReferenceID":"String" //optional
}
Host: api.gomi.com
Content-Type: application/xml
Content-Length: length
<CreateIngest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TranscodeEngine.API.v1.Models">
<ApiKey>String</ApiKey>
<SourceMediaURL>String</SourceMediaURL>
<title>String</title>
<CustomerReferenceID>String</CustomerReferenceID>
</CreateIngest>
Parameters
{ApiKey}
{format}
SourceMediaURL
Title
CustomerReferenceID
Response Body JSON XML
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{
"IngestJobID":0,
"IngestJobStatusLocation":"ingest/0",
"CustomerReferenceID","String",
"InputMediaID":0,
"Success":false,
"ErrorCode":"String",
"Message":"String"
}
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<CreateIngestResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TranscodeEngine.API.v1.Models">
<IngestJobID>0</IngestJobID>
<IngestJobStatusLocation>ingest/0</IngestJobStatusLocation>
<CustomerReferenceID>String</CustomerReferenceID>
<InputMediaID>0</InputMediaID>
<ErrorCode>String</ErrorCode>
<Message>String</Message>
<Success>false</Success>
</CreateJobResponse>
Note: Look at the 'Success' value in the response to determine if the request was successful. If not, details will be provided in the ErrorCode and Message fields.
Get Active Ingests
Returns information about all your active ingest jobs.
Results from this query are paged.
Request
GET
http://api.gomi.com/api/v1/ingest/active?ApiKey={apikey}
Parameters
{ApiKey}
{format}
{pageSize}
{pageNumber}
Response JSON XML
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{
"TotalItemCount":1,
"PageSize":20,
"PageNumber":1,
"ingests":[
{
"IngestID":388,
"StartedMinutesAgo":2,
"Title":"Sample Video",
"IngestStatus":"AddedToQueue",
"SizeBytes":46249993,
"PrettySize":"44.11 MB",
"MimeType":"video/mp4",
"TransferProgress":0,
"StoringProgress":0,
"InputMediaID":0,
"DateCreatedUTC":"\/Date(1331031213379+0000)\/",
"DateUpdatedUTC":"\/Date(1331031213379+0000)\/",
"Self":"ingest/388"
}
],
"Success":true,
"ErrorCode":"",
"Message":""
}
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<GetActiveIngestsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TranscodeEngine.API.v1.Models">
<ErrorCode i:nil="true" />
<Message i:nil="true" />
<PageNumber>1</PageNumber>
<PageSize>20</PageSize>
<Success>true</Success>
<TotalItemCount>1</TotalItemCount>
<ingests>
<IngestStatusItem>
<DateCreatedUTC>2012-03-06T10:53:33.3796312</DateCreatedUTC>
<DateUpdatedUTC>2012-03-06T10:53:33.3796312</DateUpdatedUTC>
<ErrorCode i:nil="true" />
<ErrorMessage i:nil="true" />
<IngestID>388</IngestID>
<IngestStatus>AddedToQueue</IngestStatus>
<InputMediaID>0</InputMediaID>
<MimeType>video/mp4</MimeType>
<PrettySize>44.11 MB</PrettySize>
<RemoteURL i:nil="true" />
<Self>ingest/388</Self>
<SizeBytes>46249993</SizeBytes>
<StartedMinutesAgo>1</StartedMinutesAgo>
<StoringProgress>0</StoringProgress>
<Title>Sample Video</Title>
<TransferProgress>0</TransferProgress>
</IngestStatusItem>
</ingests>
</GetActiveIngestsResponse>
Response fields
Success
ErrorCode
ErrorMessage
TotalItemCount
PageSize
PageNumber
DateCreatedUTC
DateUpdatedUTC
IngestID
InputMediaID
MimeType
SizeBytes
PrettySize
RemoteURL
IngestStatus
TransferProgress
StoringProgress
Title
StartedMinutesAgo
Create Encoding Job from Input Media
Instructs Gomi to create jobs to encode already ingested Input Media into one or more output formats. The encoded Output Media can be delivered to your server & API Notifications sent on completion.
POST
http://api.gomi.com/api/v1/job/CreateJobFromInputMedia?ApiKey={apikey}
Expected Request Body JSON XML
Host: api.gomi.com
Content-Type: application/json
Content-Length: length
{
"ApiKey":"String", //required
"InputMediaID":"String", //required
"OutputJobs":[
{
"OutputFormatID":0, //required
"Title":"String", //optional
"CustomerReferenceID":"String", //optional
"DeliveryLocation":"String", //optional
"NotificationEmailAddress":"String", //optional
"Metadata":"String", //optional
"PingUrl":"String", //optional
"AudioBitrate":128, //optional
"AudioChannelsID":2, //optional
"AudioCodecCode":"String", //optional
"AudioSampleRateID":48000, //optional
"DeInterlace":false, //optional
"FrameRateID":10, //optional
"Width":720, //optional
"Height":576, //optional
"KeepAspectRatio":true, //optional
"VideoResizeMethodCode":"String", //optional
"MediaContainerCode":"String", //optional
"TwoPassEncoding":false, //optional
"VideoBitrate":1024, //optional
"VideoCodecCode":"String" //optional
"OverlayOffsetFrom":"String" //optional
"OverlayImageUri":"String" //optional
"OverlayOffsetX":10 //optional
"OverlayOffsetY":10 //optional
"NewFilename":"String" //optional
"ForcedKeyFrameInterval":0 //optional
"FixedKeyFrameInterval":false //optional
}
]
}
Host: api.gomi.com
Content-Type: application/xml
Content-Length: length
<CreateJobFromInputMedia xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TranscodeEngine.API.v1.Models">
<ApiKey>String</ApiKey>
<InputMediaID>String</InputMediaID>
<OutputJobs>
<OutputJobItem>
<OutputFormatID>0</OutputFormatID>
<Title>String</Title>
<CustomerReferenceID>String</CustomerReferenceID>
<DeliveryLocation>String</DeliveryLocation>
<Metadata>String</Metadata>
<PingUrl>String</PingUrl>
<NotificationEmailAddress>String</NotificationEmailAddress>
<AudioBitrate i:nil="true" />
<AudioChannelsID i:nil="true" />
<AudioCodecCode>String</AudioCodecCode>
<AudioSampleRateID i:nil="true" />
<DeInterlace i:nil="true" />
<FrameRateID i:nil="true" />
<Width i:nil="true" />
<Height i:nil="true" />
<KeepAspectRatio i:nil="true" />
<VideoResizeMethodCode>String</VideoResizeMethodCode>
<MediaContainerCode>String</MediaContainerCode>
<TwoPassEncoding i:nil="true" />
<VideoBitrate i:nil="true" />
<VideoCodecCode>String</VideoCodecCode>
<OverlayOffsetFrom>String</OverlayOffsetFrom>
<OverlayImageUri>String</OverlayOffsetUri>
<OverlayOffsetX i:nil="true" />
<OverlayOffsetY i:nil="true" />
<NewFilename>String</NewFilename>
<ForcedKeyFrameInterval i:nil="true" />
<FixedKeyFrameInterval i:nil="true" />
</OutputJobItem>
</OutputJobs>
</CreateJob>
Parameters
{ApiKey}
{format}
InputMediaID
Advanced: Gomi supports joining multiple video files together. To use this functionality, just specify multiple InputMediaID's separated by the pipe "|" character.
e.g. "30023|31063|12086"
Gomi will automatically join them during encoding.
OutputFormatID
Title
CustomerReferenceID
DeliveryLocation
Metadata
Accepts a string containing Url encoded key-value pairs of metadata tags in the format: "Key1=Value1&Key2=Value2". This is the same as a standard Url querystring.
e.g. "title=MyTitle&album=MyAlbum" Optional
PingUrl
NotificationEmailAddress
MediaContainerCode
Valid Values:
For audio & video: 3g2, 3gp, avi, dvd-ntsc-iso, dvd-ntsc-mpg, dvd-pal-iso, dvd-pal-mpg, fl9, flv, matroska, mov, mp4, mpegts, mxf, ogg, webm, wmv, wmv9
For video only:mjpeg, mpeg2video
For audio only: aac, flac, m4a, mp3, wav, wma
VideoCodecCode
Valid Values:
copy (copy source stream)
none (no audio)
flv, h263, h264, h264base, huffyuv, libtheora, libvpx, mjpeg, mpeg1video, mpeg2video, mpeg4, mpgNtscDvd, mpgPalDvd, VC-1, VC-1Adv, VC-1Simple, wmv1, wmv2, xvid
Width
Note, if Width is specified but Height is 0, scales the video to the specified Width while maintaining proportions.
Height
Note, if Height is specified but Width is 0, scales the video to the specified height while maintaining proportions.
KeepAspectRatio
When set to true, attempts to maintain the video's pixel aspect ratio by Cropping and/or Padding the output video. The combination or cropping/padding is controlled by the ResizeMethod parameter.
WMV9 Only: When KeepAspectRatio is true, resizes the video to the largest size that fits within the output Width/Height box while maintaining aspect ratio without cropping or padding.
VideoBitrate
VideoResizeMethodCode
Valid Values:
Auto (Pads a little and Crops a little as necessary to maintain original aspect ratio)
Letterbox (Pads as necessary to maintain original aspect ratio)
PanScan (Crops as necessary to maintain original aspect ratio)
FrameRateID
Valid Values:
-1 (same as source)
10000 (10.0 frames per second)
11988 (11.988 frames per second)
12000 (12.0 frames per second)
14985 (14.985 frames per second)
15000 (15.0 frames per second)
20000 (20.0 frames per second)
23976 (23.976 frames per second)
24000 (24.0 frames per second)
25000 (25.0 frames per second)
29970 (29.97 frames per second)
30000 (30.0 frames per second)
AudioCodecCode
Valid Values:
copy (copy source stream)
none (no audio)
aac, ac3, amr-nb, flac, mp2, mp3, pcm-s16BE, pcm-s16LE, pcm-u8, vorbis, wmaLossless, wmaProfessional, wmaStandard, wmav2, wmaVoice
AudioBitrate
AudioSampleRateID
Valid Values:
-1 (same as source)
8000 (8,000 hz)
11025 (11,025 hz)
16000 (16,000 hz)
22000 (22,000 hz)
22050 (22,050 hz)
24000 (24,000 hz)
32000 (32,000 hz)
44000 (44,000 hz)
44100 (44,100 hz)
48000 (48,000 hz)
192000 (192,000 hz)
AudioChannelsID
Valid Values:
1 (Mono)
2 (Stereo)
OverlayOffsetFrom
Valid values: TopLeft, TopRight, BottomLeft, BottomRight, Center
OverlayImageUri
OverlayOffsetX
e.g. if OverlayOffsetX = 10 and OverlayOffsetFrom=BottomRight, the overlay image will be rendered with a 10 pixels gap to the left of the bottom right corner.
OverlayOffsetY
e.g. if OverlayOffsetY = 10 and OverlayOffsetFrom=BottomRight, the overlay image will be rendered with a 10 pixels gap above the bottom right corner.
NewFilename
Gomi will still append the standard file extension to the value provided here for the specified output media container.
You can also include a few predefined variables:
"[OutputMediaAssetID]" - will be replaced with the Gomi's output media asset ID. e.g "[OutputMediaAssetID]-mynewfilename" will become 42345254-mynewfilename
"[SourceMediaFilename]" - will be replaced with the source filename of the input media.
Gomi by default uses a naming convention of "[OutputMediaAssetID]-[SourceMediaFilename]". The OutputMediaAssetID helps to ensure unique filenames when files are delivered to your server.
ForcedKeyFrameInterval
By setting this value you force the encoder to place a keyframe at the specfied frame interval. e.g. specifying 60 forces a keyframe every 60 frames.
You should set this when targetting certain adaptive streaming protocols such as Apple HLS, Microsoft Smooth Streaming & Adobe Dynamic Streaming.
Setting ForcedKeyFrameInterval still allows other key frames to be inserted by the encoder such as at scene changes. This behaviour can be modified by the "FixedKeyFrameInterval" parameter.
FixedKeyFrameInterval
Defaults to false. When set to true, does not allow the encoder to insert extra key frames except those specified by the FixedKeyFrameInterval parameter
This is often desirable when targeting the adaptive streaming protocols.
Response Body JSON XML
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{
"InputMediaID":"String",
"OutputJobs":[
{
"JobID":0,
"CustomerReferenceID":"String",
"Success":true,
"ErrorCode":String,
"Message":String,
"JobStatusLocation":"job/0"
}
],
"Success":false,
"ErrorCode":"String",
"Message":"String"
}
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<CreateJobFromInputMediaResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TranscodeEngine.API.v1.Models">
<InputMediaID>String</InputMediaID>
<OutputJobs>
<JobCreationStatus>
<CustomerReferenceID>String</CustomerReferenceID>
<JobID>0</JobID>
<JobStatusLocation>job/0</JobStatusLocation>
<Success>true</Success>
<ErrorCode>String</ErrorCode>
<ErrorMessage>String</ErrorMessage>
</JobCreationStatus>
</OutputJobs>
<Success>false</Success>
<ErrorCode>String</ErrorCode>
<Message>String</Message>
</CreateJobResponse>
Note: Look at the 'Success' value in the response to determine if the request was successful. If not, details will be provided in the ErrorCode and Message fields.