Encoding

This topic answers basic questions about video encoding.

Encoding questions

What settings should I use?

Start with the defaults. We've put a lot of thought into our default settings, so you'll probably be OK if you stick close to those.

Generally, you want to adjust the following settings.

Choose the right codecs for your target application. All of our codecs play back on the web, but H.264 has the widest compatibility and the best quality. If that's what you're looking for, use H.264 + AAC (or maybe MP3). At the moment, it's also your best bet for mobile device compatibility. If you want something with no licensing issues VP8 + Vorbis is pretty good (though new), and Theora + Vorbis is a more established option.

Determine a target resolution, a strategy for aspect ratio conversion, and whether or not you want to upscale videos that are smaller than your target. (It's often smart to leave smaller videos small, and scale them within your player. That saves you kilobits and bandwidth.)

After that, pick a video bitrate. Bitrate is the most important factor in determining how good a video will look. We recommend setting a target quality rather than a bitrate, since it isn't efficient to apply the same bitrate to videos of different sizes/shapes/content. Pick a quality setting based on the quality/size tradeoff: quality 3 looks quite good (better than most web video), quality 4 looks great, and quality 5 is near-lossless. Choose quality 2 if you want decent video in a small bitrate, and quality 1 for low bandwidth situations. Audio quality is also worth considering; quality 2-3 is usually pretty good, and consider quality 4 if music or soundtrack fidelity is important.

Beyond that, other settings are really optional. You can probably ignore most of them, and some of them might even be detrimental to the quality of your video. For example, forcing video to a different frame rate can make the video look choppy, and manually setting the audio sample rate can cause encoding errors.

See our API docs for more.

How do I get the best quality?

Of course, there is no "best". There are tradeoffs, and better and worse choices, but there is no perfect set of encoding settings. End disclaimer.

The first step to achieving high quality output videos is to have high quality input videos. If possible, send us good quality video at the same size, or larger, than the output you want, and at a higher quality than you think you'll need. (Of course, if you're dealing with UGC, this isn't always up to you.)

Second, don't skimp on file size. Bitrate is far more important to video quality than anything else. If you ask for 1080p video at 300kbps, it's probably going to look bad no matter what other options you choose. If quality is a priority, setting video quality to 4 is usually a good bet. Audio quality 3 sounds pretty good, but 4 is even better.

Third, if you're using H.264, try using the Main or High profile. These are a bit more CPU-intensive, but result in much better quality video. But they won't work on an iPhone.

Fourth, there are a few advanced settings you can try. If your input is highly compressed and blocky, you can use our Deblock filter. If you want to squeeze in 5%-10% more quality at the same bitrate, try setting Denoise to "weak" or "medium".

Fifth, slow down the encoding. Set Speed to 1 or 2, which will allow our encoder to apply a few psycho-visual optimizations that we don't apply on faster encoding.

Just remember that these are tradeoffs. Our default encoding, with no additional settings, looks pretty good. At the end of the day, you're making tradeoffs between visual quality, encoding speed, and file size.

Can Zencoder encode audio-only files?

Yes. We can convert audio files to MP3, AAC, or Vorbis. We can also export the audio from video files.

I am going to submit a lot of jobs, can Zencoder handle it? Should I let you know before I start?

Zencoder can definitely handle it. Unless you're going to be running in to our API rate limit of 1,000 job creation requests per minute you shouldn't need to warn us before submitting your jobs.

In fact, we're more concerned that we might overwhelm your servers if you're sending through a very large volume of jobs. The only delay you should see from Zencoder will be the time it takes to bring the necessary encoding servers online to handle your jobs if the volume exceeds our current capacity. If this happens it should take no more than a few minutes from your initial request before additional capacity is available. After that, the biggest concerns will be how your servers can handle the traffic from Zencoder. If that initial delay will impact your transcoding, get in touch with us before you start submitting so we can bring additional servers online in anticipation.

File Transfer Concerns to Consider

If you're using S3 for input and output destinations then you should be good to go, as they can handle significant transfer volume, especially within the same region.

If you're using FTP servers you may want to throttle your jobs back some and run them in batches of 50 to 500, depending on the capacity of your servers. We've had experiences with large job volume completely overwhelming FTP servers and causing jobs to fail since we can't get to the files.

Be sure to account for the necessary bandwidth if the output files are going to the same server as the input files. Downloading may work fine on the first batch of jobs but start to suffer once uploading of outputs begins.

Notification Concerns to Consider

If you are using notifications the same concern applies. Will your server be able to handle (potentially) hundreds of POSTs from Zencoder in rapid succession?

This is a bit less of a concern, as we will retry failed notifications up to 25 times, and the files will already have been uploaded. However, if your videos are on the same server, or being uploaded to the same server, that is receiving notifications, this could cause successive jobs to fail if the server becomes overwhelmed.

The best way to avoid notification overload on your server is to respond successfully to Zencoder as quickly as possible when the notification comes in. We recommend doing any processing of the body of the notification outside of the scope of the response, using a job queue or other background processing. This will ensure that Zencoder doesn't timeout the notification and attempt again a few seconds later.