diff options
author | B. Watson <yalhcru@gmail.com> | 2018-08-01 16:42:03 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2018-08-01 16:42:03 -0400 |
commit | a8848d466f5aead07cb8d848e228f00b26697ef0 (patch) | |
tree | 37e29a8eaa468d50b0345e59ef103d42d49f06ed | |
parent | b8400d5fddf0e1faa6b88975166f7d057e79a53a (diff) | |
download | misc-scripts-a8848d466f5aead07cb8d848e228f00b26697ef0.tar.gz |
ffmpeg-rm-video: support multiple input files
-rwxr-xr-x | ffmpeg-rm-video | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/ffmpeg-rm-video b/ffmpeg-rm-video index fde2cc6..f49d1d4 100755 --- a/ffmpeg-rm-video +++ b/ffmpeg-rm-video @@ -1,3 +1,38 @@ #!/bin/sh -ffmpeg -i "$1" -acodec copy -vn "$2" +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 |