Skip to content

Instantly share code, notes, and snippets.

@atakane
Last active January 16, 2017 04:19
Show Gist options
  • Save atakane/bcaebef1a1c5dc6ac70cf4445099814d to your computer and use it in GitHub Desktop.
Save atakane/bcaebef1a1c5dc6ac70cf4445099814d to your computer and use it in GitHub Desktop.
Strip audio from MPG video files within a folder. It automatically creates 44.1 kHz, 192 kbps mp3 files for each video file.
#!/bin/sh
# This script strips audio from MPG video files within a folder.
# It automatically creates 44.1 kHz, 192 kbps mp3 files for each video file.
# You need to install "ffmpeg" first.
# To run an "sh" file you have to set it as executable
# atakan$> chmod +x chmod +x stripAudiofromMpg.sh
# after that you can run it in terminal;
# atakan$> ./stripAudiofromMpg.sh
# find each .mpg files in the current folder, pass them to ffmpeg with a set of parameters to produce mp3 files.
for i in *.mpg; do ffmpeg -i "$i" -vn -ar 44100 -ac 2 -ab 192 -f mp3 "$i.mp3"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment