I have a tube site and im using this function to generate thumbs from video file
Code: Select all
$thumbwidth = 240; //thumb width
$thumbheight = 180; //thumb height
$imagick_command = "-modulate 110,102,100 -sharpen 1x1 -enhance";
shell_exec("$ffmpeg_path -ss $first -i \"".$row[file]."\" -vcodec mjpeg -vframes 1 -an -f rawvideo -s ".$thumbwidth."x".$thumbheight." \"$image\"");
shell_exec("/usr/local/bin/mogrify $imagick_command $image");

but sometimes depending on video i have thumbs like this

Whats the best way to remove this black space from thumbs, but need to keep thumb size 240x180