MediaPlug
REST API

HomePage | REST API | Javascript API | Ruby API

Image API | Audio API | Video API | Recache API | Virus Scan API | YouTube API | Metadata API

REST API Usage

Some actions are performed in real-time and others, such as video transcoding, are queued and processed asynchronously.

The first call to the url may return a status of 202 which means the content is queued and will be available once it’s encoded. Subsequent calls to the same url will return the encoded file if it is completed.

Here’s a good source for sample video and audio files which you can test with demo.gomediaplug.com.

URL Structure

http://[mediaplug_server]/mp/get?mpsrc=[mpsrc]&mpaction=[mpaction]

mediaplug_server: The IP address or domain name of your MediaPlug Server. If you plan on using more than one instance of MediaPlug we suggest you load balance them with round-robin DNS, a software load balancer, or hardware load balancer and make them available through a single URL which you can use for your mediaplug_server. Using DNS for this value is also a good idea if you ever replace a server since you won’t have to change any application code to use the new server.

mpsrc: Full URL of the original file you would like to perform an action on

mpaction: The action you would like to perform. Further REST API documentation refers to the mpaction variable. For each action an example is given for the mpaction variable as well as an example of a full REST URL to perform the action.

Note: For testing, mediaplug_server is demo.gomediaplug.com

Note: all url’s must be url encoded.

Images

MediaPlug can handle a range of image manipulation tasks including resizing, cropping, flipping, rotating, and watermarking with images or text.

Image API

Audio:

convert mp3 bitrate=[BITRATE] samplerate=[SAMPLERATE]
mpaction=convert format=mp3 bitrate=64k samplerate=128
example:
http://ec2-72-44-48-174.compute-1.amazonaws.com/mp/get?mpsrc=http://freewavesamples.com/files/Applause.wav&mpaction=convert%20format=mp3%20bitrate=128k%20samplerate=44.1

Video:

format can be flv, ipod, psp, 3gpp:
convert format=flv
mpaction=convert format=flv

Video Thumbnailing

thumbnail [frame]
mpaction=thumbnail frame=5

Recaching

All encoded files are cached on S3 so that processing occurs once. MediaPlug allows you to recache files you wish to update.

Recache API

Virus scanning

mpaction=scanvirus
examples of files with viruses:
http://demo.gomediaplug.com/mp/get?mpsrc=http://www.eicar.org/download/eicar.com&mpaction=scanvirus
http://demo.gomediaplug.com/mp/get?mpsrc=http://www.eicar.org/download/eicar_com.zip&mpaction=scanvirus
http://demo.gomediaplug.com/mp/get?mpsrc=http://www.eicar.org/download/eicar.com.txt&mpaction=scanvirus
examples of clean file:
http://demo.gomediaplug.com/mp/get?mpsrc=http://www.ccp14.ac.uk/ccp/ccp14/ftp-mirror/nist-texture/test.txt&mpaction=scanvirus

YouTube Videos:

MediaPlug can accept YouTube videos by providing the YouTube video URL as the mpsrc

mpsrc=[youtube url]
mpaction=convert format=[format]
http://demo.gomediaplug.com/mp/get?mpsrc=http://www.youtube.com/watch?v=c2JChnwv2Ws&mpaction=convert%20format=flv

Metadata:

MediaPlug allows for the retrieval of metadata for an encoded file.

Metadata API