I'm tring to obtain the format info of a bunch of media files in a directory. The script I have goes through each file, mentions what format its in (if it's a media file) and then exits.
What I really wanted to do was to run a specific command if the output matched a certain value. here's the code I have:
for file in ./* do ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of default=nokey=1:noprint_wrappers=1 "$file" done
Here's a sample output I get when I run it in a folder with 10 files and 1 directory:
vorbis aac opus vorbis mp3 opus mp3 ./file1.txt: Invalid data found when processing input ./Soundcloud: Is a directory mp3 ./media_bash_file.sh: Invalid data found when processing input
Ideally, what I'm trying to do is once the ffprobe command runs I want to go
if ffprobe_output = "vorbis" then run x command ELSE ...
and so on. I've tried what's mentioned in various blog posts about using
at the very start of the batch file but I can't seem to get it to work properly, it usually results in an error like:
"Argument './Mediafile_X' provided as input filename, but './Mediafile_Y' was already specified.
I only have gotten as far as the first snippet of code I made.