Convert your animations in four simple steps
Upload your creative as either:
Specify rendering options including:
Automatic notifications when:
Optional monitoring through our:
https://html5animationtogif.com/api/uploadzip.ashx
Upload a compressed archive containing your HTML5 creative package. Your submission must include:
A single HTML file (entry point)
All associated resources (CSS, JavaScript, and images)
Response
Upon successful upload, you'll receive a creativeid
in the response. Store this identifier for all subsequent API calls.
Alternative Submission Method
For animations hosted on your server, use our UploadUrl
service instead of zip file upload.
Parameter | Type | Required | Description |
---|---|---|---|
FileData | multi-part form data | Yes | Submit your HTML5 creative (zip) as a multi-part form data upload |
POST https://html5animationtogif.com/api/uploadzip.ashx HTTP/1.1 Host: html5animationtogif.com Content-Type: application/binary const formData = new FormData(); formData.append('file', document.querySelector('input[type=file]').files[0]); fetch('https://html5animationtogif.com/api/uploadzip.ashx', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => console.log(data));
{ "status": "success", "creativeid": "creative_550x550_10ed7e8783" } Or { "status": " error ", "message” ": "No file has been uploaded. " }
https://html5animationtogif.com/api/uploadurl.ashx
Submit a publicly accessible URL of your hosted HTML5 creative for processing.
Response
Upon successful upload, you'll receive a creativeid
in the response. Store this identifier for all subsequent API calls.
Parameter | Type | Required | Description |
---|---|---|---|
url | string | Yes | Post your HTML5 creative URL |
POST https://html5animationtogif.com/api/uploadurl.ashx HTTP/1.1 Host: html5animationtogif.com Content-Type: text/plain var data = new FormData(); data.append("url", "https://previews.envatousercontent.com/files/240056227/banners/A/728x90/index.html"); // URL of creative hosted on your server var xhr = new XMLHttpRequest(); xhr.open('POST', 'https://html5animationtogif.com/api/uploadurl.ashx', true); xhr.onload = function () { var response = JSON.parse(xhr.responseText); if (response.status == "success") { creativeid = response.creativeid; console.log("creativeid=" + creativeid); //convert_video(creativeid); } else { alert(response.message) }
{ "status": "success", "creativeid": "creative_550x550_10ed7e8783" } Or { "status": " error ", "message” ": "No file has been uploaded. " }
https://html5animationtogif.com/api/converttovideo.ashx
Converts your HTML5 creative into video format through asynchronous rendering.
Parameter | Type | Required | Description |
---|---|---|---|
clientid | string | Yes | A unique customer ID, generated when the 'Obtain API Key and Client ID' link is clicked, and subsequently sent via email. |
apikey | string | Yes | A unique key, generated when the 'Obtain API Key and Client ID' link is clicked, and subsequently sent via email. |
creativeid | string | Yes | The creativeId is a unique identifier returned after successfully uploading your HTML5 content through either: UploadZip or UploadUrl service. |
width | integer | Yes | Output width in pixels. |
height | integer | Yes | Output height in pixels. |
duration | float | Yes | Length of animation. |
starttime | float | No | Skips the initial few seconds of the animation before recording the video. The default value is 0. |
fps | integer | Yes |
Specifies the number of frames per second in the video output. Available options: Recommendation: Use |
audio | string | No | Specifies whether to record the audio used in the animation and attach it to the video. Use Y to enable audio, or N to disable it. Default value: N |
webhookurl | string | No |
Default value:
The webhook is a notification mechanism that allows your application to receive an update once a video is successfully created.
To use it, provide the HTTP URL of your application via the
Example:
How to access parameters (C# example):
|
creativefitoption | string | No |
Possible values: Default value: Use Use |
bitratevalue | integer | No |
This option specifies the bitrate value for CBR (Constant Bit Rate) encoding.
Allowed range: |
POST https://html5animationtogif.com/api/converttovideo.ashx HTTP/1.1 Host: html5animationtogif.com Content-Type: text/plain var data = new FormData(); data.append("clientid", clientid); data.append("apikey", apikey); data.append("creativeid", id); data.append("width", "300"); data.append("height", "600"); data.append("duration", "8"); data.append("fps", "60"); data.append("audio", "N"); data.append("webhookurl", ""); data.append("creativefitoption", "center"); data.append("bitratevalue", "17"); var xhr = new XMLHttpRequest(); xhr.open('POST', 'https://html5animationtogif.com/api/converttovideo.ashx', true); xhr.onload = function () { var response = JSON.parse(xhr.responseText); if (response.status == "success") { mediaid = response.mediaid; console.log("Video " + mediaid + "."); alert("Video " + mediaid + "."); //WaitForOutput(); } else { alert(response.message) } }; xhr.send(data);
{ "status": "success", "message": "", " mediaid ": "34488" } Or { "status": "error", "message": "error message" }
https://html5animationtogif.com/api/checkstatus.ashx
This service allows you to check the conversion status.
It should be called after invoking the converttovideo service. You can call it periodically—for example, every 5 seconds.
Parameter | Type | Required | Description |
---|---|---|---|
creativeid | string | Yes | The creativeId is a unique identifier returned after successfully uploading your HTML5 content through either: UploadZip or UploadUrl service. |
mediaid | string | Yes | The mediaid is a unique identifier returned by the ConvertToVideo service. |
fileext | string | Yes | The file extension for an MP4 file. (i.e mp4) |
GET https://html5animationtogif.com/api/checkstatus.ashx HTTP/1.1 Host: html5animationtogif.com Content-Type: text/plain function WaitForOutput() { var xhr = new XMLHttpRequest(); xhr.open('GET', "https://html5animationtogif.com/api/checkstatus.ashx?creativeid=" + creativeid + "&mediaid=" + mediaid + "&fileext=mp4", true); xhr.onload = function () { var response = JSON.parse(xhr.responseText); if (response.status == "success") { if (response.jobstatus != "done") { window.setTimeout(WaitForOutput, 5000); } else if (response.jobstatus == "done") { var URL=response.url; } } else if (response.status == "error") { alert(response.message) } }; xhr.send(); }
Parameter | Type | Description |
---|---|---|
status | string |
The
"success" - The operation completed successfully
"error" - The operation failed (check error details)
|
jobstatus | string |
The
Pending
Initial state when request is queued
XX%
Percentage complete (e.g., 25%, 50%, 75%)
Done
Processing successfully completed
Note: Percentage values may not increment linearly due to varying processing stages.
|
message | string | Indicates the error message, if any occurred during processing. |
url | string | The download URL of the generated MP4 video. |
Specifies, scrapping of content { “status”: "success", "jobstatus": "Scraping content. Please wait...", "url": "" } Specifies, encoding of video { "status": "success", "jobstatus": "20%", "url": "" } { "status": "success", "jobstatus": "40%", "url": "" } { "status": "success", "jobstatus": "90%", "url": "" } Specifies, video has been created. { "status": "success", "jobstatus": "done", "url": "https://html5animationtogif.com/API/mediadownload.ashx?mediaid=34488&creativeid=creative_550x550_10ed7e8783&fileext=mp4&inline=y" }
When recording HTML5 animations to video, two key challenges arise:
Add these JavaScript functions to your HTML5 creative:
Call this when your actual animation begins (after loaders/initialization):
function animationStart() {
// Your animation code
if (typeof trim_start === 'function') {
trim_start(); // Signals actual content beginning
}
}
Call this when your animation completely finishes:
function animationEnd() {
// Cleanup code
if (typeof trim_end === 'function') {
trim_end(); // Signals content completion
}
}
// Place the code in your JavaScript file
var trim_request_url = "http://localhost/capturestart/trim_media.ashx";
function trim_start()
{
try {
var timeinmilisec = Math.abs(new Date() - new Date("1970/01/01"));
var request = new XMLHttpRequest();
request.open('GET', trim_request_url + "?action=start&time=" + timeinmilisec, true);
request.send(null);
} catch{ }
}
function trim_end() {
try {
var timeinmilisec = Math.abs(new Date() - new Date("1970/01/01"));
var request = new XMLHttpRequest();
request.open('GET', trim_request_url + "?action=end&time=" + timeinmilisec, true);
request.send(null);
} catch{ }
}
Renderer opens HTML5 creative in browser (load time begins)
Animation calls trim_media.ashx?action=start
(3s in example)
Animation calls trim_media.ashx?action=end
(9s total in example)
Renderer records 4s extra (13s total in example
Renderer creates 6s video