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.

Revisions

  1. amake revised this gist Dec 20, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ heic := $(wildcard *.HEIC)
    jpg := $(heic:.HEIC=.jpg)

    .PHONY:
    all: forward-back.mp4
    all: silent-pingpong.mp4 with-audio-pingpong.mp4

    silent.mp4: $(jpg)
    # ffmpeg video filter -vf
    @@ -17,7 +17,7 @@ silent.mp4: $(jpg)
    with-audio.mp4: silent.mp4 audio.m4a
    ffmpeg -i $< -i $(word 2,$^) -c copy -map 0:v:0 -map 1:a:0 -shortest $@

    forward-back.mp4: with-audio.mp4 with-audio-reversed.mp4
    %-pingpong.mp4: %.mp4 %-reversed.mp4
    ffmpeg -f concat -safe 0 -i <(printf "file '%s'\n" $(addprefix $(PWD)/,$^)) -c copy $@

    %.jpg: %.HEIC
  2. amake revised this gist Dec 20, 2019. 1 changed file with 14 additions and 7 deletions.
    21 changes: 14 additions & 7 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -1,25 +1,32 @@
    SHELL := /bin/bash

    # 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
    all: forward-back.mp4

    silent.mp4: $(jpg)
    ffmpeg -framerate 10 -pattern_type glob -i '*.jpg' -vf $(vf) $@
    # ffmpeg video filter -vf
    # - assumes vertical photos
    # - resizes to iPhone XS max video resolution
    ffmpeg -framerate 10 -pattern_type glob -i '*.jpg' -vf 'transpose=1,scale=1920:-1' $@

    with-audio.mp4: silent.mp4 audio.m4a
    ffmpeg -i $< -i $(word 2,$^) -c copy -map 0:v:0 -map 1:a:0 -shortest $@

    forward-back.mp4: with-audio.mp4 with-audio-reversed.mp4
    ffmpeg -f concat -safe 0 -i <(printf "file '%s'\n" $(addprefix $(PWD)/,$^)) -c copy $@

    %.jpg: %.HEIC
    heif-convert $< $@

    %-reversed.mp4: %.mp4
    ffmpeg -i $< -vf reverse -af areverse $@


    .PHONY: clean
    clean:
    rm *.jpg *.mp4
  3. amake revised this gist Dec 20, 2019. 1 changed file with 13 additions and 2 deletions.
    15 changes: 13 additions & 2 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,25 @@
    # 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 'transpose=1,scale=1920:-1' $@
    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
    heic-convert $< $@
    heif-convert $< $@

    .PHONY: clean
    clean:
    rm *.jpg *.mp4
  4. amake created this gist Dec 19, 2019.
    14 changes: 14 additions & 0 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    heic := $(wildcard *.HEIC)
    jpg := $(heic:.HEIC=.jpg)

    .PHONY:
    all: with-audio.mp4

    silent.mp4: $(jpg)
    ffmpeg -framerate 10 -pattern_type glob -i '*.jpg' -vf 'transpose=1,scale=1920:-1' $@

    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
    heic-convert $< $@