The HW Blog

Want to be updated? @HeyWatch | Feed

API Changes

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.


Other posts