Skip to content

Instantly share code, notes, and snippets.

@bartjakobs
Last active September 3, 2024 14:06
Show Gist options
  • Save bartjakobs/262d8735ab3c9e2bf62ae0d76d95a632 to your computer and use it in GitHub Desktop.
Save bartjakobs/262d8735ab3c9e2bf62ae0d76d95a632 to your computer and use it in GitHub Desktop.
Media converters

Command line media converters

Simple audio / video converters for MacOS / Linux. Put in /usr/local/bin or any directory in your $PATH and chmod +x. Make sure ffmpeg and imagemagick are installed

Download FFMPEG binaries here: https://evermeet.cx/ffmpeg/

#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: $0 <framerate> <pattern>"
echo "Example: $0 30 \"*.png\""
exit 1
fi
ffmpeg -framerate $1 -pattern_type glob -i "$2" -c:v libx264 -pix_fmt yuv420p out.mp4
#!/bin/bash
ffmpeg -i "$1" -vf scale=640:-1 -r 10 -f image2pipe -vcodec ppm - | convert -delay 5 -loop 0 - "$1.gif"
#!/bin/bash
ffmpeg -i "$1" "$1.mp3"
#!/bin/bash
ffmpeg -i "$1" -vcodec h264 -profile:v main -level 4.0 "$1.mp4"
#!/bin/bash
ffmpeg -i "$1" -c:v libvpx -b:v 1M -c:a libvorbis "$1.webm"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment