#!/bin/sh SELF="$( basename "$0" )" help() { cat <<EOF Usage: $0 file [file ...] Remove video from combined video/audio files. Each file will be replaced with an audio-only copy, with the original filename. The original file will be renamed to end in .bak. $0 foo.mp4 bar.mp4 ...will create audio-only foo.mp4 and bar.mp4 files, and the original files will be kept as foo.mp4.bak and bar.mp4.bak Note that the output file will be of the same type as the input file. This script does NOT convert the audio to a .wav or whatever, so you end up with e.g. an .avi file with only audio (no video). This is most useful for .flac files, which include a single frame of video (a still image). EOF } if [ "$1" = "" -o "$1" = "--help" ]; then help exit 0 fi for file in "$@"; do ext="$( echo "$file" | sed 's,.*\.,,' )" tmp="$$.$ext" ffmpeg -i "$file" -acodec copy -vn "$tmp" mv "$file" "$file.bak" mv "$tmp" "$file" done