The HW Blog

Want to be updated? @HeyWatch | Feed

HEVC and VP9 now supported (Beta)

Eric Fontaine (@EricFontaine_)

On April 16, 2014

We are excited to announce our support for the next generation encoding HEVC and VP9 codecs in beta.

Adding these new video codecs will allow HeyWatch to bring cloud video encoding to a whole new level in meeting the highest video industry requirements. HEVC video codec delivers 50% better compression than its H.264 predecessor.

Trying the HEVC or VP9 codecs is simple thanks to the dynamic format IDs and their simple syntax:

  • HEVC with MP4 container: mp4:hevc
  • VP9 with WebM container: webm:vp9

HEVC and VP9 are the future of video and promise to deliver even higher video quality for an incredible lower video bit rate, which will be great for Ultra High Definition and 4K standard.


Specifying codecs in dynamic format IDs

Bruno Celeste (@sadikzzz)

On April 15, 2014

With Dynamic format IDs, you could use standard formats such as MP4 with H264 / AAC codecs by just naming the format_id mp4. Very handy. But if you want to use another codec instead, like H263, you had to create a new format the old way.

Today, we updated the dynamic format feature to let you choose the video codec and audio codec of your choice. The new naming becomes:

$CONTAINER:$VCODEC:$ACODEC_$SIZE_$VBITRATE_$ABITRATE

$VCODEC and $ACODEC are absolutely not mandatory, use them only if you need to.

Let's say you want to use the H263 codec with an MP4 container:

$ heywatch format:info mp4:h263
{
  "container": "mp4",
  "audio_channels": 2,
  "owner": false,
  "audio_codec": "aac",
  "category": null,
  "fps": 0.0,
  "name": "mp4:h263",
  "width": 640,
  "video_bitrate": 800.0,
  "video_codec": "h263",
  "id": "mp4:h263",
  "sample_rate": 44000,
  "two_pass": false,
  "height": 0,
  "audio_bitrate": 128.0
}

Another format with the Matroska container and H264 / MP3:

$ heywatch format:info mkv:h264:mp3_720p
{
  "owner": false,
  "category": null,
  "container": "mkv",
  "height": 720,
  "name": "mkv:h264:mp3 720p",
  "width": 1280,
  "fps": 0.0,
  "sample_rate": 44100,
  "video_codec": "h264",
  "id": "mkv:h264:mp3_720p",
  "video_bitrate": 1500.0,
  "audio_bitrate": 128.0,
  "two_pass": false,
  "audio_channels": 2,
  "audio_codec": "mp3"
}

Read our article to learn more about Dynamic Format IDs.


Vertically and Horizontally flip videos

Bruno Celeste (@sadikzzz)

On April 01, 2014

Sometimes, you need full control of how you want the video to be rotated. Until now, you could only use the transpose option to rotate the video 90 degrees clockwise and counterclockwise.

Today, we add two new encoding options to go further: vertical and horizontal flip. Use vflip=true and hflip=true to respectively vertically and horizontally flip a video.

Here is a simple example:

[post:job]
video_id = 1234
format_id = ios
hflip = true
output_url = s3://akey:skey@bucket/video-flipped.mp4

Note that we already do this for years when encoding upside down videos.


You get an Error Code

Bruno Celeste (@sadikzzz)

On March 26, 2014

Simple messages are not enough when you want to be accurate, that's why we added a bunch of new error codes for all the APIs.

From now, you will receive an error code for every single errors you will encounter with the HeyWatch API.

The error messages in JSON and XML reflect this change but shouldn't break your existing code since we just added two new fields.

A typical JSON error:

{"message":"Ping URL is not valid","error_code":10,"status":"error"}

The XML version:

<?xml version="1.0" encoding="UTF-8"?>
<message status="fail" error-code="10">Ping URL is not valid</message>

You can find the full list of error codes in our documentation.


Introducing Closed Captions for MP4 and HLS

Bruno Celeste (@sadikzzz)

On March 25, 2014

We are happy to announce the support of closed captions for MP4 and HLS formats. We currently support SRT and WebVTT as input format.

Captions

MP4 Closed Captions

If the output is an MP4 file, the captions will use the mov_text codec with fourcc tx3g, so it's compatible with everything from quicktime to iOS and more.

Captions for HTTP Live Streaming format

With the HLS format, it's a different work as we need to segmentize the caption files first and then generate the associated playlist in m3u8. If the input captions are SRT files, we will automatically convert them into proper WebVTT files.
The file structure stays very simple, the playlist and webvtt files will be uploaded to the same directory than the other video segments and playlists.

The naming convention is caption-$lang.m3u8 for the playlist and caption-$lang-$num.webvtt for the caption segment files:

caption-en.m3u8
caption-en-00000.webvtt
caption-en-00001.webvtt
caption-en-00002.webvtt
caption-en-00003.webvtt
...
caption-es.m3u8
caption-es-00000.webvtt
caption-es-00001.webvtt
caption-es-00002.webvtt
caption-es-00003.webvtt
...

Using the API

As usual, the API is very simple: you give one or more caption URLs (caption_urls), languages (caption_languages) and names (caption_names) separated by comma, and you are done. Here is an example:

The INI file captions.conf:

[post:hls/job]
video_id = 1234,
format_ids = HLS_360p_600K,HLS_360p_1000K,HLS_720p_1500K
output_url = s3://a:s@bucket/hls
caption_urls = http://mysite.com/sub/abc/en.srt,http://mysite.com/sub/abc/es.srt
caption_languages = en,es
caption_names = English,Español

[robot:ping]
url = http://mysite.com/ping

Create the job in ruby:

hw = HeyWatch.new("HW-API-Key", "k-api-key")
ini = File.read("captions.conf")
hw.create("robot/job", ini)

You can read the complete documentation for HLS and MP4.


Other posts