Converting video from H.264 or H.265 to a supported codec is only necessary on the non-Studio version (aka free version) of Resolve under Linux.
To save a little space at least, instead of pcm_s16le for audio, you can use alac (Apple Lossless Audio Codec) which will be smaller with zero loss of quality.
Most likely this is because you are trying to use $i from your old for loop. Try replacing $i with {}. You also need \; at the end. Basically, {} is replaced with the file from find and \; tells find where the end of the command is.
Also, that bash substitution you are using won’t work with find results easily. You will need to do that a different way.
That is because this is a partial command so you are missing some of the arguments to ffmpeg
Prompt: How do I run a script recursively on files inside folders inside folders inside another folder?
Response: Let’s break down how to run a script recursively on files within nested folders.
Understanding the Problem:
You want your script to process all files, regardless of their location within a complex folder structure. This is where recursion comes in handy! It allows your script to “dive” into subfolders and handle each file individually.
The Solution: Using find with -maxdepth (and optionally xargs)
Here’s how you can achieve this using the powerful combination of find, -maxdepth, and potentially xargs:
Find Files:
find . -type f -print0 | xargs -I {} sh -c 'echo "Processing file: {}".'
Explanation
find . -type f: This searches for files (not directories) within the current directory (.).
-print0: Prints each found file separated by a null character, which helps handle filenames with spaces or special characters.
xargs -I {} sh -c 'echo "Processing file: {}".': This pipes the output of find to xargs, which then passes each filename ({}) as an argument to the command sh -c. The -c option tells sh to execute a shell command. In this case, it prints a message indicating that the file is being processed.
Example:
Let’s say you have these files in your structure:
The command above would find all the text files and print a message for each one, regardless of their location within your project’s structure.
Key Points:
Flexibility: This approach is highly flexible as you can easily modify the script to perform any desired action on the found files (e.g., processing them with Python).
Recursion: The find command recursively searches through all subdirectories, ensuring that every file within your nested folder structure is processed.
Additional Tips:
You might want to use a more specific pattern in your find command if you have files of different types or need to exclude certain files from processing.
Error Handling: You can incorporate error handling (e.g., using if) within the script’s execution to handle unexpected situations, such as file not found errors.
[in#0 @ 0x5d0da9fafe80] Error opening input: No such file or directory
Error opening input file *.mp4.
Error opening input files: No such file or directory
I appreciate this very much, but sadly it’s of little use to me. I’m finding it very hard to understand a lot of the concepts in there. So much so that I wouldnt even know where to start with this.
I’m sorry, but this was wasted on me, I’m not nearly knowledgable enough to take this information and actually apply it.
Roughly how many different directories of videos do you think you’ll need to convert? I can suggest a simpler, and perhaps safer (see below) command on a per directory basis.
This will convert all MP4’s in the current directory, to MOV, re-encoding them in codecs support be Resolve free.
I want to caution, that converting from H.264 / H.265 to a intermediate codec like dnxhd (or Cineform for argument sake), is going to produce massively bigger files.
It’s not something I would readily do to say hundreds of videos at once, unless I knew I had oodles of storage space and a lot of time spare to run the conversion.
There’s a main directory, containing two sub-folders, where each have 8 subfolders of their own, some of which, in turn, have their own subfolder, which contains the actual .mp4 files.
This command just gives me a > and a blinking cursor. Then nothing happens.
Now regarding this,
I am aware of that and it’s fine. We’re talking about files that are really small, some of which are not even a second long. This is a sample pack of all sorts of overlays and transitions. Namely this.