multi robot /video/thumbs problem

Archived from the Transloadit support forum. Originally posted on May 29, 2014; details may be outdated, see our docs for current behavior. Original thread

Hi all,
I found that if you define 2 “/video/thumbs” robot, only 1 is processed. The other “/video/thumbs” are just ignored.
I tested extracting 2 thumbs with different sizes from a video because and found that one of the “/video/thumbs” robot was just ignored. I changed my assembly so that i use only one “/video/thumbs” to extract the bigger thumb and then a resize robot to create a smaller thumb.
So, my problem is solved.. but anyway i send this bug report.

best,
Francisco Azevedo

Hi Francisco,

How are your steps named? Also /video/thumbs? If so, in Javascript, object keys need to be unique, so you’d better name your steps thumb-200, thumb-400, or whatever makes sense for your usecase.

However, I’m assuming all of this as you haven’t provided the template or an assembly_id of where this happened. If I’m wrong indeed, please provide these so I can have a closer look.

Kind regards,
Kevin

Hi Kevin,

This is very simple to check. You only need to create 2 robots for thumbs.
Here goes an example i create to specifically test this problem. After processing file, you can see that “upvideo2” robot is ignored:

{
  "steps": {
    "upvideo1": {
      "robot": "/video/thumbs",
      "offsets": [
        1
      ],
      "width": 680,
      "height": 480,
      "resize_strategy": "crop",
      "format": "jpg",
      "quality": 90
    },
    "upvideo2": {
      "robot": "/video/thumbs",
      "offsets": [
        3
      ],
      "width": 100,
      "height": 100,
      "resize_strategy": "crop",
      "format": "jpg",
      "quality": 50
    },
    "ofile": {
      "robot": "/cloudfiles/store",
      "path": "${file.id}-${file.url_name}",
      "container": "originals",
      "account_type": "uk",
      "user": "----myuser----",
      "key": "REDACTED",
      "use": [
        "upvideo1",
        "upvideo2"
      ]
    }
  }
}

best,
Francisco Azevedo

Hi Francisco,

I think the problem is you did not specify a use parameter for the first 2 steps. Hence the behavior is to default to the previous step. Can you add use: ":original" to both steps?

Best,
Kevin

Hey francisco,

You need to specify the use parameter. The video thimbs robot emits inages and you are piping them into the second video thumbs bot, which expects a video and ignores images.

Kind regards,

Tim Koschuetzki
Co-Founder Transloadit
@tim_kos

Hi Kevin,
With "use": ":original" it works as expected.

But.. I thought that if we don’t specify a "use" it is same as specify a "use":":original". This sounds very strange.. is this a bug?

Or is “by design”.. and we should always specify a "use" parameter is every step so that we don’t have unexpected results?

best,
Francisco Azevedo

Hi Francisco,

Please always specify a use parameter. The default is to plug in the previous step, but that’s not airtight as ecma does not guarantee order inside javascript objects.

There’s information in our documentation should you want to learn more about all this.

Kind regards,
Kevin

Hi Kevin,
I will update all steps so that always include "use" parameter.
Thanks for your time.

best,
Francisco Azevedo

Hah, looks like Kevin and I typed a reply at the same time. :smiley: You are getting some extra attention here, Francisco. ; )

One thing to note is, that in the future we will make it mandatory to include a use parameter in every step. So while you are doing this for this template, you might also want to do it already for all your other templates.

Kind regards,
Tim

Co-Founder Transloadit
@tim_kos