Skip to content

Instantly share code, notes, and snippets.

@ChronoMonochrome
Last active September 9, 2020 17:25
Show Gist options
  • Save ChronoMonochrome/32f674a3651d2ed973c855452b37acc4 to your computer and use it in GitHub Desktop.
Save ChronoMonochrome/32f674a3651d2ed973c855452b37acc4 to your computer and use it in GitHub Desktop.
FFMpeg use case scripts
#1) Recursively convert flac to mp3
find src -type d -print0 | xargs -0 -I file mkdir -p -- dest/file \;
find src -name "*.flac" -exec bash -c 'mp3=$(echo "{}" | sed "s,\.flac,\.mp3,g"); \
ffmpeg -i "{}" -y -acodec libmp3lame -q:a 0 -map_metadata 0 -id3v2_version 3 -write_id3v1 1 dest/"$mp3";' \;
#2) Create a video from a static image
#https://superuser.com/questions/1041816/combine-one-image-one-audio-file-to-make-one-video-using-ffmpeg
ffmpeg -loop 1 -y -r 0.05 -i myimage.jpg -i audio.ogg -shortest -acodec copy -c:v mjpeg -q:v 0 result.mkv
# or
ffmpeg -loop 1 -y -r 1 -i myimage.jpg -i output-audio.ogg -shortest -acodec copy \
-vcodec libvpx -qmin 0 -qmax 50 -crf 10 -b:v 1M result.webm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment