Skip to content

Instantly share code, notes, and snippets.

@gMan1990
Last active February 19, 2021 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gMan1990/a1fe06a6ab57a48a50368174b66b8e34 to your computer and use it in GitHub Desktop.
Save gMan1990/a1fe06a6ab57a48a50368174b66b8e34 to your computer and use it in GitHub Desktop.
ImageMagick
  • ImageMagick v7
    • Here are a list of changes to the ImageMagick commands:

      • magick

        The "magick" command is the new primary command of the Shell API, replacing the old "convert" command. This allows you to create a 'magick script' of the form "#!/path/to/command/magick -script", or pipe options into a command "magick -script -, as abackground process.
      • magick-script

        This the same as "magick", (only command name is different) but which has an implicit "-script" option. This allows you to use it in an "env" style script form. That is a magick script starts with the 'she-bang' line of "#!/usr/bin/env magick-script" allowing the script interpreter to be found anywhere on the users command "PATH". This is required to get around a "one argument she-bang bug" that is common on most UNIX systems (including Linux, but not MacOSX).
      • animate, compare, composite, conjure, convert, display, identify, import, mogrify, montage, stream

        To reduce the footprint of the command-line utilities, these utilities are symbolic links to the magick utility. You can also invoke them from the magick utility, for example, use magick convert logo: logo.png to invoke the convert utility.
    • ImageMagick-x86_64-apple-darwin18.7.0.tar.gz (Mac OS X 10.14.6)

  • ImageMagick v6
@gMan1990
Copy link
Author

gMan1990 commented Dec 19, 2019

# fish shell
for f in *-??/2*.mp4; ffprobe $f; end 2>&1|grep -E 'Input|Duration|Stream'|pbcopy

fd '_._.{11}\.mp4$' inDir -x ffmpeg -i '{}' -stream_loop -1 -i mute.aac -c copy -c:v h264 -vf 'scale= 720:-1, pad= 1080:1080:(ow-iw)/2:(oh-ih)/2:LightGreen' -shortest -y outDir/'{/.}'.ts
fd '_._.{11}\.jpg$' inDir -x magick '{}' -resize 1080x1080 -background LightGreen -gravity center -extent 1080x1080 outDir/'{/}'

ffmpeg -framerate 0.9 -pattern_type glob -i 'outDir/*_?_*.jpg' -f lavfi -i anullsrc -c:v h264 -c:a aac -shortest -y outDir/_out1.ts
#ffmpeg -i begin.mov -f lavfi -i anullsrc -c:v h264 -c:a aac -vf 'scale= 1080:1080:force_original_aspect_ratio=decrease, pad= 1080:1080:(ow-iw)/2:(oh-ih)/2:LightGreen' -shortest -y begin-1080x1080.ts
cp begin-1080x1080.ts outDir/_out2.ts

cat outDir/*_?_*.ts >>outDir/_out2.ts && cat outDir/_out1.ts >>outDir/_out2.ts
ffmpeg -i outDir/_out2.ts -c copy -y outDir/_out2.mp4
magick inDir/(read) -resize 1146x717 -background Black -gravity center -extent 1146x717 outDir/_out3.jpg

@gMan1990
Copy link
Author

# fish shell
fish -c "ffmpeg "(read)" -filter_complex '"(read)"concat= n="(read)":v=1:a=1[ov][oa]' -map '[ov]' -map '[oa]' -c:a aac -c:v h264 -y out/output.mp4"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment