[FFmpeg-user] ffmpeg problem with creating thumbnail

Tim Nicholson nichot20 at yahoo.com
Fri May 24 16:46:04 CEST 2013


On 23/05/13 22:33, Paul B Mahol wrote:
> 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.

cropdetect will give you parsable output you can use in a second pass..

> _______________________________________________
> [...]


-- 
Tim


More information about the ffmpeg-user mailing list