“Extinction is the rule. Survival is the exception.” – Carl Sagan

DRAFT UPDATED 6/8/2020 This page is Work In Progress- I am posting the scripting I use for compositing, cropping, and animating GOES received imagery using ImageMagick and FFMPEG.

GOES provides a lot of imagery!

The ABI can multitask. The default scan mode concurrently takes a full disk image every 10 minutes, an image of the contiguous U.S. every 5 minutes, and two smaller, more detailed images of areas where storm activity is present, every 60 seconds (or one every 30
seconds). Alternatively, ABI can run in full-disk mode, continuously imaging the full disk every 5 minutes.

ABI Scan Mode Demonstration

Now, with the ABI imagery capabilities listed, why is that on HRIT, we do not get those cool 10-minute full disk scans, but only get them every thirty minutes? The answer is bandwidth. There is a limited amount of data that can be sent, so we, who receive the HRIT and not GRB get a bit downgraded timing and imagery.

So we get all these cool images, but how to stitch them together into some semblance of animation? The first, and easiest way is through GIF animation. Take a bunch of timed pictures, assemble them together frame by frame and use a gif animator to make a “moving’ image. There are many online gif animation sites that are quite good like https://gifmaker.org/ or https://gifmaker.me/ But, because the images we get are 15 to 30 minutes apart. they can appear jerky or stuttered. (Imagine watching Star Wars at 1 frame every 30 minutes instead of one frame every 24 seconds!).

So here is an example of a full disk compiled into a gif animation, nice, but still kind of jerky. After all, each “snapshot” of the planet is taken every 30 minutes.

Gif animation of Earth

So how do we try and smooth this out? This is where magic comes in, in the form of ImageMagick and FFMPEG software. Below is an example of a gif animation turned into a smooth-flowing mp4 movie using a combination of Imagemagick and FFMPEG Scripting. The first script compiles all the frames, and then layers channel 15 over the full-color earth. The second script, using FFMEG, then takes the compiled gif animation and using a video filter called minterpolate, which performs motion interpolation. It’s a tool that can: Increase a video’s frame rate by rendering new frames based on motion (pixel-warping + blending). Make smooth motion videos (simple blending between frames) between the frames So basically it is filling in the 30-minute gap in full-disk imagery.

So, what’s the secret sauce that creates this magic?

I Use ImageMagick and FFMPEG on my Windows 10 Machines. What this does is allows me to write Batch Files (example.BAT) that I can run by double-clicking the chosen script in my “MagickScripts” Folder.

Since I do a lot of different types of animation, I divided my folder structure into many types of animations, such as F:/Fulldiskfile, F:/Conusfile, F:/CMIPFILE , etc. Under each one of these, I have subfolders where the program stores the temporary files used in creating the animations. As an example, one full disk animation with one or two overlays of ABI Band imagery might contain 4,500 separate images depending on the length of the capture!


So here is one example of a ‘simple’ Full Disk animation, that does the following:

  1. Reduces the file size while maintaining the best balance of color and sharpness.
  2. Reduces the image size from an as-received image of 5424×5424 (that’s 75 inches wide and tall!) to 2000×2000 pixels
  3. It gives me the option to manually delete night time images (I did this for the animations that DO NOT have any layering of other bands).
  4. Adds my watermark (branding) to my image.
  5. Creates a GIF of all the reformatted images
  6. Then creates an Mp4 with interpolation of the frames.
  7. Then it deletes the temp files.
REM  FULL DISK ANIMATION

REM STEP #1 AND #2 - REDUCE FILESIZE
for /r "F:\Satellite Imagery\goes16\fd\NOMAP\" %%a in (*.jpg) do "C:\Program Files\ImageMagick-7.0.9-Q16\magick.exe" mogrify -path "F:\FULLDISKFILE\FULLDISK\AUTORESIZE" -filter Triangle -define filter:support=2 -thumbnail 2000 -unsharp 0.25x0.25+8+0.065 -dither None -posterize 136 -quality 82 -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace none -colorspace sRGB -strip "%%~a"

REM STEP #3 OPTION TO DELETE NIGHT TIME IMAGERY
ECHO Manually delete night imagery in /FULLDISKFILE/FULLDISK/AUTORESIZE/?
PAUSE

REM STEP #4 ADD WATERMARK TO REDUCED FULL DISK IMAGE
magick mogrify -path "F:/FULLDISKFILE/FULLDISK/FDWATERMARKED/" -format jpg -gravity northwest -draw "image over 30,30 0,0 'F:/Satellite Imagery/GOESFULLDISKWHITE500x100.png'" "F:/FULLDISKFILE/FULLDISK/AUTORESIZE/*.jpg"

REM STEP #5 CREATE GIF
magick convert -loop 0 -delay 20 "F:\FULLDISKFILE\FULLDISK\FDWATERMARKED\GOES16_*.jpg" "F:/FULLDISKFILE/FULLDISK/FULLDISKFINAL/NOMAPout.gif"

REM STEP #6 CREATE MP4
ffmpeg -i "F:/FULLDISKFILE/FULLDISK/FULLDISKFINAL/NOMAPout.gif" -filter "minterpolate='mi_mode=blend'" -c:v libx264 -pix_fmt yuv420p "F:/FULLDISKFILE/FULLDISK/FULLDISKFINAL/NOMAPGOES.mp4"

REM STEP #7 DELETE TEMPORARY FILES
del "F:\FULLDISKFILE\FULLDISK\AUTORESIZE*." /s /f /q 
del "F:\FULLDISKFILE\FULLDISK\FDWATERMARKED*." /s /f /q
echo Your file is finished

NOTE: My file structure will obviously be different than your own! And also note that because this bat file is calling out ImageMagick and FFMPEG to run, you will see some commands in quotes “” and also note the difference in file structuring with the “/” vs. the “\” signs. They make a huge difference and need to be correct! Also take note that in steps 1 and 2 above I am using a Recursive For Loop to loop through the directories where necessary to modify every image inside every dated folder.

Imagine the for loop is being put “on pause” while the function (in this case reducing file size and reducing pixel size) call is running .

The new recursive call starts its for loop and again, pauses while calling the functions again, and so on, until every sib directory and file has been modified.

Once you have the basics down, lines of this code can be used in multiple scripts, I have 19 and counting! One for CONUS, one for Compositing, one for fulldisk, one for Meso, etc.

This bit of code I use in many of my scripts, its the one that does the file size reduction and pixel size reduction. My File size reducer and optimizer script )Note the OUTPUT_PATH, OUTPUT_WIDTH, and INPUT_PATH) :

REM FILE SIZE REDUCTION
mogrify -path OUTPUT_PATH -filter Triangle -define filter:support=2 -thumbnail OUTPUT_WIDTH -unsharp 0.25x0.25+8+0.065 -dither None -posterize 136 -quality 82 -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace none -colorspace sRGB -strip INPUT_PATH

Here are the two other lines of code that take the images and first create the GIF, then the MP4:

REM  CREATE GIF
magick convert -loop 0 -delay 20 "F:/INPUT_FILE_DIRECTORY_AND_FILENAME*.jpg" "F:/OUTPUT_FILE_DIRECTORY_AND_FILENAME/FILENAME_OF_GIF.gif"

REM  CREATE MP4
ffmpeg -i "F:/INPUT_FILE_DIRECTORY_AND_/FILENAME_OF_GIF.gif" -filter "minterpolate='mi_mode=blend'" -c:v libx264 -pix_fmt yuv420p "F:/OUTPUT_FILE_DIRECTORY_AND_FILENAME/FILENAME_OF_MP4.mp4/"