The /video/encode Robot

Transloadit offers a variety of features to reduce video size while maintaining quality, as well as add effects like watermarks.

The /video/encode Robot encodes, resizes, applies watermarks to videos and animated GIFs.

Parameters

Name Type Default Description
preset String "flash" Converts a video according to pre-configured settings. If you specify your own FFmpeg parameters using the Robot's ffmpeg parameter and you have not specified a preset, then the default "flash" preset is not applied. This is to prevent you from having to override each of the flash preset's values manually. For a list of video presets, see video presets.
width Integer(1-1920) Width of the input video Width of the new video, in pixels.
height Integer(1-1080) Height of the input video Height of the new video, in pixels.
resize_strategy String "pad" See the available resize strategies.
background String "00000000" The background color of the resulting video the "rrggbbaa" format (red, green, blue, alpha) when used with the "pad" resize strategy. The default color is black.
rotate Integer Auto Forces the video to be rotated by the specified degree integer. Currently, only multiples of 90 are supported. We automatically correct the orientation of many videos when the orientation is provided by the camera. This option is only useful for videos requiring rotation because it was not detected by the camera. If you set rotate to false no rotation is performed, even if the metadata contains such instructions.
hint Boolean false Enables hinting for mp4 files, for RTP/RTSP streaming.

Live demos

Our /video/encode Robot can be used in combination with other Robots, to create powerful workflows unique to your use case.
Here are a few example scenarios, and the required the Assembly Instructions to implement them.
You can also try demos of these examples right here, live on our website.

Export a video to YouTube

{
  "steps": {
    "ipad_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "ipad-high"
    },
    "exported": {
      "use": ["ipad_encoded"],
      "robot": "/youtube/store",
      "category": "People",
      "credentials": "YOUR_YOUTUBE_CREDENTIALS",
      "description": "Some description",
      "keywords": "testing, example",
      "title": "Some title"
    }
  }
}

Encode a video, extract 8 thumbnails and store everything in an S3 bucket

