FFMPEG Improperly Switching to Grayscale

I use ffmpeg to make timelapse movies of images taken from one of my several webcams.  Recently, I started having trouble with it converting all the frames of my video to gray scale.  I’m am unsure if a software upgrade or a script change caused it, but I had a heck of a time tracking it down.

This is the gist of what the message ffmpeg was giving me: “Input stream #0.0 frame changed from size:” … “fmt:gray”. There are virtually no resources out there that mention that exact phrase, but after scouring the web for a few weeks off and on, I finally found a website mentioning a similar experience and it had a solution. To solve the problem, use ImageMagick’s convert utility with “-type TrueColor” in the options list. The example below is in my timelapse bash script. This will stamp the date and time onto the top of the image and save it into my temporary directory.


convert $FILE -bordercolor Black -border 20x20 -gravity north -crop 640x500+0+0\! -gravity NorthWest -font /usr/share/fonts/truetype/freefont/FreeMonoBold.ttf -pointsize 16 -type TrueColor -fill white -annotate +10+0 "$TIMESTAMP" $TEMPDIR/$(basename $FILE)

As I mentioned earlier, I found the hint at the solution I needed here: Source.

Posted by Chad Dotson

A small town Computer Scientist / Software Engineer. Chad enjoys writing Python and JavaScript as well as tinkering with his Raspberry Pi and Arduino. When not programming, he enjoys Photography (especially lightning) and Sci-Fi.

Leave a Reply