Negative filter not working on some videos

I’m using the PHP SDK.

I’ve noticed that some videos are not affected by the negative filter on clips.

I tried to use the negative filter on a cat video from Shotstack and that worked fine.

Same with some of my images.

But then I tried two of my own videos. Both are in grayscale, so I expected them to switch from black to white, white to black and similar for different shades of gray. But for one of them, nothing happened, for the other one, it just went completely black.

Does the negative filter not work on all videos?

P.s. on a related note, I noticed that the documentation on github for the PHP SDK, states that the negative filter is called “invert,” while the documentation on the Shotstack website says it is “negative.”
Using “invert” gives an error, so I’m sticking to “negative”.

Is it possible to share a clip where this occurs so we can reproduce the problem?

Thanks for the note on the PHP SDK. I’ve made a note for this to be fixed.

Here is a video that was created by showing first a negative video, then the original video, then a negative image and finally the original image: https://cdn.shotstack.io/au/stage/rojfw17rpf/cd30e64e-2689-4881-a85f-a648f6c31b94.mp4
Each clip is 2 seconds.
The only thing that isn’t working is the first two seconds, that should be an inverted video, but all I can see is a black screen.

It appears the edit engine is having issues with your file format. Does it have an alpha transparency layer?

I just tried with one of our luma files and it appears to be working ok:

With this being the end result:

I used the following JSON:

{
    "timeline": {
        "background": "#000000",
        "tracks": [
            {
                "clips": [
                    {
                        "asset": {
                            "type": "video",
                            "src": "https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/temp/output.mp4"
                        },
                        "start": 0,
                        "length": 5,
                        "filter": "negative"
                    }
                ]
            }
        ]
    },
    "output": {
        "format": "mp4",
        "resolution": "sd"
    }
}

Could you try using h264 encoding? I tried to convert your video file but there were issues with timestamps.

Have updated the docs to show negative and not invert.

1 Like

Thanks, that was helpful. There was alpha transparency in there, but we switched it out and used h264 encoding and now it works.

Could you confirm, though, that the negative filter is not supported for luma? That seems to be the case for us at least.

Yes you are right. The filter effect doesn’t work on the luma asset.

I see what you’re trying to do and it’s a great idea but at this point you will have to have two separate mp4 files available. Potentially you can use Shotstack to first invert luma video asset and then use it in a subsequent render?