I have many folders with .mp4 files. I wrote a script that takes the mp4 files and converts them into 1 jpeg image per frame. Critically, the output of this script (retained file name, with _frame number appended to the end) goes into a newly created folder with the file basename:
#!/bin/bash
for f in *.mp4; do mkdir -p "${f%.*}" && ffmpeg -i ${f} -start_number 000 "${f%.*}/${f}_%03d.jpg"; done
I can run this for every parent folder one at a time no problem but I would like to just run it once and get it to run recursively.
I changed the code to:
#!/bin/bash
for f in *.mp4/; do mkdir -p "${f%.*}" && ffmpeg -i ${f} -start_number 000 "${f%.*}/${f}_%03d.jpg"; done
and tried playing with the mkdir part (by adding ./) but no matter what I do, I get the following error.
mkdir: cannot create directory ‘*’: Invalid argument
Is there anything I need to do to allow mkdir to create the appropriate new folders in their respective subfolders?
The file structure is as follows:
parent folder
└── videos_1
├── videos_1_basename_1.mp4
└── videos_2_basename_2.mp4
└── videos_2
├── videos_2_basename_1.mp4
└── videos_2_basename_2.mp4
.sh script