The /video/merge Robot

Our /video/merge robot

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

The /video/merge Robot composes a new video by adding an audio track to existing still image(s) or video.

The /video/merge Robot's Parameters

Name Type Default Description
preset String "flash" Generates the video according to pre-configured video presets. 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.
width Integer(1-1920) Width of the input image Width of the generated video, in pixels.
height Integer(1-1080) Height of the input image Height of the generated video, in pixels.
resize_strategy String "pad" If the given width/height parameters are bigger than the input image's dimensions, then the resize_strategy determines how the image will be resized to match the provided width/height. 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.
framerate String "1/5" When merging images to generate a video this is the input framerate. A value of "1/5" means each image is given 5 seconds before the next frame appears (the inverse of a framerate of "5"). Likewise for "1/10", "1/20", etc. A value of "5" means there are 5 frames per second.
duration Float 5.0 When merging images to generate a video this is the desired target duration in seconds. The float value can take one decimal digit. If you want all images to be displayed exactly once, then you can set the duration according to this formula: duration = numberOfImages / framerate. This also works for the inverse framerate values like 1/5.

Example use cases featuring the /video/merge robot

See the robot in action with some live demos and code samples right here on our website:

Convert any video to animated GIF

Here you can see a quick example of the Assembly Instructions required to create this encoding pipeline. More information is available in the Live demo

{
 "steps": {
    "extracted_thumbs": {
      "use": ":original",
      "robot": "/video/thumbs",
      "result": false,
      "count": 50
    },
    "anigif": {
      "robot": "/video/merge",
      "use": {
        "steps": [
          {
            "name": "extracted_thumbs",
            "as": "image"
          }
        ]
      },
      "result": true,
      "duration": 7.8,
      "framerate": "10",
      "ffmpeg_stack": "v2.2.3",
      "ffmpeg": {
        "f": "gif",
        "pix_fmt": "rgb24"
      },
      "resize_strategy": "pad"
    },
    "exported": {
      "use": [
        ":original",
        "anigif"
      ],
      "robot": "/s3/store",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET",
      "bucket": "YOUR_S3_BUCKET"
    }
  }
}

Generate a video from an image sequence

Here you can see a quick example of the Assembly Instructions required to create this encoding pipeline. More information is available in the Live demo

{
 "steps": {
    "imported_video_encode": {
      "robot": "/http/import",
      "url": "https://transloadit.com/assets/images/robots/video-encode.jpg"
    },
    "imported_image_resize": {
      "robot": "/http/import",
      "url": "https://transloadit.com/assets/images/robots/image-resize.jpg"
    },
    "imported_audio_encode": {
      "robot": "/http/import",
      "url": "https://transloadit.com/assets/images/robots/audio-encode.jpg"
    },
    "merger": {
      "robot": "/video/merge",
      "use": {
        "steps": [
          {
            "name": ":original",
            "as": "audio"
          },
          {
            "name": "imported_video_encode",
            "as": "image"
          },
          {
            "name": "imported_image_resize",
            "as": "image"
          },
          {
            "name": "imported_audio_encode",
            "as": "image"
          }
        ]
      },
      "result": true,
      "framerate": "1/3",
      "duration": 9,
      "ffmpeg_stack": "v2.2.3",
      "preset": "ipad-high",
      "resize_strategy": "pad"
    }
  }
}

Merge an audio and a video file

Here you can see a quick example of the Assembly Instructions required to create this encoding pipeline. More information is available in the Live demo

{
 "steps": {
    "audio_import": {
      "robot": "/http/import",
      "url": "http://static.transloadit.com/crm_demos/buddha_machine.wav"
    },
    "image_import": {
      "robot": "/http/import",
      "url": "https://transloadit.com/assets/images/robots/170x170/html-convert.jpg"
    },
    "merged_video": {
      "robot": "/video/merge",
      "ffmpeg_stack": "v2.2.3",
      "use": [
        {
          "name": "audio_import",
          "as": "audio"
        },
        {
          "name": "image_import",
          "as": "image"
        }
      ],
      "width": 170,
      "height": 170,
      "preset": "iphone-high",
      "result": true
    },
    "replaced_audio_track": {
      "robot": "/video/merge",
      "use": [
        {
          "name": ":original",
          "as": "audio"
        },
        {
          "name": "merged_video",
          "as": "video"
        }
      ],
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "width": 170,
      "height": 170,
      "preset": "iphone-high"
    }
  }
}

Merge an audio file and an image to generate a video

Here you can see a quick example of the Assembly Instructions required to create this encoding pipeline. More information is available in the Live demo

{
 "steps": {
    "imported_image": {
      "robot": "/http/import",
      "url": "https://transloadit.com/assets/images/video-merge-demo/mountain.jpg"
    },
    "merger": {
      "robot": "/video/merge",
      "use": {
        "steps": [
          {
            "name": ":original",
            "as": "audio"
          },
          {
            "name": "imported_image",
            "as": "image"
          }
        ]
      },
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "ipad-high",
      "resize_strategy": "pad"
    }
  }
}


Did you know?

You can easily combine Robots to create powerful workflows, unique to your business.

This is the power of Transloadit.