{
  "steps": {
    "ipad_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "ffmpeg_stack": "v2.2.3",
      "preset": "ipad-high"
    },
    "thumbnailed": {
      "use": ["ipad_encoded"],
      "robot": "/video/thumbs",
      "result": true,
      "ffmpeg_stack": "v2.2.3"
    },
    "exported": {
      "use": [":original", "ipad_encoded", "thumbnailed"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Transparently extract uploaded archives

{
  "steps": {
    "archives_filtered": {
      "use": [":original"],
      "robot": "/file/filter",
      "result": true,
      "accepts": [["${file.mime}", "regex", "application/(rar|x-7z-compressed|x-cab|x-cpio|x-debian-package|x-gtar-compressed|x-gzip|x-lzh|x-redhat-package-manager|x-tar|zip)"]],
      "error_on_decline": false
    },
    "nonarchives_filtered": {
      "use": [":original"],
      "robot": "/file/filter",
      "result": true,
      "declines": [["${file.mime}", "regex", "application/(rar|x-7z-compressed|x-cab|x-cpio|x-debian-package|x-gtar-compressed|x-gzip|x-lzh|x-redhat-package-manager|x-tar|zip)"]],
      "error_on_decline": false
    },
    "extracted": {
      "use": ["archives_filtered"],
      "robot": "/file/decompress",
      "result": true
    },
    "ipad_encoded": {
      "use": ["nonarchives_filtered", "extracted"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "ipad-high"
    },
    "web_encoded": {
      "use": ["nonarchives_filtered", "extracted"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "webm"
    },
    "exported": {
      "use": ["nonarchives_filtered", "archives_filtered", "extracted", "ipad_encoded", "web_encoded", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Reject videos that do not have an audio track

{
  "steps": {
    "nomute_filtered": {
      "use": [":original"],
      "robot": "/file/filter",
      "result": true,
      "declines": [["${file.meta.audio_bitrate}", "=", ""]],
      "error_on_decline": true
    },
    "iphone_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "iphone"
    },
    "exported": {
      "use": ["iphone_encoded", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Specify multiple encoding Steps for a single file

{
  "steps": {
    "ipad_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "ipad-high"
    },
    "iphone_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "iphone"
    },
    "thumbnailed": {
      "use": [":original"],
      "robot": "/video/thumbs",
      "result": true,
      "ffmpeg_stack": "v2.2.3"
    },
    "thumbs_resized": {
      "use": ["thumbnailed"],
      "robot": "/image/resize",
      "result": true,
      "height": 130,
      "imagemagick_stack": "v1.0.0",
      "width": 130
    },
    "exported": {
      "use": [":original", "ipad_encoded", "iphone_encoded", "thumbs_resized"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Automatically process multiple file types

{
  "steps": {
    "image_thumbed": {
      "use": [":original"],
      "robot": "/image/resize",
      "result": true,
      "format": "png",
      "height": 240,
      "imagemagick_stack": "v1.0.0",
      "width": 320
    },
    "video_thumbed": {
      "use": [":original"],
      "robot": "/video/thumbs",
      "result": true,
      "background": "#000000",
      "count": 4,
      "ffmpeg_stack": "v2.2.3",
      "height": 240,
      "resize_strategy": "pad",
      "width": 320
    },
    "ipad_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "ipad-high"
    },
    "exported": {
      "use": ["image_thumbed", "video_thumbed", "ipad_encoded", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Concatenate video files

{
  "steps": {
    "preroll_imported": {
      "robot": "/http/import",
      "result": true,
      "url": "http://demos.transloadit.com/inputs/waves10.mp4"
    },
    "preroll_resized": {
      "use": ["preroll_imported"],
      "robot": "/video/encode",
      "result": true,
      "background": "#000000",
      "ffmpeg_stack": "v3.3.3",
      "height": 270,
      "preset": "ipad-high",
      "resize_strategy": "pad",
      "width": 480
    },
    "original_resized": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "background": "#000000",
      "ffmpeg_stack": "v3.3.3",
      "height": 270,
      "preset": "ipad-high",
      "resize_strategy": "pad",
      "width": 480
    },
    "concatenated": {
      "use": {"steps":[{"name":"original_resized", "as":"video_1"},{"name":"preroll_resized", "as":"video_2"}]},
      "robot": "/video/concat",
      "result": true,
      "ffmpeg_stack": "v3.3.3",
      "preset": "ipad-high"
    },
    "exported": {
      "use": ["preroll_imported", "preroll_resized", "original_resized", "concatenated", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Encode video for Android, preserving the original quality

{
  "steps": {
    "android_samequality_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg": {"b:v":"${file.meta.video_bitrate}", "maxrate":"${file.meta.video_bitrate}", "bufsize":"${file.meta.video_bitrate}", "r":"${file.meta.framerate}", "ar":"${file.meta.audio_samplerate}", "b:a":"${file.meta.audio_bitrate}"},
      "ffmpeg_stack": "v3.3.3",
      "height": "${file.meta.height}",
      "preset": "android",
      "width": "${file.meta.width}"
    },
    "exported": {
      "use": [":original", "android_samequality_encoded"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Encode video for Android

{
  "steps": {
    "android_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "android"
    },
    "exported": {
      "use": ["android_encoded", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Encode video for browsers in 720p

{
  "steps": {
    "browser720_webm_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v3.3.3",
      "height": 720,
      "preset": "webm",
      "width": 1280
    },
    "browser720_h264_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v3.3.3",
      "height": 720,
      "preset": "ipad-high",
      "width": 1280
    },
    "thumbed": {
      "use": ["browser720_h264_encoded"],
      "robot": "/video/thumbs",
      "result": true,
      "count": 1,
      "ffmpeg_stack": "v3.3.3",
      "format": "jpg",
      "height": 720,
      "resize_strategy": "fit",
      "width": 1280
    },
    "exported": {
      "use": ["browser720_webm_encoded", "browser720_h264_encoded", "thumbed", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Encode video for iPad HD

{
  "steps": {
    "ipadhd_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg": {"b":"3200k", "maxrate":"3200k", "bufsize":"3200k", "bt":"4800k"},
      "ffmpeg_stack": "v3.3.3",
      "height": 1080,
      "preset": "ipad-high",
      "width": 1920
    },
    "exported": {
      "use": ["ipadhd_encoded", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Encode video for iPhone and strip the sound

{
  "steps": {
    "iphone_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg": {"an":true},
      "ffmpeg_stack": "v2.2.3",
      "preset": "iphone"
    },
    "exported": {
      "use": ["iphone_encoded", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Encode a video into WebM

{
  "steps": {
    "webm_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "webm"
    },
    "exported": {
      "use": ["webm_encoded", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Encode video to HEVC

{
  "steps": {
    "hevc_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v3.3.3",
      "preset": "hevc"
    },
    "exported": {
      "use": ["hevc_encoded", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Extract a 10 second clip from a video

{
  "steps": {
    "shortened": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg": {"ss":"00:00:26.0", "t":10},
      "ffmpeg_stack": "v3.3.3",
      "preset": "ipad-high"
    },
    "exported": {
      "use": ["shortened", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Extract 10 thumbnails and modify their size

{
  "steps": {
    "ipad_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "ffmpeg_stack": "v2.2.3",
      "height": 480,
      "preset": "ipad-high",
      "width": 640
    },
    "thumbnailed": {
      "use": ["ipad_encoded"],
      "robot": "/video/thumbs",
      "count": 10,
      "ffmpeg_stack": "v2.2.3"
    },
    "large_resized": {
      "use": ["thumbnailed"],
      "robot": "/image/resize",
      "result": true,
      "height": 120,
      "imagemagick_stack": "v1.0.0",
      "width": 120
    },
    "medium_resized": {
      "use": ["thumbnailed"],
      "robot": "/image/resize",
      "result": true,
      "height": 75,
      "imagemagick_stack": "v1.0.0",
      "width": 75
    },
    "small_resized": {
      "use": ["thumbnailed"],
      "robot": "/image/resize",
      "result": true,
      "height": 30,
      "imagemagick_stack": "v1.0.0",
      "width": 30
    },
    "exported": {
      "use": ["ipad_encoded", "thumbnailed", "small_resized", "medium_resized", "large_resized", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Implement HTTP Live Streaming (HLS)

{
  "steps": {
    "low": {
      "use": [":original"],
      "robot": "/video/encode",
      "ffmpeg_stack": "v3.3.3",
      "preset": "hls_270p"
    },
    "mid": {
      "use": [":original"],
      "robot": "/video/encode",
      "ffmpeg_stack": "v3.3.3",
      "preset": "hls_360p"
    },
    "high": {
      "use": [":original"],
      "robot": "/video/encode",
      "ffmpeg_stack": "v3.3.3",
      "preset": "hls_540p"
    },
    "adaptive": {
      "use": {"steps":["low", "mid", "high"],"bundle_steps":true},
      "robot": "/video/adaptive",
      "ffmpeg_stack": "v3.3.3",
      "playlist_name": "my_playlist.m3u8",
      "technique": "hls"
    },
    "exported": {
      "use": ["adaptive", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "path": "hlstest/${file.meta.relative_path}/${file.name}",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Implement MPEG-Dash using Transloadit

{
  "steps": {
    "270p_video": {
      "use": [":original"],
      "robot": "/video/encode",
      "ffmpeg_stack": "v3.3.3",
      "preset": "dash_270p_video"
    },
    "360p_video": {
      "use": [":original"],
      "robot": "/video/encode",
      "ffmpeg_stack": "v3.3.3",
      "preset": "dash_360p_video"
    },
    "32k_audio": {
      "use": [":original"],
      "robot": "/video/encode",
      "ffmpeg_stack": "v3.3.3",
      "preset": "dash_32k_audio"
    },
    "64k_audio": {
      "use": [":original"],
      "robot": "/video/encode",
      "ffmpeg_stack": "v3.3.3",
      "preset": "dash_64k_audio"
    },
    "adaptive": {
      "use": {"steps":["270p_video", "360p_video", "32k_audio", "64k_audio"],"bundle_steps":true},
      "robot": "/video/adaptive",
      "ffmpeg_stack": "v3.3.3",
      "playlist_name": "my_playlist.mpd",
      "technique": "dash"
    },
    "exported": {
      "use": [":original", "adaptive"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "path": "dashtest/${file.meta.relative_path}/${file.name}",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Surround a video with a frame using a watermark

{
  "steps": {
    "video_resized": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v3.3.3",
      "height": 600,
      "preset": "ipad-high",
      "width": 800
    },
    "invert_watermarked": {
      "use": ["video_resized"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v3.3.3",
      "height": 600,
      "preset": "ipad-high",
      "watermark_position": "top-left",
      "watermark_size": "100%",
      "watermark_url": "http://demos.transloadit.com/inputs/waterframe.png",
      "width": 800
    },
    "exported": {
      "use": ["video_resized", "invert_watermarked", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Join multiple videos sharing one audio track

{
  "steps": {
    "resized": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v3.3.3",
      "preset": "ipad-high"
    },
    "joined": {
      "use": {"steps":[{"name":"resized", "fields":"myfile_0", "as":"video_1"},{"name":"resized", "fields":"myfile_1", "as":"video_2"},{"name":"resized", "fields":"myfile_2", "as":"video_3"}],"bundle_steps":true},
      "robot": "/video/concat",
      "result": true,
      "ffmpeg_stack": "v3.3.3",
      "preset": "ipad-high"
    },
    "merged": {
      "use": {"steps":[{"name":":original", "as":"audio"},{"name":"joined", "as":"video"}]},
      "robot": "/video/merge",
      "result": true,
      "ffmpeg_stack": "v3.3.3",
      "preset": "ipad-high"
    },
    "shortened10": {
      "use": ["merged"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg": {"ss":"00:00:0.0", "t":13},
      "ffmpeg_stack": "v3.3.3",
      "preset": "ipad-high"
    },
    "shortened10_watermarked": {
      "use": ["shortened10"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v3.3.3",
      "preset": "ipad-high",
      "watermark_position": "bottom-right",
      "watermark_size": "25%",
      "watermark_url": "http://demos.transloadit.com/inputs/tllogo-white-alpha-1612p.png"
    },
    "shortened25": {
      "use": ["merged"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg": {"ss":"00:00:0.0", "t":27},
      "ffmpeg_stack": "v3.3.3",
      "preset": "ipad-high"
    },
    "shortened25_watermarked": {
      "use": ["shortened25"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v3.3.3",
      "preset": "ipad-high",
      "watermark_position": "bottom-right",
      "watermark_size": "25%",
      "watermark_url": "http://demos.transloadit.com/inputs/tllogo-white-alpha-1612p.png"
    },
    "shortened50": {
      "use": ["merged"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg": {"ss":"00:00:0.0", "t":49},
      "ffmpeg_stack": "v3.3.3",
      "preset": "ipad-high"
    },
    "shortened50_watermarked": {
      "use": ["shortened50"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v3.3.3",
      "preset": "ipad-high",
      "watermark_position": "bottom-right",
      "watermark_size": "25%",
      "watermark_url": "http://demos.transloadit.com/inputs/tllogo-white-alpha-1612p.png"
    },
    "exported": {
      "use": ["resized", "joined", "merged", "shortened10", "shortened25", "shortened50", "shortened10_watermarked", "shortened25_watermarked", "shortened50_watermarked", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Optimize videos for iPad

{
  "steps": {
    "ipad_encoded": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "ipad-high"
    },
    "exported": {
      "use": ["ipad_encoded", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Apply a watermark to videos

{
  "steps": {
    "watermarked": {
      "use": [":original"],
      "robot": "/video/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "ipad-high",
      "watermark_position": "bottom-right",
      "watermark_size": "25%",
      "watermark_url": "http://demos.transloadit.com/inputs/tllogo-white-alpha-1612p.png"
    },
    "exported": {
      "use": ["watermarked", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Our /video/encode robot blog posts

Over the years we wrote the following posts about Our /video/encode robot on our blog:

Did you know?

You can easily combine Robots to create powerful workflows, unique to your business.
This is the power of Transloadit.