Audio
Overview
MediaFire's remarkable audio transcorder allows you to transcode audio in real time from many types of formats. In the sections below, detailed information will be
given including supported formats for audio transcoding, how to prepare a transcoding request, and how to make a transcoding request.
Note: This API is restricted. If you wish to enable this feature in your app, please contact customer service.
Supported Inputs
The following audio types are supported in the MediaFire Multimedia API.
Extension | Mimetype | Name |
---|---|---|
ac3 | audio/ac3 | Audio Coding 3 |
wma | audio/x-ms-wma | Windows Media Audio |
wav | audio/x-wav | Waveform Audio File |
mp3 | audio/mpeg | Moving Pictures Expert Group Audio Layer 3 |
ogg | audio/ogg | Ogg Vorbis I Profile |
aiff | audio/x-aiff | Auto Interchange File Format |
ogg | application/ogg | Ogg Vorbis I Profile |
wma | video/x-ms-asf | Windows Media Audio |
oga | application/ogg | Ogg Audio Profile |
m4a | audio/mp4 | Moving Pictures Expert Group Audio Layer 4 |
aac | audio/x-hx-aac-adts | Advanced Audio Coding |
Supported Outputs
The following audio types are supported in the MediaFire Multimedia API.
Container Type | Quality | Bitrate |
---|---|---|
mp3 | default | 256 kbps |
Preparing the Transcoding Request
Follow these steps to prepare to make a transcoding request:
Step 1: Check the file object 'view' property. File objects are returned by several APIs. Examples of such APIs are folder/get_content, file/get_info, and folder/search. A value of '4' indicates the audio can be transcoded.
Step 2: Once you have confirmed that the file can be transcoded, use file/get_links API to obtain a default 'streaming' url.
Step 3: The default 'streaming' url query string parameters will need to be modified to suit your request.
https://www.mediafire.com/api/1.2/file/get_links.php?session_token=2b0b2f6b6d6374830f1654a4004d1cfe0a67d88ba9ab949f22aff9d49c87fe0e37ef7fb675ef504c481f2b6d07c1fe487437c4984760c90dd7b602ddce0e45e72fad1630b719dc6d&quick_key=172pwp7c8dyngpq&link_type=streaming
<response>
<action>file/get_links</action>
<links>
<link>
<quickkey>172pwp7c8dyngpq</quickkey>
<streaming>http://transcode1.mediafire.com/m22ztdtwu0rg/172pwp7c8dyngpq/e95a/Mario.wav</streaming>
</link>
</links>
<direct_download_free_bandwidth>8</direct_download_free_bandwidth>
<result>Success</result>
<current_api_version>1.2</current_api_version>
</response>
Making the Transcoding Request
Below are the required parameters, and other important information, to make your audio transcoding request.
Required Parameters:
- container : Required in absence of other GET parameters. Allowed container type: 'mp3'. Defaults to 'mp3'. (Only 'mp3' is supported at this time).
Optional Parameters:
- exists : The exists parameter can be used to inspect the transcoding state of an input file. There are three possible values: The first value is 'check' and it indicates if the file is loaded on the server. It will not load the file to the server if it is not present. The value 'create' indicates if the video is loaded on the server. If it is not, it will trigger the loading process. The third value is 'status' and it will provide detailed information about the transcoding process once the loading phase has been initiated. You can only get the status of a input file once the loading process has started. Calling it before then will result in an error.
Details about the exists parameter:
If a value of check is supplied to the 'exists' parameter, the following response will be returned immediately:
<state>true</state> // file exists in specified format
or
<state>false</state> // file does not exist in specified format
If a value of create is supplied to the 'exists' parameter, the following response will be returned immediately:
<state>true</state> // file already exists in specified format
or
<state>false</state> // file does not exist in specified format. Begin tftp transfer.
If a value of status is supplied to the 'exists' parameter a response will be returned immediately with the following properties:
<response>
<tftp_progress>0</tftp_progress>
<audio_bitrate>0</audio_bitrate>
<duration>0</duration>
<original_filesize>0</original_filesize>
<transcoded_filesize>0</transcoded_filesize>
<status>transferring</status>
<schema_version>2</schema_version>
</response>
Response properties are defined below:
- tftp_progress : Ranges between '0-100', and 'ready'. Describes the progress of the tftp transfer. The ready state has been deprecated as of schema_version 3 and will be removed in the future. New programs should be written to check the 'status' property to determine whether the file is ready to be streamed.
- audio_bitrate : The audio bitrate in bits per second: This is 0 if the audio bitrate is not known yet.
- duration : The duration of the audio in seconds. This is 0 if the audio duration is not known yet.
- original_filesize : The size of the original file in bytes. This is 0 if the filesize is not known yet.
- transcoded_filesize : This is the size of the transcoded audio file. This is 0 if the audio has not be completely transcoded yet.
- status : The state of the transcode. Valid values are: 'transferring', 'converting', 'ready', & 'error'. Transferring indicates that the loading process is under way. Converting indicates that the loading process has completed. When the transcoding state of the file is 'converting' the stream will be served with the HTTP header 'transfer-encoding' set to 'chunked'. When the state of the file is set to 'ready' the stream will be served as a traditional payload supporting the Range-Request header.
- schema_version : This property indicates the schema version of this response. If any response related to the streaming APIs change, this number will increment.
Below are typical examples to request audio:
1. http://transcode1.mediafire.com/m22ztdtwu0rg/172pwp7c8dyngpq/e95a/Mario.mp3?container=mp3&exists=create
2. If state is true, we can skip immediately to 5.
3. http://transcode1.mediafire.com/m22ztdtwu0rg/172pwp7c8dyngpq/e95a/Mario.mp3?container=mp3&exists=status
4. Keep calling 2 until status indicates "converting" or "ready"
5. http://transcode1.mediafire.com/m22ztdtwu0rg/172pwp7c8dyngpq/e95a/Mario.mp3?container=mp3