Adjust video quality (width and height) in php

one text

I download instagram videos through telegram bot but when the video size exceeds 20mb, the quality of the video starts to degrade (ie width and height). How can I fix this problem in php?

This is my code in php:

    {
        $get_object = json_decode($json);
        if (isset($get_object->video)) {
            $baseName = basename($get_object->video);
            $baseName_explode = explode('?', $baseName);
            $extension_explode = explode('.', $baseName_explode[0]);
            $file_name = date("Y-m-d")."_".rand(1000, 9999) . '.' . $extension_explode[1];
            if (file_put_contents('uploads/download-videos/' . $file_name, file_get_contents($get_object->video))) {
                return ['status' => true, 'type' => 'video', 'file_name' => $file_name];
            }
            
            return ['status' => false, 'type' => 'video', 'file_name' => ''];
        }
        return ['status' => false, 'type' => null, 'file_name' => null];
    }

Source