[FFmpeg-user] Getting right color correction for jpeg output

Bjorn Roche bjorn at giphy.com
Wed Mar 7 03:10:51 EET 2018


Hey all,

I'm trying to produce JPEG thumbnails of movies and gifs. I am scaling them
to a particular size, which requires letter boxing them, and I noticed that
the black letterbox I use isn't always black. It works fine when converting
to other formats.

I assume this has something to do with RBG/YUV or YUV Range conversion, but
I'm not fluent in how FFmpeg handles color conversions and haven't found
too much documentation. Here is an example command line I'm using:

ffmpeg -i source.gif -frames 1 -pix_fmt yuvj420p -filter_complex
'[0:v]scale=360:360,pad=width=640:height=360:x=640-trunc(iw*min(360/iw\,360/ih)/4)*2:y=360-trunc(ih*min(640/iw\,360/ih)/4)*2:color=black'
-sws_flags lanczos -y -f singlejpeg out.jpg

I also tried yuv420p which works for mp4.

Thanks for any help!

bjorn

-- 


Bjorn Roche

Sr. Video Pipeline Engineer

bjorn at giphy.com


More information about the ffmpeg-user mailing list