We are a Swiss Army knife for your files
Transloadit is a service for companies with developers. We handle their file uploads and media processing. This means that they can save on development time and the heavy machinery that is required to handle big volumes in an automated way.
We pioneered with this concept in 2009 and have made our customers happy ever since. We are still actively improving our service in 2024, as well as our open source projects uppy.io and tus.io, which are changing how the world does file uploading.
Make video compatible for all devices
If you have users on many different devices, and you want to offer them the optimal experience, you want to deliver the smallest files possible, so you want to make sure that you're not shipping:
- pixels beyond what their screen can render
- quality beyond what their bandwidth can carry
- codecs that their device can't understand (an obvious prerequisite)
MPEG-DASH is a great new standard that can adjust video quality for users, while it is playing. This means that quality can be scaled all the way down to audio-only as users move through tunnels, and pick back up to full HD (or more) when they're on Wi-Fi.
Native support for MPEG-DASH across browsers in 2018 is lacking. Luckily there is dash.js, a JavaScript library that can add MPEG-DASH support to browsers that support Media Source Extensions. As you can see, in early 2018 that means iOS is out of the window. Sad.
Before MPEG-DASH was conceived, Apple already had this Adaptive technology as a proprietary undertaking, called HLS. So if you'd want to offer the best experience, ideally you make the player switch between HLS and MPEG-DASH, so long as Apple isn't on board yet. And then maybe you want to add 'old school' mp4 and webm files, just for devices or players that aren't (in) browsers and won't support Adaptive streaming for some time to come.
In this, admittedly, rather long example, we're going to illustrate how to generate all these different formats, along with a code snippet of how your player could switch between those.
We can use WebM's VP9 codec for modern browsers and fall back to MP4s for the rest like so:
<html>
<head>
<title>Readaptive</title>
<link rel="stylesheet" href="https://cdn.plyr.io/2.0.7/plyr.css">
<style>
.plyr-container,
.plyr-player {
width: 720px;
height: 540px;
}
</style>
</head>
<body>
<h1>Readaptive</h1>
<p>
Here's a script that offers the browser HLS, DASH or MP4/WEBM fallbacks based on capability.
<br>
To force a selection click (and then refresh):
<ul>
<li><a href="#">auto</a></li>
<li><a href="#hls">hls</a></li>
<li><a href="#dash">dash</a></li>
<li><a href="#non-adaptive">non-adaptive</a></li>
</ul>
</p>
<br>
<div class="plyr-container">
<video
controls
playsinline
class="plyr-player"
poster="https://tamhub.edgly.net/plain/b3/7eba411c6d11e8bbdb594d427f9a9f-aligators/thumbnailed.jpg"
>
<source
src="https://tamhub.edgly.net/plain/b3/7eba411c6d11e8bbdb594d427f9a9f-aligators/plain_720_vp9_encoded.webm"
type="video/webm; codecs=vp9,vorbis"
>
<source
src="https://tamhub.edgly.net/plain/b3/7eba411c6d11e8bbdb594d427f9a9f-aligators/plain_720_h264_encoded.mp4"
type="video/mp4"
>
<source src="https://tamhub.edgly.net/adapt/b3/7eba411c6d11e8bbdb594d427f9a9f-aligators/hls-playlist.m3u8">
<source src="https://tamhub.edgly.net/adapt/b3/7eba411c6d11e8bbdb594d427f9a9f-aligators/dash-playlist.mpd">
</video>
</div>
</body>
<script src="http://cdn.dashjs.org/latest/dash.all.min.js"></script>
<script src="https://cdn.plyr.io/2.0.7/plyr.js"></script>
<script src="https://unpkg.com/hls.js@0.8.9/dist/hls.js"></script>
<script>
function readaptive(selector, options) {
if (!options) options = {}
if (!('force' in options)) options.force = location.hash.replace('#', '')
var dashjs = window.dashjs
var plyr = window.plyr
var Hls = window.Hls
var supportsDash = typeof (window.MediaSource || window.WebKitMediaSource) === 'function'
var supportsHls = Hls.isSupported()
var player,
i,
players = document.querySelectorAll(selector)
var adaptiveSources = []
var nonAdaptiveSources = []
for (var i = 0; i < players.length; i++) {
player = players[i]
var source,
j,
sources = player.getElementsByTagName('source')
var autoplay = false
if ('autoplay' in options) {
autoplay = options.autoplay
} else if (player.getAttribute('autoplay')) {
autoplay = true
}
if (sources.length < 1) {
return console.error('No sources found in player')
}
for (var j = 0; j < sources.length; j++) {
source = sources[j]
var src = source.getAttribute('src')
var type
if ((type = source.getAttribute('type'))) {
type = type.split(' ')[0].split(';')[0].split('/')[1]
}
if (`${src}`.match(/\.m3u8$/)) {
type = 'hls'
} else if (`${src}`.match(/\.mpd$/)) {
type = 'dash'
} else if (!type) {
type = src.split('.').pop()
}
if (type === 'hls') {
if (supportsHls && (!options.force || options.force === 'hls')) {
// https://codepen.io/sampotts/pen/JKEMqB
var hls = new Hls()
hls.loadSource(src)
hls.attachMedia(player)
hls.on(Hls.Events.MANIFEST_PARSED, function () {
if (autoplay) {
player.play()
}
})
adaptiveSources.push({ type, source })
}
} else if (type === 'dash') {
if (supportsDash && (!options.force || options.force === 'dash')) {
// https://codepen.io/sampotts/pen/BzpJXN
var dash = dashjs.MediaPlayer().create()
dash.initialize(player, src, autoplay)
adaptiveSources.push({ type, source })
}
} else {
// Non adaptive source. Let's add it so that the browser will pick the best candidate for playback
nonAdaptiveSources.push({ type, source })
}
}
player.innerHTML = ''
var picked = []
if (adaptiveSources.length !== 0) {
for (var k in adaptiveSources) {
// Only use 1 Adaptive source; so break
player.appendChild(adaptiveSources[k].source)
picked.push(adaptiveSources[k].type)
break
}
} else if (nonAdaptiveSources.length !== 0) {
for (var k in nonAdaptiveSources) {
// Allow the browser to pick from all non-adaptive sources
player.appendChild(nonAdaptiveSources[k].source)
picked.push(nonAdaptiveSources[k].type)
}
} else {
return console.error('No non-adaptive sources collected')
}
// https://github.com/sampotts/plyr#options
var player = plyr.setup(this, {
debug: false,
autoplay: autoplay,
controls: ['play', 'progress', 'current-time'],
})[0]
// https://github.com/sampotts/plyr#events
player.on('ready', function (event) {
// console.log({event})
})
}
return { picked }
}
var { picked, player } = readaptive('.plyr-player')
var newParagraph = document.createElement('p')
newParagraph.textContent = 'Offering the browser: ' + picked.join(', ')
document.getElementsByClassName('plyr-container')[0].appendChild(newParagraph)
</script>
</html>
Step 1: Handle uploads
We can handle uploads of your users directly. Learn more ›
27s · 1024 × 768
Step 2: Resize videos to 1280×720 and encode for WebM (VP9)
We offer a variety of video encoding features like optimizing for different devices, merging, injecting ads, changing audio tracks, or adding company logos. Learn more ›
27s · 1280 × 720
Step 3: Resize videos to 1280×720 and encode for iPad (high quality) (H.264)
27s · 1280 × 720
Step 4: Extract thumbnails from videos
We offer a variety of video encoding features like optimizing for different devices, merging, injecting ads, changing audio tracks, or adding company logos. Learn more ›
Step 5: Transcode videos to MPEG-Dash (720p) (H.264/H.265/VP9)
27s · 1280 × 720
Step 6: Transcode videos to MPEG-Dash (360p) (H.264/H.265/VP9)
27s · 640 × 360
Step 7: Transcode videos to MPEG-Dash (270p) (H.264/H.265/VP9)
27s · 480 × 270
Step 8: Transcode videos to MPEG-Dash (32k) (H.264/H.265/VP9)
Step 9: Transcode videos to MPEG-Dash (64k) (H.264/H.265/VP9)
Step 10: Transcode videos to HLS (720p) (H.264)
27s · 1280 × 720
Step 11: Transcode videos to HLS (360p) (H.264)
27s · 640 × 360
Step 12: Transcode videos to HLS (270p) (H.264)
27s · 480 × 270
Step 13: Convert videos to MPEG-Dash
We offer a variety of video encoding features like optimizing for different devices, merging, injecting ads, changing audio tracks, or adding company logos. Learn more ›
27s · 480 × 270
27s · 640 × 360
27s · 1280 × 720
Step 14: Convert videos to HLS
(not showing 1 additional file to keep demo previews compact)
Step 15: Export files to Amazon S3
We export to the storage platform of your choice. Learn more ›
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/video/1024x768_1185752_25_dashinit.mp4
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/video/1024x768_1185752_25_dashinit.mp4
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/dash-playlist.mpd
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/video/480x270_469520_30_dashinit.mp4
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/video/640x360_808496_30_dashinit.mp4
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/video/1280x720_3310152_30_dashinit.mp4
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/hls-playlist.m3u8
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/480x270_564160_30/480x270_564160_30.m3u8
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/480x270_564160_30/seg__0.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/640x360_1006712_30/seg__0.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/1280x720_4033568_30/seg__0.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/480x270_564160_30/seg__1.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/1280x720_4033568_30/seg__1.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/640x360_1006712_30/seg__1.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/640x360_1006712_30/640x360_1006712_30.m3u8
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/1280x720_4033568_30/1280x720_4033568_30.m3u8
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/480x270_564160_30/seg__2.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/1280x720_4033568_30/seg__2.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/640x360_1006712_30/seg__2.ts
Once all files have been exported, we can ping a URL of your choice with the Assembly status JSON.
Step 16: Export files to Amazon S3
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/video/1024x768_1185752_25_dashinit.mp4
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/video/1024x768_1185752_25_dashinit.mp4
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/dash-playlist.mpd
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/video/480x270_469520_30_dashinit.mp4
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/video/640x360_808496_30_dashinit.mp4
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/video/1280x720_3310152_30_dashinit.mp4
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/hls-playlist.m3u8
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/480x270_564160_30/480x270_564160_30.m3u8
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/480x270_564160_30/seg__0.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/640x360_1006712_30/seg__0.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/1280x720_4033568_30/seg__0.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/480x270_564160_30/seg__1.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/1280x720_4033568_30/seg__1.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/640x360_1006712_30/seg__1.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/640x360_1006712_30/640x360_1006712_30.m3u8
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/1280x720_4033568_30/1280x720_4033568_30.m3u8
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/480x270_564160_30/seg__2.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/1280x720_4033568_30/seg__2.ts
- demos.transloadit.com/4d/f29baf26764f4a9db20bf94e9402ec-kite25/adapt/640x360_1006712_30/seg__2.ts
Once all files have been exported, we can ping a URL of your choice with the Assembly status JSON.
Build this in your own language
{
"steps": {
":original": {
"robot": "/upload/handle"
},
"plain_720_vp9_encoded": {
"use": ":original",
"robot": "/video/encode",
"result": true,
"ffmpeg_stack": "v6.0.0",
"height": 720,
"preset": "webm",
"width": 1280,
"turbo": false
},
"plain_720_h264_encoded": {
"use": ":original",
"robot": "/video/encode",
"result": true,
"ffmpeg_stack": "v6.0.0",
"height": 720,
"preset": "ipad-high",
"width": 1280,
"turbo": false
},
"thumbnailed": {
"use": "plain_720_h264_encoded",
"robot": "/video/thumbs",
"result": true,
"count": 1,
"ffmpeg_stack": "v6.0.0",
"format": "jpg",
"height": 720,
"resize_strategy": "fit",
"width": 1280
},
"dash_720p_video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash_720p_video",
"result": true,
"turbo": false
},
"dash_360p_video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash_360p_video",
"result": true,
"turbo": false
},
"dash_270p_video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash_270p_video",
"result": true,
"turbo": false
},
"dash-32k-audio": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash-32k-audio",
"result": true,
"turbo": false
},
"dash-64k-audio": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash-64k-audio",
"result": true,
"turbo": false
},
"hls-720p-video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "hls-720p",
"result": true,
"turbo": false
},
"hls-360p-video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "hls-360p",
"result": true,
"turbo": false
},
"hls-270p-video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "hls-270p",
"result": true,
"turbo": false
},
"dash_adapted": {
"use": {
"steps": ["dash_720p_video", "dash_360p_video", "dash_270p_video", "dash-64k-audio", "dash-32k-audio"],
"bundle_steps": true
},
"robot": "/video/adaptive",
"result": true,
"playlist_name": "dash-playlist.mpd",
"technique": "dash"
},
"hls_adapted": {
"use": {
"steps": ["hls-720p-video", "hls-360p-video", "hls-270p-video"],
"bundle_steps": true
},
"robot": "/video/adaptive",
"result": true,
"playlist_name": "hls-playlist.m3u8",
"technique": "hls"
},
"adaptive_exported": {
"use": ["dash_adapted", "hls_adapted"],
"robot": "/s3/store",
"credentials": "demo_s3_credentials",
"path": "${unique_original_prefix}-${file.original_basename}/adapt/${file.meta.relative_path}/${file.name}",
"url_prefix": "https://demos.transloadit.com/"
},
"plain_exported": {
"use": [":original", "plain_720_vp9_encoded", "plain_720_h264_encoded", "thumbnailed"],
"robot": "/s3/store",
"credentials": "demo_s3_credentials",
"path": "${unique_original_prefix}-${file.original_basename}/plain/${previous_step.name}.${file.ext}",
"url_prefix": "https://demos.transloadit.com/"
}
}
}
# Prerequisites: brew install curl jq || sudo apt install curl jq
# To avoid tampering, use Signature Authentication
echo '{
"template_id": undefined,
"auth": {
"key": "YOUR_TRANSLOADIT_KEY"
},
"steps": {
":original": {
"robot": "/upload/handle"
},
"plain_720_vp9_encoded": {
"use": ":original",
"robot": "/video/encode",
"result": true,
"ffmpeg_stack": "v6.0.0",
"height": 720,
"preset": "webm",
"width": 1280,
"turbo": false
},
"plain_720_h264_encoded": {
"use": ":original",
"robot": "/video/encode",
"result": true,
"ffmpeg_stack": "v6.0.0",
"height": 720,
"preset": "ipad-high",
"width": 1280,
"turbo": false
},
"thumbnailed": {
"use": "plain_720_h264_encoded",
"robot": "/video/thumbs",
"result": true,
"count": 1,
"ffmpeg_stack": "v6.0.0",
"format": "jpg",
"height": 720,
"resize_strategy": "fit",
"width": 1280
},
"dash_720p_video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash_720p_video",
"result": true,
"turbo": false
},
"dash_360p_video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash_360p_video",
"result": true,
"turbo": false
},
"dash_270p_video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash_270p_video",
"result": true,
"turbo": false
},
"dash-32k-audio": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash-32k-audio",
"result": true,
"turbo": false
},
"dash-64k-audio": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash-64k-audio",
"result": true,
"turbo": false
},
"hls-720p-video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "hls-720p",
"result": true,
"turbo": false
},
"hls-360p-video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "hls-360p",
"result": true,
"turbo": false
},
"hls-270p-video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "hls-270p",
"result": true,
"turbo": false
},
"dash_adapted": {
"use": {
"steps": ["dash_720p_video", "dash_360p_video", "dash_270p_video", "dash-64k-audio", "dash-32k-audio"],
"bundle_steps": true
},
"robot": "/video/adaptive",
"result": true,
"playlist_name": "dash-playlist.mpd",
"technique": "dash"
},
"hls_adapted": {
"use": {
"steps": ["hls-720p-video", "hls-360p-video", "hls-270p-video"],
"bundle_steps": true
},
"robot": "/video/adaptive",
"result": true,
"playlist_name": "hls-playlist.m3u8",
"technique": "hls"
},
"adaptive_exported": {
"use": ["dash_adapted", "hls_adapted"],
"robot": "/s3/store",
"credentials": "demo_s3_credentials",
"path": "${unique_original_prefix}-${file.original_basename}/adapt/${file.meta.relative_path}/${file.name}",
"url_prefix": "https://demos.transloadit.com/"
},
"plain_exported": {
"use": [":original", "plain_720_vp9_encoded", "plain_720_h264_encoded", "thumbnailed"],
"robot": "/s3/store",
"credentials": "demo_s3_credentials",
"path": "${unique_original_prefix}-${file.original_basename}/plain/${previous_step.name}.${file.ext}",
"url_prefix": "https://demos.transloadit.com/"
}
}
}' | curl \\
--request POST \\
--form 'params=<-' \\
--form myfile1=@./kite25.mp4 \\
https://api2.transloadit.com/assemblies | jq
// Install via Swift Package Manager:
// dependencies: [
// .package(url: "https://github.com/transloadit/TransloaditKit", .upToNextMajor(from: "3.0.0"))
// ]
// Or via CocoaPods:
// pod 'Transloadit', '~> 3.0.0'
// Auth
let credentials = Credentials(key: "YOUR_TRANSLOADIT_KEY")
// Init
let transloadit = Transloadit(credentials: credentials, session: "URLSession.shared")
// Add files to upload
let filesToUpload: [URL] = ...
// Execute
let assembly = transloadit.assembly(steps: [
_originalStep,
, plain_720_vp9_encodedStep,
, plain_720_h264_encodedStep,
, thumbnailedStep,
, dash_720p_videoStep,
, dash_360p_videoStep,
, dash_270p_videoStep,
, dash_32k_audioStep,
, dash_64k_audioStep,
, hls_720p_videoStep,
, hls_360p_videoStep,
, hls_270p_videoStep,
, dash_adaptedStep,
, hls_adaptedStep,
, adaptive_exportedStep,
, plain_exportedStep,
], andUpload: filesToUpload) { result in
switch result {
case .success(let assembly):
print("Retrieved (assembly)")
case .failure(let error):
print("Assembly error (error)")
}
}.pollAssemblyStatus { result in
switch result {
case .success(let assemblyStatus):
print("Received assemblystatus (assemblyStatus)")
case .failure(let error):
print("Caught polling error (error)")
}
<!-- This pulls Uppy from our CDN -->
<!-- For smaller self-hosted bundles, install Uppy and plugins manually: -->
<!-- npm i --save @uppy/core @uppy/dashboard @uppy/remote-sources @uppy/transloadit ... -->
<link
href="https://releases.transloadit.com/uppy/v4.3.0/uppy.min.css"
rel="stylesheet"
/>
<button id="browse">Select Files</button>
<script type="module">
import {
Uppy,
Dashboard,
ImageEditor,
RemoteSources,
Transloadit,
} from 'https://releases.transloadit.com/uppy/v4.3.0/uppy.min.mjs'
const uppy = new Uppy()
.use(Transloadit, {
waitForEncoding: true,
alwaysRunAssembly: true,
assemblyOptions: {
params: {
// To avoid tampering, use Signature Authentication:
// https://transloadit.com/docs/topics/signature-authentication/
auth: {
key: 'YOUR_TRANSLOADIT_KEY',
},
// It's often better store encoding instructions in your account
// and use a `template_id` instead of adding these steps inline
steps: {
':original': {
robot: '/upload/handle',
},
plain_720_vp9_encoded: {
use: ':original',
robot: '/video/encode',
result: true,
ffmpeg_stack: 'v6.0.0',
height: 720,
preset: 'webm',
width: 1280,
turbo: false,
},
plain_720_h264_encoded: {
use: ':original',
robot: '/video/encode',
result: true,
ffmpeg_stack: 'v6.0.0',
height: 720,
preset: 'ipad-high',
width: 1280,
turbo: false,
},
thumbnailed: {
use: 'plain_720_h264_encoded',
robot: '/video/thumbs',
result: true,
count: 1,
ffmpeg_stack: 'v6.0.0',
format: 'jpg',
height: 720,
resize_strategy: 'fit',
width: 1280,
},
dash_720p_video: {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'dash_720p_video',
result: true,
turbo: false,
},
dash_360p_video: {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'dash_360p_video',
result: true,
turbo: false,
},
dash_270p_video: {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'dash_270p_video',
result: true,
turbo: false,
},
'dash-32k-audio': {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'dash-32k-audio',
result: true,
turbo: false,
},
'dash-64k-audio': {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'dash-64k-audio',
result: true,
turbo: false,
},
'hls-720p-video': {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'hls-720p',
result: true,
turbo: false,
},
'hls-360p-video': {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'hls-360p',
result: true,
turbo: false,
},
'hls-270p-video': {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'hls-270p',
result: true,
turbo: false,
},
dash_adapted: {
use: {
steps: ['dash_720p_video', 'dash_360p_video', 'dash_270p_video', 'dash-64k-audio', 'dash-32k-audio'],
bundle_steps: true,
},
robot: '/video/adaptive',
result: true,
playlist_name: 'dash-playlist.mpd',
technique: 'dash',
},
hls_adapted: {
use: {
steps: ['hls-720p-video', 'hls-360p-video', 'hls-270p-video'],
bundle_steps: true,
},
robot: '/video/adaptive',
result: true,
playlist_name: 'hls-playlist.m3u8',
technique: 'hls',
},
adaptive_exported: {
use: ['dash_adapted', 'hls_adapted'],
robot: '/s3/store',
credentials: 'demo_s3_credentials',
path: '${unique_original_prefix}-${file.original_basename}/adapt/${file.meta.relative_path}/${file.name}',
url_prefix: 'https://demos.transloadit.com/',
},
plain_exported: {
use: [':original', 'plain_720_vp9_encoded', 'plain_720_h264_encoded', 'thumbnailed'],
robot: '/s3/store',
credentials: 'demo_s3_credentials',
path: '${unique_original_prefix}-${file.original_basename}/plain/${previous_step.name}.${file.ext}',
url_prefix: 'https://demos.transloadit.com/',
},
},
},
},
})
.use(Dashboard, { trigger: '#browse' })
.use(ImageEditor, { target: Dashboard })
.use(RemoteSources, {
companionUrl: 'https://api2.transloadit.com/companion',
})
.on('complete', ({ transloadit }) => {
// Due to `waitForEncoding:true` this is fired after encoding is done.
// Alternatively, set `waitForEncoding` to `false` and provide a `notify_url`
console.log(transloadit) // Array of Assembly Statuses
transloadit.forEach((assembly) => {
console.log(assembly.results) // Array of all encoding results
})
})
.on('error', (error) => {
console.error(error)
})
</script>
// yarn add transloadit || npm i transloadit
// Import
const Transloadit = require('transloadit')
const main = async () => {
// Init
const transloadit = new Transloadit({
authKey: 'YOUR_TRANSLOADIT_KEY',
authSecret: 'MY_TRANSLOADIT_SECRET',
})
// Set Encoding Instructions
const options = {
files: {
myfile_1: './kite25.mp4',
},
params: {
steps: {
':original': {
robot: '/upload/handle',
},
plain_720_vp9_encoded: {
use: ':original',
robot: '/video/encode',
result: true,
ffmpeg_stack: 'v6.0.0',
height: 720,
preset: 'webm',
width: 1280,
turbo: false,
},
plain_720_h264_encoded: {
use: ':original',
robot: '/video/encode',
result: true,
ffmpeg_stack: 'v6.0.0',
height: 720,
preset: 'ipad-high',
width: 1280,
turbo: false,
},
thumbnailed: {
use: 'plain_720_h264_encoded',
robot: '/video/thumbs',
result: true,
count: 1,
ffmpeg_stack: 'v6.0.0',
format: 'jpg',
height: 720,
resize_strategy: 'fit',
width: 1280,
},
dash_720p_video: {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'dash_720p_video',
result: true,
turbo: false,
},
dash_360p_video: {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'dash_360p_video',
result: true,
turbo: false,
},
dash_270p_video: {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'dash_270p_video',
result: true,
turbo: false,
},
'dash-32k-audio': {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'dash-32k-audio',
result: true,
turbo: false,
},
'dash-64k-audio': {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'dash-64k-audio',
result: true,
turbo: false,
},
'hls-720p-video': {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'hls-720p',
result: true,
turbo: false,
},
'hls-360p-video': {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'hls-360p',
result: true,
turbo: false,
},
'hls-270p-video': {
use: ':original',
robot: '/video/encode',
ffmpeg_stack: 'v6.0.0',
preset: 'hls-270p',
result: true,
turbo: false,
},
dash_adapted: {
use: {
steps: ['dash_720p_video', 'dash_360p_video', 'dash_270p_video', 'dash-64k-audio', 'dash-32k-audio'],
bundle_steps: true,
},
robot: '/video/adaptive',
result: true,
playlist_name: 'dash-playlist.mpd',
technique: 'dash',
},
hls_adapted: {
use: {
steps: ['hls-720p-video', 'hls-360p-video', 'hls-270p-video'],
bundle_steps: true,
},
robot: '/video/adaptive',
result: true,
playlist_name: 'hls-playlist.m3u8',
technique: 'hls',
},
adaptive_exported: {
use: ['dash_adapted', 'hls_adapted'],
robot: '/s3/store',
credentials: 'demo_s3_credentials',
path: '${unique_original_prefix}-${file.original_basename}/adapt/${file.meta.relative_path}/${file.name}',
url_prefix: 'https://demos.transloadit.com/',
},
plain_exported: {
use: [':original', 'plain_720_vp9_encoded', 'plain_720_h264_encoded', 'thumbnailed'],
robot: '/s3/store',
credentials: 'demo_s3_credentials',
path: '${unique_original_prefix}-${file.original_basename}/plain/${previous_step.name}.${file.ext}',
url_prefix: 'https://demos.transloadit.com/',
},
},
},
}
// Execute
const result = await transloadit.createAssembly(options)
// Show results
console.log({ result })
}
main().catch(console.error)
# [sudo] npm install transloadify -g
# Auth
export TRANSLOADIT_KEY="YOUR_TRANSLOADIT_KEY"
# Save Encoding Instructions
echo '{
"steps": {
":original": {
"robot": "/upload/handle"
},
"plain_720_vp9_encoded": {
"use": ":original",
"robot": "/video/encode",
"result": true,
"ffmpeg_stack": "v6.0.0",
"height": 720,
"preset": "webm",
"width": 1280,
"turbo": false
},
"plain_720_h264_encoded": {
"use": ":original",
"robot": "/video/encode",
"result": true,
"ffmpeg_stack": "v6.0.0",
"height": 720,
"preset": "ipad-high",
"width": 1280,
"turbo": false
},
"thumbnailed": {
"use": "plain_720_h264_encoded",
"robot": "/video/thumbs",
"result": true,
"count": 1,
"ffmpeg_stack": "v6.0.0",
"format": "jpg",
"height": 720,
"resize_strategy": "fit",
"width": 1280
},
"dash_720p_video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash_720p_video",
"result": true,
"turbo": false
},
"dash_360p_video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash_360p_video",
"result": true,
"turbo": false
},
"dash_270p_video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash_270p_video",
"result": true,
"turbo": false
},
"dash-32k-audio": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash-32k-audio",
"result": true,
"turbo": false
},
"dash-64k-audio": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash-64k-audio",
"result": true,
"turbo": false
},
"hls-720p-video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "hls-720p",
"result": true,
"turbo": false
},
"hls-360p-video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "hls-360p",
"result": true,
"turbo": false
},
"hls-270p-video": {
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "hls-270p",
"result": true,
"turbo": false
},
"dash_adapted": {
"use": {
"steps": ["dash_720p_video", "dash_360p_video", "dash_270p_video", "dash-64k-audio", "dash-32k-audio"],
"bundle_steps": true
},
"robot": "/video/adaptive",
"result": true,
"playlist_name": "dash-playlist.mpd",
"technique": "dash"
},
"hls_adapted": {
"use": {
"steps": ["hls-720p-video", "hls-360p-video", "hls-270p-video"],
"bundle_steps": true
},
"robot": "/video/adaptive",
"result": true,
"playlist_name": "hls-playlist.m3u8",
"technique": "hls"
},
"adaptive_exported": {
"use": ["dash_adapted", "hls_adapted"],
"robot": "/s3/store",
"credentials": "demo_s3_credentials",
"path": "${unique_original_prefix}-${file.original_basename}/adapt/${file.meta.relative_path}/${file.name}",
"url_prefix": "https://demos.transloadit.com/"
},
"plain_exported": {
"use": [":original", "plain_720_vp9_encoded", "plain_720_h264_encoded", "thumbnailed"],
"robot": "/s3/store",
"credentials": "demo_s3_credentials",
"path": "${unique_original_prefix}-${file.original_basename}/plain/${previous_step.name}.${file.ext}",
"url_prefix": "https://demos.transloadit.com/"
}
}
}' > ./steps.json
# Execute
transloadify \
--input "kite25.mp4" \
--steps "./steps.json" \
--output "./output.example"
// composer require transloadit/php-sdk
use transloadit\Transloadit;
$transloadit = new Transloadit([
"key" => "YOUR_TRANSLOADIT_KEY",
"secret" => "MY_TRANSLOADIT_SECRET",
]);
// Start the Assembly
$response = $transloadit->createAssembly([
"files" => ["kite25.mp4"],
"params" => [
"steps" => [
":original" => [
"robot" => "/upload/handle",
],
"plain_720_vp9_encoded" => [
"use" => ":original",
"robot" => "/video/encode",
"result" => true,
"ffmpeg_stack" => "v6.0.0",
"height" => 720,
"preset" => "webm",
"width" => 1280,
"turbo" => false,
],
"plain_720_h264_encoded" => [
"use" => ":original",
"robot" => "/video/encode",
"result" => true,
"ffmpeg_stack" => "v6.0.0",
"height" => 720,
"preset" => "ipad-high",
"width" => 1280,
"turbo" => false,
],
"thumbnailed" => [
"use" => "plain_720_h264_encoded",
"robot" => "/video/thumbs",
"result" => true,
"count" => 1,
"ffmpeg_stack" => "v6.0.0",
"format" => "jpg",
"height" => 720,
"resize_strategy" => "fit",
"width" => 1280,
],
"dash_720p_video" => [
"use" => ":original",
"robot" => "/video/encode",
"ffmpeg_stack" => "v6.0.0",
"preset" => "dash_720p_video",
"result" => true,
"turbo" => false,
],
"dash_360p_video" => [
"use" => ":original",
"robot" => "/video/encode",
"ffmpeg_stack" => "v6.0.0",
"preset" => "dash_360p_video",
"result" => true,
"turbo" => false,
],
"dash_270p_video" => [
"use" => ":original",
"robot" => "/video/encode",
"ffmpeg_stack" => "v6.0.0",
"preset" => "dash_270p_video",
"result" => true,
"turbo" => false,
],
"dash-32k-audio" => [
"use" => ":original",
"robot" => "/video/encode",
"ffmpeg_stack" => "v6.0.0",
"preset" => "dash-32k-audio",
"result" => true,
"turbo" => false,
],
"dash-64k-audio" => [
"use" => ":original",
"robot" => "/video/encode",
"ffmpeg_stack" => "v6.0.0",
"preset" => "dash-64k-audio",
"result" => true,
"turbo" => false,
],
"hls-720p-video" => [
"use" => ":original",
"robot" => "/video/encode",
"ffmpeg_stack" => "v6.0.0",
"preset" => "hls-720p",
"result" => true,
"turbo" => false,
],
"hls-360p-video" => [
"use" => ":original",
"robot" => "/video/encode",
"ffmpeg_stack" => "v6.0.0",
"preset" => "hls-360p",
"result" => true,
"turbo" => false,
],
"hls-270p-video" => [
"use" => ":original",
"robot" => "/video/encode",
"ffmpeg_stack" => "v6.0.0",
"preset" => "hls-270p",
"result" => true,
"turbo" => false,
],
"dash_adapted" => [
"use" => [
"steps" => ["dash_720p_video", "dash_360p_video", "dash_270p_video", "dash-64k-audio", "dash-32k-audio"],
"bundle_steps" => true,
],
"robot" => "/video/adaptive",
"result" => true,
"playlist_name" => "dash-playlist.mpd",
"technique" => "dash",
],
"hls_adapted" => [
"use" => [
"steps" => ["hls-720p-video", "hls-360p-video", "hls-270p-video"],
"bundle_steps" => true,
],
"robot" => "/video/adaptive",
"result" => true,
"playlist_name" => "hls-playlist.m3u8",
"technique" => "hls",
],
"adaptive_exported" => [
"use" => ["dash_adapted", "hls_adapted"],
"robot" => "/s3/store",
"credentials" => "demo_s3_credentials",
"path" => "${unique_original_prefix}-${file.original_basename}/adapt/${file.meta.relative_path}/${file.name}",
"url_prefix" => "https://demos.transloadit.com/",
],
"plain_exported" => [
"use" => [":original", "plain_720_vp9_encoded", "plain_720_h264_encoded", "thumbnailed"],
"robot" => "/s3/store",
"credentials" => "demo_s3_credentials",
"path" => "${unique_original_prefix}-${file.original_basename}/plain/${previous_step.name}.${file.ext}",
"url_prefix" => "https://demos.transloadit.com/",
],
],
],
]);
# gem install transloadit
# $ irb -rubygems
# >> require 'transloadit'
# => true
transloadit = Transloadit.new([
:key => "YOUR_TRANSLOADIT_KEY",
])
# Set Encoding Instructions
_original = transloadit.step(":original", "/upload/handle", {})
plain_720_vp9_encoded = transloadit.step("plain_720_vp9_encoded", "/video/encode", [
:use => ":original",
:result => true,
:ffmpeg_stack => "v6.0.0",
:height => 720,
:preset => "webm",
:width => 1280,
:turbo => false
])
plain_720_h264_encoded = transloadit.step("plain_720_h264_encoded", "/video/encode", [
:use => ":original",
:result => true,
:ffmpeg_stack => "v6.0.0",
:height => 720,
:preset => "ipad-high",
:width => 1280,
:turbo => false
])
thumbnailed = transloadit.step("thumbnailed", "/video/thumbs", [
:use => "plain_720_h264_encoded",
:result => true,
:count => 1,
:ffmpeg_stack => "v6.0.0",
:format => "jpg",
:height => 720,
:resize_strategy => "fit",
:width => 1280
])
dash_720p_video = transloadit.step("dash_720p_video", "/video/encode", [
:use => ":original",
:ffmpeg_stack => "v6.0.0",
:preset => "dash_720p_video",
:result => true,
:turbo => false
])
dash_360p_video = transloadit.step("dash_360p_video", "/video/encode", [
:use => ":original",
:ffmpeg_stack => "v6.0.0",
:preset => "dash_360p_video",
:result => true,
:turbo => false
])
dash_270p_video = transloadit.step("dash_270p_video", "/video/encode", [
:use => ":original",
:ffmpeg_stack => "v6.0.0",
:preset => "dash_270p_video",
:result => true,
:turbo => false
])
dash_32k_audio = transloadit.step("dash-32k-audio", "/video/encode", [
:use => ":original",
:ffmpeg_stack => "v6.0.0",
:preset => "dash-32k-audio",
:result => true,
:turbo => false
])
dash_64k_audio = transloadit.step("dash-64k-audio", "/video/encode", [
:use => ":original",
:ffmpeg_stack => "v6.0.0",
:preset => "dash-64k-audio",
:result => true,
:turbo => false
])
hls_720p_video = transloadit.step("hls-720p-video", "/video/encode", [
:use => ":original",
:ffmpeg_stack => "v6.0.0",
:preset => "hls-720p",
:result => true,
:turbo => false
])
hls_360p_video = transloadit.step("hls-360p-video", "/video/encode", [
:use => ":original",
:ffmpeg_stack => "v6.0.0",
:preset => "hls-360p",
:result => true,
:turbo => false
])
hls_270p_video = transloadit.step("hls-270p-video", "/video/encode", [
:use => ":original",
:ffmpeg_stack => "v6.0.0",
:preset => "hls-270p",
:result => true,
:turbo => false
])
dash_adapted = transloadit.step("dash_adapted", "/video/adaptive", [
:use => [
:steps => ["dash_720p_video", "dash_360p_video", "dash_270p_video", "dash-64k-audio", "dash-32k-audio"],
:bundle_steps => true
],
:result => true,
:playlist_name => "dash-playlist.mpd",
:technique => "dash"
])
hls_adapted = transloadit.step("hls_adapted", "/video/adaptive", [
:use => [
:steps => ["hls-720p-video", "hls-360p-video", "hls-270p-video"],
:bundle_steps => true
],
:result => true,
:playlist_name => "hls-playlist.m3u8",
:technique => "hls"
])
adaptive_exported = transloadit.step("adaptive_exported", "/s3/store", [
:use => ["dash_adapted", "hls_adapted"],
:credentials => "demo_s3_credentials",
:path => "${unique_original_prefix}-${file.original_basename}/adapt/${file.meta.relative_path}/${file.name}",
:url_prefix => "https://demos.transloadit.com/"
])
plain_exported = transloadit.step("plain_exported", "/s3/store", [
:use => [":original", "plain_720_vp9_encoded", "plain_720_h264_encoded", "thumbnailed"],
:credentials => "demo_s3_credentials",
:path => "${unique_original_prefix}-${file.original_basename}/plain/${previous_step.name}.${file.ext}",
:url_prefix => "https://demos.transloadit.com/"
])
transloadit.assembly([
:steps => [
_original,
, plain_720_vp9_encoded,
, plain_720_h264_encoded,
, thumbnailed,
, dash_720p_video,
, dash_360p_video,
, dash_270p_video,
, dash_32k_audio,
, dash_64k_audio,
, hls_720p_video,
, hls_360p_video,
, hls_270p_video,
, dash_adapted,
, hls_adapted,
, adaptive_exported,
, plain_exported
]
])
# Add files to upload
files = []
files.push("kite25.mp4")
# Start the Assembly
response = assembly.create! *files
until response.finished?
sleep 1; response.reload!
end
if !response.error?
# handle success
end
# pip install pytransloadit
from transloadit import client
tl = client.Transloadit('YOUR_TRANSLOADIT_KEY', 'MY_TRANSLOADIT_SECRET')
assembly = tl.new_assembly()
# Set Encoding Instructions
assembly.add_step(":original", "/upload/handle", {})
assembly.add_step("plain_720_vp9_encoded", "/video/encode", {
'use': ':original',
'result': True,
'ffmpeg_stack': 'v6.0.0',
'height': 720,
'preset': 'webm',
'width': 1280,
'turbo': False
})
assembly.add_step("plain_720_h264_encoded", "/video/encode", {
'use': ':original',
'result': True,
'ffmpeg_stack': 'v6.0.0',
'height': 720,
'preset': 'ipad-high',
'width': 1280,
'turbo': False
})
assembly.add_step("thumbnailed", "/video/thumbs", {
'use': 'plain_720_h264_encoded',
'result': True,
'count': 1,
'ffmpeg_stack': 'v6.0.0',
'format': 'jpg',
'height': 720,
'resize_strategy': 'fit',
'width': 1280
})
assembly.add_step("dash_720p_video", "/video/encode", {
'use': ':original',
'ffmpeg_stack': 'v6.0.0',
'preset': 'dash_720p_video',
'result': True,
'turbo': False
})
assembly.add_step("dash_360p_video", "/video/encode", {
'use': ':original',
'ffmpeg_stack': 'v6.0.0',
'preset': 'dash_360p_video',
'result': True,
'turbo': False
})
assembly.add_step("dash_270p_video", "/video/encode", {
'use': ':original',
'ffmpeg_stack': 'v6.0.0',
'preset': 'dash_270p_video',
'result': True,
'turbo': False
})
assembly.add_step("dash-32k-audio", "/video/encode", {
'use': ':original',
'ffmpeg_stack': 'v6.0.0',
'preset': 'dash-32k-audio',
'result': True,
'turbo': False
})
assembly.add_step("dash-64k-audio", "/video/encode", {
'use': ':original',
'ffmpeg_stack': 'v6.0.0',
'preset': 'dash-64k-audio',
'result': True,
'turbo': False
})
assembly.add_step("hls-720p-video", "/video/encode", {
'use': ':original',
'ffmpeg_stack': 'v6.0.0',
'preset': 'hls-720p',
'result': True,
'turbo': False
})
assembly.add_step("hls-360p-video", "/video/encode", {
'use': ':original',
'ffmpeg_stack': 'v6.0.0',
'preset': 'hls-360p',
'result': True,
'turbo': False
})
assembly.add_step("hls-270p-video", "/video/encode", {
'use': ':original',
'ffmpeg_stack': 'v6.0.0',
'preset': 'hls-270p',
'result': True,
'turbo': False
})
assembly.add_step("dash_adapted", "/video/adaptive", {
'use': {
'steps': ['dash_720p_video', 'dash_360p_video', 'dash_270p_video', 'dash-64k-audio', 'dash-32k-audio'],
'bundle_steps': True
},
'result': True,
'playlist_name': 'dash-playlist.mpd',
'technique': 'dash'
})
assembly.add_step("hls_adapted", "/video/adaptive", {
'use': {
'steps': ['hls-720p-video', 'hls-360p-video', 'hls-270p-video'],
'bundle_steps': True
},
'result': True,
'playlist_name': 'hls-playlist.m3u8',
'technique': 'hls'
})
assembly.add_step("adaptive_exported", "/s3/store", {
'use': ['dash_adapted', 'hls_adapted'],
'credentials': 'demo_s3_credentials',
'path': '${unique_original_prefix}-${file.original_basename}/adapt/${file.meta.relative_path}/${file.name}',
'url_prefix': 'https://demos.transloadit.com/'
})
assembly.add_step("plain_exported", "/s3/store", {
'use': [':original', 'plain_720_vp9_encoded', 'plain_720_h264_encoded', 'thumbnailed'],
'credentials': 'demo_s3_credentials',
'path': '${unique_original_prefix}-${file.original_basename}/plain/${previous_step.name}.${file.ext}',
'url_prefix': 'https://demos.transloadit.com/'
})
# Add files to upload
assembly.add_file(open('kite25.mp4', 'rb'))
# Start the Assembly
assembly_response = assembly.create(retries=5, wait=True)
print(assembly_response.data.get('assembly_ssl_url'))
# or:
print(assembly_response.data['assembly_ssl_url'])
// go get gopkg.in/transloadit/go-sdk.v1
package main
import (
"context"
"fmt"
"github.com/transloadit/go-sdk"
)
func main() {
// Create client
options := transloadit.DefaultConfig
options.AuthKey = "YOUR_TRANSLOADIT_KEY"
options.AuthSecret = "MY_TRANSLOADIT_SECRET"
client := transloadit.NewClient(options)
// Initialize new Assembly
assembly := transloadit.NewAssembly()
// Set Encoding Instructions
assembly.AddStep(":original", map[string]interface{}{
"robot": "/upload/handle",
})
assembly.AddStep("plain_720_vp9_encoded", map[string]interface{}{
"use": ":original",
"robot": "/video/encode",
"result": true,
"ffmpeg_stack": "v6.0.0",
"height": 720,
"preset": "webm",
"width": 1280,
"turbo": false,
})
assembly.AddStep("plain_720_h264_encoded", map[string]interface{}{
"use": ":original",
"robot": "/video/encode",
"result": true,
"ffmpeg_stack": "v6.0.0",
"height": 720,
"preset": "ipad-high",
"width": 1280,
"turbo": false,
})
assembly.AddStep("thumbnailed", map[string]interface{}{
"use": "plain_720_h264_encoded",
"robot": "/video/thumbs",
"result": true,
"count": 1,
"ffmpeg_stack": "v6.0.0",
"format": "jpg",
"height": 720,
"resize_strategy": "fit",
"width": 1280,
})
assembly.AddStep("dash_720p_video", map[string]interface{}{
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash_720p_video",
"result": true,
"turbo": false,
})
assembly.AddStep("dash_360p_video", map[string]interface{}{
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash_360p_video",
"result": true,
"turbo": false,
})
assembly.AddStep("dash_270p_video", map[string]interface{}{
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash_270p_video",
"result": true,
"turbo": false,
})
assembly.AddStep("dash-32k-audio", map[string]interface{}{
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash-32k-audio",
"result": true,
"turbo": false,
})
assembly.AddStep("dash-64k-audio", map[string]interface{}{
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "dash-64k-audio",
"result": true,
"turbo": false,
})
assembly.AddStep("hls-720p-video", map[string]interface{}{
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "hls-720p",
"result": true,
"turbo": false,
})
assembly.AddStep("hls-360p-video", map[string]interface{}{
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "hls-360p",
"result": true,
"turbo": false,
})
assembly.AddStep("hls-270p-video", map[string]interface{}{
"use": ":original",
"robot": "/video/encode",
"ffmpeg_stack": "v6.0.0",
"preset": "hls-270p",
"result": true,
"turbo": false,
})
assembly.AddStep("dash_adapted", map[string]interface{}{
"use": map[string]interface{}{
"steps": ["dash_720p_video", "dash_360p_video", "dash_270p_video", "dash-64k-audio", "dash-32k-audio"],
"bundle_steps": true,
},
"robot": "/video/adaptive",
"result": true,
"playlist_name": "dash-playlist.mpd",
"technique": "dash",
})
assembly.AddStep("hls_adapted", map[string]interface{}{
"use": map[string]interface{}{
"steps": ["hls-720p-video", "hls-360p-video", "hls-270p-video"],
"bundle_steps": true,
},
"robot": "/video/adaptive",
"result": true,
"playlist_name": "hls-playlist.m3u8",
"technique": "hls",
})
assembly.AddStep("adaptive_exported", map[string]interface{}{
"use": ["dash_adapted", "hls_adapted"],
"robot": "/s3/store",
"credentials": "demo_s3_credentials",
"path": "${unique_original_prefix}-${file.original_basename}/adapt/${file.meta.relative_path}/${file.name}",
"url_prefix": "https://demos.transloadit.com/",
})
assembly.AddStep("plain_exported", map[string]interface{}{
"use": [":original", "plain_720_vp9_encoded", "plain_720_h264_encoded", "thumbnailed"],
"robot": "/s3/store",
"credentials": "demo_s3_credentials",
"path": "${unique_original_prefix}-${file.original_basename}/plain/${previous_step.name}.${file.ext}",
"url_prefix": "https://demos.transloadit.com/",
})
// Add files to upload
assembly.AddFile("kite25.mp4"))
// Start the Assembly
info, err := client.StartAssembly(context.Background(), assembly)
if err != nil {
panic(err)
}
// All files have now been uploaded and the Assembly has started but no
// results are available yet since the conversion has not finished.
// WaitForAssembly provides functionality for polling until the Assembly
// has ended.
info, err = client.WaitForAssembly(context.Background(), info)
if err != nil {
panic(err)
}
fmt.Printf("You can check some results at: ")
fmt.Printf(" - %s\n", info.Results[":original"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["plain_720_vp9_encoded"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["plain_720_h264_encoded"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["thumbnailed"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["dash_720p_video"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["dash_360p_video"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["dash_270p_video"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["dash-32k-audio"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["dash-64k-audio"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["hls-720p-video"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["hls-360p-video"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["hls-270p-video"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["dash_adapted"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["hls_adapted"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["adaptive_exported"][0].SSLURL)
fmt.Printf(" - %s\n", info.Results["plain_exported"][0].SSLURL)
}
// implementation 'com.transloadit.sdk:transloadit:1.0.0'
import com.transloadit.sdk.Assembly;
import com.transloadit.sdk.Transloadit;
import com.transloadit.sdk.exceptions.LocalOperationException;
import com.transloadit.sdk.exceptions.RequestException;
import com.transloadit.sdk.response.AssemblyResponse;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) {
// Initialize the Transloadit client
Transloadit transloadit = new Transloadit("YOUR_TRANSLOADIT_KEY", "MY_TRANSLOADIT_SECRET");
Assembly assembly = transloadit.newAssembly();
// Set Encoding Instructions
Map<String, Object> _originalStepOptions = new HashMap();
assembly.addStep(":original", "/upload/handle", _originalStepOptions);
Map<String, Object> plain_720_vp9_encodedStepOptions = new HashMap();
plain_720_vp9_encodedStepOptions.put("use", ":original");
plain_720_vp9_encodedStepOptions.put("result", true);
plain_720_vp9_encodedStepOptions.put("ffmpeg_stack", "v6.0.0");
plain_720_vp9_encodedStepOptions.put("height", 720);
plain_720_vp9_encodedStepOptions.put("preset", "webm");
plain_720_vp9_encodedStepOptions.put("width", 1280);
plain_720_vp9_encodedStepOptions.put("turbo", false);
assembly.addStep("plain_720_vp9_encoded", "/video/encode", plain_720_vp9_encodedStepOptions);
Map<String, Object> plain_720_h264_encodedStepOptions = new HashMap();
plain_720_h264_encodedStepOptions.put("use", ":original");
plain_720_h264_encodedStepOptions.put("result", true);
plain_720_h264_encodedStepOptions.put("ffmpeg_stack", "v6.0.0");
plain_720_h264_encodedStepOptions.put("height", 720);
plain_720_h264_encodedStepOptions.put("preset", "ipad-high");
plain_720_h264_encodedStepOptions.put("width", 1280);
plain_720_h264_encodedStepOptions.put("turbo", false);
assembly.addStep("plain_720_h264_encoded", "/video/encode", plain_720_h264_encodedStepOptions);
Map<String, Object> thumbnailedStepOptions = new HashMap();
thumbnailedStepOptions.put("use", "plain_720_h264_encoded");
thumbnailedStepOptions.put("result", true);
thumbnailedStepOptions.put("count", 1);
thumbnailedStepOptions.put("ffmpeg_stack", "v6.0.0");
thumbnailedStepOptions.put("format", "jpg");
thumbnailedStepOptions.put("height", 720);
thumbnailedStepOptions.put("resize_strategy", "fit");
thumbnailedStepOptions.put("width", 1280);
assembly.addStep("thumbnailed", "/video/thumbs", thumbnailedStepOptions);
Map<String, Object> dash_720p_videoStepOptions = new HashMap();
dash_720p_videoStepOptions.put("use", ":original");
dash_720p_videoStepOptions.put("ffmpeg_stack", "v6.0.0");
dash_720p_videoStepOptions.put("preset", "dash_720p_video");
dash_720p_videoStepOptions.put("result", true);
dash_720p_videoStepOptions.put("turbo", false);
assembly.addStep("dash_720p_video", "/video/encode", dash_720p_videoStepOptions);
Map<String, Object> dash_360p_videoStepOptions = new HashMap();
dash_360p_videoStepOptions.put("use", ":original");
dash_360p_videoStepOptions.put("ffmpeg_stack", "v6.0.0");
dash_360p_videoStepOptions.put("preset", "dash_360p_video");
dash_360p_videoStepOptions.put("result", true);
dash_360p_videoStepOptions.put("turbo", false);
assembly.addStep("dash_360p_video", "/video/encode", dash_360p_videoStepOptions);
Map<String, Object> dash_270p_videoStepOptions = new HashMap();
dash_270p_videoStepOptions.put("use", ":original");
dash_270p_videoStepOptions.put("ffmpeg_stack", "v6.0.0");
dash_270p_videoStepOptions.put("preset", "dash_270p_video");
dash_270p_videoStepOptions.put("result", true);
dash_270p_videoStepOptions.put("turbo", false);
assembly.addStep("dash_270p_video", "/video/encode", dash_270p_videoStepOptions);
Map<String, Object> dash_32k_audioStepOptions = new HashMap();
dash_32k_audioStepOptions.put("use", ":original");
dash_32k_audioStepOptions.put("ffmpeg_stack", "v6.0.0");
dash_32k_audioStepOptions.put("preset", "dash-32k-audio");
dash_32k_audioStepOptions.put("result", true);
dash_32k_audioStepOptions.put("turbo", false);
assembly.addStep("dash-32k-audio", "/video/encode", dash_32k_audioStepOptions);
Map<String, Object> dash_64k_audioStepOptions = new HashMap();
dash_64k_audioStepOptions.put("use", ":original");
dash_64k_audioStepOptions.put("ffmpeg_stack", "v6.0.0");
dash_64k_audioStepOptions.put("preset", "dash-64k-audio");
dash_64k_audioStepOptions.put("result", true);
dash_64k_audioStepOptions.put("turbo", false);
assembly.addStep("dash-64k-audio", "/video/encode", dash_64k_audioStepOptions);
Map<String, Object> hls_720p_videoStepOptions = new HashMap();
hls_720p_videoStepOptions.put("use", ":original");
hls_720p_videoStepOptions.put("ffmpeg_stack", "v6.0.0");
hls_720p_videoStepOptions.put("preset", "hls-720p");
hls_720p_videoStepOptions.put("result", true);
hls_720p_videoStepOptions.put("turbo", false);
assembly.addStep("hls-720p-video", "/video/encode", hls_720p_videoStepOptions);
Map<String, Object> hls_360p_videoStepOptions = new HashMap();
hls_360p_videoStepOptions.put("use", ":original");
hls_360p_videoStepOptions.put("ffmpeg_stack", "v6.0.0");
hls_360p_videoStepOptions.put("preset", "hls-360p");
hls_360p_videoStepOptions.put("result", true);
hls_360p_videoStepOptions.put("turbo", false);
assembly.addStep("hls-360p-video", "/video/encode", hls_360p_videoStepOptions);
Map<String, Object> hls_270p_videoStepOptions = new HashMap();
hls_270p_videoStepOptions.put("use", ":original");
hls_270p_videoStepOptions.put("ffmpeg_stack", "v6.0.0");
hls_270p_videoStepOptions.put("preset", "hls-270p");
hls_270p_videoStepOptions.put("result", true);
hls_270p_videoStepOptions.put("turbo", false);
assembly.addStep("hls-270p-video", "/video/encode", hls_270p_videoStepOptions);
Map<String, Object> dash_adaptedStepOptions = new HashMap();
dash_adaptedStepOptions.put("use", {
"steps": new String[] { "dash_720p_video", "dash_360p_video", "dash_270p_video", "dash-64k-audio", "dash-32k-audio" },
"bundle_steps": true,
});
dash_adaptedStepOptions.put("result", true);
dash_adaptedStepOptions.put("playlist_name", "dash-playlist.mpd");
dash_adaptedStepOptions.put("technique", "dash");
assembly.addStep("dash_adapted", "/video/adaptive", dash_adaptedStepOptions);
Map<String, Object> hls_adaptedStepOptions = new HashMap();
hls_adaptedStepOptions.put("use", {
"steps": new String[] { "hls-720p-video", "hls-360p-video", "hls-270p-video" },
"bundle_steps": true,
});
hls_adaptedStepOptions.put("result", true);
hls_adaptedStepOptions.put("playlist_name", "hls-playlist.m3u8");
hls_adaptedStepOptions.put("technique", "hls");
assembly.addStep("hls_adapted", "/video/adaptive", hls_adaptedStepOptions);
Map<String, Object> adaptive_exportedStepOptions = new HashMap();
adaptive_exportedStepOptions.put("use", new String[] { "dash_adapted", "hls_adapted" });
adaptive_exportedStepOptions.put("credentials", "demo_s3_credentials");
adaptive_exportedStepOptions.put("path", "${unique_original_prefix}-${file.original_basename}/adapt/${file.meta.relative_path}/${file.name}");
adaptive_exportedStepOptions.put("url_prefix", "https://demos.transloadit.com/");
assembly.addStep("adaptive_exported", "/s3/store", adaptive_exportedStepOptions);
Map<String, Object> plain_exportedStepOptions = new HashMap();
plain_exportedStepOptions.put("use", new String[] { ":original", "plain_720_vp9_encoded", "plain_720_h264_encoded", "thumbnailed" });
plain_exportedStepOptions.put("credentials", "demo_s3_credentials");
plain_exportedStepOptions.put("path", "${unique_original_prefix}-${file.original_basename}/plain/${previous_step.name}.${file.ext}");
plain_exportedStepOptions.put("url_prefix", "https://demos.transloadit.com/");
assembly.addStep("plain_exported", "/s3/store", plain_exportedStepOptions);
// Add files to upload
assembly.addFile(new File("kite25.mp4"));
// Start the Assembly
try {
AssemblyResponse response = assembly.save();
// Wait for Assembly to finish executing
while (!response.isFinished()) {
response = transloadit.getAssemblyByUrl(response.getSslUrl());
}
System.out.println(response.getId());
System.out.println(response.getUrl());
System.out.println(response.json());
} catch (RequestException | LocalOperationException e) {
// Handle exception here
}
}
}
So many ways to integrate
-
Bulk imports
Add one of our import Robots to acquire and transcode massive media libraries. -
Handling uploads
We are the experts at reliably handling uploads. We wrote the protocol for it. -
Front-end integration
We integrate with web browsers via our next-gen file uploader Uppy and SDKs for Android and iOS. -
Back-end integration
-
Pingbacks
Configure anotify_url
to let your server receive transcoding results JSON in thetransloadit
POST field.