[FFmpeg-user] ffmpeg problem with creating thumbnail

Paul B Mahol onemda at gmail.com
Thu May 23 23:33:27 CEST 2013

On 5/19/13, Dragan <forumwt at gmail.com> wrote:
> I have a tube site and im using this function to generate thumbs from video
> file
> $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");
> Here is thumbs result, this image is just what i need, no border and etc..
> <http://ffmpeg-users.933282.n4.nabble.com/file/n4659218/Fm6gV.png>
> but sometimes *depending on video size* i have thumbs like this
> <http://ffmpeg-users.933282.n4.nabble.com/file/n4659218/QRTOl.png>
> Whats the best way to remove this *black space* from thumbs, but need to
> keep thumb size 240x180

crop filter, if you want to remove black pixels, which will change
height of video too.

Nice filter would be to auto detect such black rectangles, and pass
such metadata to crop filter.

More information about the ffmpeg-user mailing list