Glitch at borders of video asset

Hello! I often have some glitch at right and left borders of video asset. It happens not always but still too often. Could you fix it please?

I attach screenshot with the glitch. For the video asset I used option “fit”: “contain”.

What are the dimensions of the source video?

This normally happens when the source video is an irregular shape and needs to be stretched to a different aspect ratio or size and the artifact is created by the encoder.

The only real way to fix this right now is to hide it by making the video slightly larger than the output size using the scale parameter or perhaps some kind of overlay border if you want the clip to be smaller than the output.

If you post your JSON or a link to the source video we can take a look at its dimensions/aspect ratio and see if we can mockup a fix.

Ok, here is the source video: https://preview.redd.it/lh7sj06ewaj71.gif?format=mp4&s=e4c73fa27366543f4d4f5195a9b6ad24611aef29

But it happens to other videos too, very often. Almost half of videos that I use get rendered with this glitch.

The issue is to do with how the clip is scaled - some aspect ratios when scaled it results in the height equaling a fraction of a pixel and this messes with the encoding.

You can actually work around this issue using the crop feature for a video clip.

This JSON will crop the right hand side glitch and recenter the video once the glitch is cropped:

{
    "output": {
        "format": "mp4",
        "resolution": "hd"
    },
    "timeline": {
        "tracks": [
            {
                "clips": [
                    {
                        "asset": {
                            "type": "video",
                            "src": "https://preview.redd.it/lh7sj06ewaj71.gif?format=mp4&s=e4c73fa27366543f4d4f5195a9b6ad24611aef29",
                            "crop": {
                                "right": 0.01
                            }
                        },
                        "start": 0,
                        "length": 5,
                        "fit": "contain",
                        "offset": {
                            "x": 0.005
                        }
                    }
                ]
            }
        ]
    }
}

And this is how it looks after the crop:

API Docs for cropping a video are here: Shotstack v1 API Reference Documentation

1 Like

Yes, the “crop” deals perfectly with this problem! Thanks for your help :slight_smile:

1 Like