I've looked at this post and this post among a few others. They provided some information as to how to get started, unfortunately my use case is slightly more complex.
I have pairs of video files that I run ffmpeg commands on. The command I run transfers metadata from the original files to the converted files and looks as follows:
christian$ ffmpeg -i file_1.mov -i file_1.mp4 -map 1 -map_metadata 0 -c copy file_1_fixed.mp4
This post explains what the command does, should an explanation be required. Basically the use case is that both the original file and the converted file have the same name, but different extensions. How would I go about writing a shell script that finds all such pairs in a directory and composes and runs the command specified above for each pair?
I assume, from a logical point of view that I would need to loop through all the pairs, get the file names, do some sort of string manipulation (if this is even possible with shell scripting) compose the command and run it.
Any resources you could point me towards would be deeply appreciated. Just to clarify, some pseudo code:
for (file in directory) {
string name = file.getname
string command = "ffmpeg -i " + name + ".mov -i " + name + ".mp4 -map 1
-map_metadata 0 -c copy " + name + "_fixed.mp4"
run(command)
}
Hope this makes sense, please let me know if I should clarify more. Thank you for reading.