How to force portrait video in Transloadit?

I want to force all uploaded video into a portrait or vertial 720p aspect (1280w, 720h) using the fillcrop algorithm. I thought I had things working, landscape video is cropped in as expected. I just recently uploaded a video that was filmed already in portrait 1080p and assumed nothing would get cutoff but the the enitire top and bottom region was removed and replaced with blackness, i’m stumped on how to fix this

allow_steps_override": "false",
  "steps": {
    ":original": {
      "robot": "/upload/handle"
    },
    "filter": {
      "use": ":original",
      "robot": "/file/filter",
      "accepts": [
        [
          "${file.mime}",
          "regex",
          "video"
        ]
      ],
      "error_on_decline": true
    },
    "viruscheck": {
      "use": "filter",
      "robot": "/file/virusscan",
      "error_on_decline": true
    },
    "video_iphone": {
      "use": "viruscheck",
      "robot": "/video/encode",
      "ffmpeg_stack": "v3.3.3",
      "ffmpeg": {
        "b:v": "2M"
      },
      "preset": "iphone",
      "resize_strategy": "fillcrop",
      "width": 720,
      "height": 1280
    },
    "thumbnailed": {
      "use": "video_iphone",
      "robot": "/video/thumbs",
      "ffmpeg_stack": "v3.3.3",
      "resize_strategy": "fillcrop",
      "height": 1280,
      "width": 720,
      "count": 10
    },
    "animated": {
      "robot": "/video/merge",
      "use": {
        "steps": [
          {
            "name": "thumbnailed",
            "as": "image"
          }
        ]
      },
      "result": true,
      "framerate": "5",
      "duration": 2,
      "ffmpeg_stack": "v3.3.3",
      "ffmpeg": {
        "f": "gif",
        "pix_fmt": "rgb24"
      }
    },
    "export": {
      "use": [
        "animated",
        "video_iphone"
      ],
   ...

Whats more confusing is that the generated thumbnail for the portrait video has the entire image intact, so the thumbnail is created properly but the video is not.

How should I modify the template to simply force 720p portrait video with fillcrop

Thanks

Hello! I currently am not completely sure of the issue, but I have a few ideas…

First off, the docs for Transloadit specify that the maximum width parameter is 1920. All good so far. But, the maximum height parameter is 1080. Here is the docs page I’m refering to. However, I don’t know how this affects your use case. I can’t be fully sure if it is a soft limit, or if weird things start to happen when you pass it; Basically, just take that into consideration

Second, I think the preset might have something do to with it. When I was doisome testing for this issue, I found that sometimes, with certain presets, I was unable to pass that 1080 lock on height. It might be worth trying a few different presets, or setting your parameters directory from the ffmpeg option.

This might just be a bug with how Transloadit handles the resize strategy (as I’d assume it is), or there could be a missing parameter that I am not aware of. I can’t be fully sure if it is a bug or something is missing in the template

I can’t fully answer this question, but I have a feeling that it may be caused by that limit. However, I did let someone else on the Transloadit team know and they said that it is a hard limit and that it should be immediately changed. So hopefully, soon enough this issue will resolve itself. If anything changes, let me know

- Andrew

Hey Andrew,

Thanks for the update. Thats helpful. Could you please keep me updated about what the Transloadit team say? Thanks

Okay so after some back and forth from various team members, I’ve gathered this information

  1. There is not a hard limit… It just means that there are no templates for 4k, 6k, or 8k, but if you set them up yourself, they work
  2. The reason for this is unknown (although it doesn’t really matter for this issue)
  3. This means that it most likely isn’t the source of your issue

I’ll continue to search and try and find a solution to your issue. If anything changes, I’ll let you know

- Andrew