# Download a bunch of files. I manually generated this list of URLs from https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MOD_NDVI_M&year=2020
curl -L -o 2020-01.png https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1784251&cs=rgb&format=PNG&width=3600&height=1800
curl -L -o 2020-02.png https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1785227&cs=rgb&format=PNG&width=3600&height=1800
curl -L -o 2020-03.png https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1786238&cs=rgb&format=PNG&width=3600&height=1800
curl -L -o 2020-04.png https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1787159&cs=rgb&format=PNG&width=3600&height=1800
curl -L -o 2020-05.png https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1794756&cs=rgb&format=PNG&width=3600&height=1800
curl -L -o 2020-06.png https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1795819&cs=rgb&format=PNG&width=3600&height=1800
curl -L -o 2020-07.png https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1796784&cs=rgb&format=PNG&width=3600&height=1800
curl -L -o 2020-08.png https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1797483&cs=rgb&format=PNG&width=3600&height=1800
curl -L -o 2020-09.png https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1799493&cs=rgb&format=PNG&width=3600&height=1800
curl -L -o 2020-10.png https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1800372&cs=rgb&format=PNG&width=3600&height=1800
curl -L -o 2020-11.png https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1800679&cs=rgb&format=PNG&width=3600&height=1800
curl -L -o 2020-12.png https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1801699&cs=rgb&format=PNG&width=3600&height=1800
curl -LO https://neo.sci.gsfc.nasa.gov/palettes/modis_ndvi.png
# Use ImageMagick to add a caption to each image. I cobbled this together from https://legacy.imagemagick.org/Usage/annotating/
for i in $(seq -w 12); do
convert 2020-$i.png -background Black -fill White -pointsize 54 label:"2020-$i Vegetation Index (neo.sci.gsfc.nasa.gov)" -gravity Center -append annot-2020-$i.png;
done
# If you want a nicer font, add `-font '/System/Library/Fonts/Avenir.ttc'` or something like that after the input file name
# Export the full-res video: it's quite small: 3.2 MB (the original PNGs from NASA are ~1 MB)
# I cobbled together this command from e.g., https://hamelot.io/visualization/using-ffmpeg-to-convert-a-set-of-images-into-a-video/
ffmpeg -r 2 -f image2 -i annot-2020-%02d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p full.mp4
# Mastodon is stupid: it won't allow a video bigger than 1280 by 1280 even if it's tiny so resize it down (~350 KB). The "-1" means "pick the height that keeps the aspect ratio".
ffmpeg -r 2 -f image2 -i annot-2020-%02d.png -vf scale=1280:-1 -vcodec libx264 -crf 25 -pix_fmt yuv420p test.mp4

# Do the same for https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MOD15A2_M_LAI&year=2016 (leaf area index)
# See the thread on Mastodon https://octodon.social/@22/106350921621712775 for some details
curl -L https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1700072&cs=rgb&format=PNG&width=3600&height=1800 -o leaf-area-index-2016-01.png
curl -L https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1701939&cs=rgb&format=PNG&width=3600&height=1800 -o leaf-area-index-2016-02.png
curl -L https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1702436&cs=rgb&format=PNG&width=3600&height=1800 -o leaf-area-index-2016-03.png
curl -L https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1703370&cs=rgb&format=PNG&width=3600&height=1800 -o leaf-area-index-2016-04.png
curl -L https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1704432&cs=rgb&format=PNG&width=3600&height=1800 -o leaf-area-index-2016-05.png
curl -L https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1706197&cs=rgb&format=PNG&width=3600&height=1800 -o leaf-area-index-2016-06.png
curl -L https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1706926&cs=rgb&format=PNG&width=3600&height=1800 -o leaf-area-index-2016-07.png
curl -L https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1707790&cs=rgb&format=PNG&width=3600&height=1800 -o leaf-area-index-2016-08.png
curl -L https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1708880&cs=rgb&format=PNG&width=3600&height=1800 -o leaf-area-index-2016-09.png
curl -L https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1709922&cs=rgb&format=PNG&width=3600&height=1800 -o leaf-area-index-2016-10.png
curl -L https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1711015&cs=rgb&format=PNG&width=3600&height=1800 -o leaf-area-index-2016-11.png
curl -L https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si=1712606&cs=rgb&format=PNG&width=3600&height=1800 -o leaf-area-index-2016-12.png
for i in $(seq -w 12); do
convert leaf-area-index-2016-$i.png -background Black -fill White -pointsize 54 label:"2016-$i: Leaf Area Index (neo.sci.gsfc.nasa.gov)" -gravity Center -append annot-leaf-area-index-2016-$i.png;
done
ffmpeg -r 2 -f image2 -i annot-leaf-area-index-2016-%02d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p leaf-area-index-full.mp4
ffmpeg -r 2 -f image2 -i annot-leaf-area-index-2016-%02d.png -vf scale=1280:-1 -vcodec libx264 -crf 25 -pix_fmt yuv420p leaf-area-index-small.mp4
