Skip to content

Instantly share code, notes, and snippets.

@amake
Last active February 8, 2022 13:12
Show Gist options
  • Select an option

  • Save amake/d2da4e45cf372a2850f6296bb8433860 to your computer and use it in GitHub Desktop.

Select an option

Save amake/d2da4e45cf372a2850f6296bb8433860 to your computer and use it in GitHub Desktop.
Convert HEIC images to MP4 video
# Requires ffmpeg, libheif
heic := $(wildcard *.HEIC)
jpg := $(heic:.HEIC=.jpg)
# ffmpeg video filter
# - assumes vertical photos
# - resizes to iPhone XS max video resolution
vf := 'transpose=1,scale=1920:-1'
.PHONY:
all: with-audio.mp4
silent.mp4: $(jpg)
ffmpeg -framerate 10 -pattern_type glob -i '*.jpg' -vf $(vf) $@
with-audio.mp4: silent.mp4 audio.m4a
ffmpeg -i $< -i $(word 2,$^) -c copy -map 0:v:0 -map 1:a:0 -shortest $@
%.jpg: %.HEIC
heif-convert $< $@
.PHONY: clean
clean:
rm *.jpg *.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment