So I am trying to write a script in bash which will add the relative path to the beginning of each line of the concat_files.txt and then I want to concatenate all files and put the output file in the same directory defined in the path variable. So far, the sed command is working fine, I just need to find out how I can insert the path in front of the output file. The easiest way is by concatenating them in the current directory and then moving the output file to the path variable, but I don't have enough place in my current directory, so this is not an option.
#!/bin/bash
# Script that concatenates all the files defined in concat_files.txt
path=/mnt/disk/video_evaluation/XDROOT/Clip/
sed -i "s@^@file '$path@" concat_files.txt
sed -i "s/$/'/" concat_files.txt
ffmpeg -f concat -i concat_files.txt -c copy $path/output.mxf
And maybe another improvement to the script would be if I can select all files with some specific extension and put them in the file. But I am not sure how I can do that either...
sed
here, both because the-i
flag is non-portable and because it will prevent running your script twice on the same input.