Skip to content

Instantly share code, notes, and snippets.

@ypwu1
Last active March 19, 2021 10:07
Show Gist options
  • Save ypwu1/9495f7d6c0c4132000cc to your computer and use it in GitHub Desktop.
Save ypwu1/9495f7d6c0c4132000cc to your computer and use it in GitHub Desktop.
Bash Script for converting video files by using ffmpeg
#!/bin/bash
#brew install ffmpeg --with-vpx --with-vorbis --with-libvorbis --with-vpx --with-vorbis --with-theora --with-libogg --with-libvorbis --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus --with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame --with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl --with-libopus --with-libschroedinger --with-libspeex --with-libtheora --with-libvo-aacenc --with-libvorbis --with-libvpx --with-libx264 --with-libxvid
#$1 directory $2 input type $3 output type
#ffmpeg -i input.flv -vcodec libvpx -acodec libvorbis output.webm
find "$1" -type f -name "*.$2" | while read -r file; do
filename=$(basename "$file" ".$2")
dirname=$(dirname "$file")
ffmpeg -i "$dirname/$filename.$2" "$dirname/$filename.$3"
done
@ypwu1
Copy link
Author

ypwu1 commented Mar 19, 2021

for mp3 convertion ffmpeg -i input.flac -ab 320k -map_metadata 0 -id3v2_version 3 output.mp3

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