How do I combine two videos without know the length?

I want to combine two videos using the API but I don’t know the length of the two videos. How do I do this?

You can combine two videos of unknown length by using the Media Inspector endpoint. This endpoint probes your media files for metadata such as duration, size, etc.

An example in javascript

import axios from "";

const probeEndpoint = '';
const renderEndpoint = '';

const videoOne = '';
const videoTwo = '';

const probe = async (url) => {

  let result = axios.get(probeEndpoint+encodeURIComponent(url));
  return result;

const render = async (headers, json) => {
  const response = axios({
    method: 'post',
    url: renderEndpoint,
    data: json,
    headers: headers
  return response;

const probeOne = await probe(videoOne);
const probeTwo = await probe(videoTwo);

const durationOne = parseFloat(;
const durationTwo = parseFloat(;

const json = {
    "timeline": {
        "tracks": [
                "clips": [
                        "asset": {
                            "type": "video",
                            "src": videoOne
                        "start": 0,
                        "length": durationOne
                        "asset": {
                            "type": "video",
                            "src": videoTwo
                        "start": durationOne,
                        "length": durationTwo
    "output": {
        "format": "mp4",
        "resolution": "hd"

const headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'YOUR_API_KEY'

try {
  const response = await render(headers, json);
} catch(error) {

You can find a working CodePen example here.

I have this same problem but I’m using Integromat & Google Sheets.

In my situation, how would I go about combining videos using the Advanced Render (I can’t use Stitch because I’ll have more than 10 clips), without knowing the durations beforehand? Since Advanced render needs to know the clip start and length, I’m scratching my head trying to figure out how to tell it to do this:

  1. Start the first clip (in the first row on the sheet) at timecode: 0, and let the Length be the total duration of that clip.
  2. For all clips after the first one, use the previous Clip Length as the Clip Start time (so it begins immediately after the last one), and again let the Clip Length be the total duration.
  3. Continue until done.

I’m using the array aggregator for the URLs (we had a video call about this about a month ago), but now programming the Start and Length values without knowing them beforehand is confusing me. If there’s not a way to do it with Advanced Render, would there be a way for me to use Stitch, and just have it repeat if there’s more than 10 clips, and then eventually stitch all the stitched renders together? That’s the only other idea I can think of.

Thank you!


P.S. I should note, I also won’t know how many clips will be in the Google Sheet altogether either. It’s a system where people will send in videos to be contributed to one highlight video of all of the clips. So I won’t know how many clips will be sent in, or how long they will be.