The task: A provided input video file will be converted to different resolutions (e.g. 720p, 480p, 360p) and make it ready for HTTP streaming. Also, the curent resolution and codecs of the input file should be considered and a thumbnail will be created.

First we need to know what exactly the input file contains: codecs, video resolution etc. Based on this information we want to convert the video later. Also, we want to generate a thumbnail of the video.

1. Getting the Process URL

As always, we need a Process URL first. Therefore we need our personal API Key. Because we are not doing any conversion in part 1, we need to set mode to info. Click "Execute" to request the Process URL.

POST https://api.cloudconvert.com/process

    

2. Starting the Process

Using the obtained Process URL, the process is started using the following request. To get information about the input file, we do not set the outputformat option. Also, we set thumbnail_format to get a thumbnail of the video. We set thumbnail_size to 400x, which means the width of the thumbnail should be 400 and the height will be automatically set based on the video resolution.

POST https://...cloudconvert.com/process/...

    

3. Refresh the status

Therefore do GET request to the Process URL. Do this unless the step is "finished"

GET https://...cloudconvert.com/process/...
    

When the process is finished, info and thumbnails is available.

Because of info.streams.height we know now that the input file is 1080p. So it makes sense to offer additional 720p, 480p and 360p videos. We will convert to these output resolutions in part 2.

Using the collected information we now want to convert the video to different resolutions.

1. Getting the Process URL

We need to create another Process URL.

POST https://api.cloudconvert.com/process
	
    
	

2. Starting the Process

Using the obtained Process URL, the process is started using the following request. We set the outputformat to mp4 this time. As input file parameter we use the input.url of the process of part 1 - so we do not need to upload the file again. We set the video_codec, the video_resolution and a constant rate facor video_crf which influences the video quality and size. The default is 23, which is a good starting point. A lower value means higher quality. Also we set the faststart option, which mooves the video information (moov atom) to the front of the file. This is needed for HTTP streaming.

All possible options can be identified with the Conversion types API and/or the API console.

POST https://...cloudconvert.com/process/...
	
    
	

3. Refresh the status

Therefore do GET request to the Process URL. Do this unless the step is "finished"

GET https://...cloudconvert.com/process/...
    
	

4. Download the output file

When the process is finished, output.url is available, which refers to the output video. We can do part 2 again for different video resolutions.