Skip to content

Instantly share code, notes, and snippets.

@kingthrillgore
Created October 25, 2015 03:26
Show Gist options
  • Save kingthrillgore/001fe3ba4ba005cd73e7 to your computer and use it in GitHub Desktop.
Save kingthrillgore/001fe3ba4ba005cd73e7 to your computer and use it in GitHub Desktop.
A bash script I wrote to remove audio from dash cam videos. Part of a larger system.
#!/bin/bash
# So I got this dashcam and I run this script to remove audio because the
# camera itself is really badly designed. It does exactly as advertised for
# videos encoded as AVI.
# Usage: Run inside directory with AVI files that need to have audio removed
# ffmpeg is required. Duh.
# Copyright (c) 2015 Cameron Kilgore
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
for i in `ls *.AVI`
do
# Split string
FILESTR=(${i//./ })
# Prep for Rename
NEWFILENAME=${FILESTR[0]}
NEWFILENAME+=$"-noaudio.AVI"
# Actually remove the audio
echo "Stripping audio from $i ..."
echo "new filename is $NEWFILENAME"
ffmpeg -y -i $i -c copy -an $NEWFILENAME
rm $i #I Could add an arg to toggle this...fuck it
done
echo "Process Complete!";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment