make the same command with not certain files listed in command, but with all files that…
- User
make the same command with not certain files listed in command, but with all files that are larger than 400kb in current folder ffmpeg -i “concat:0.ts|1.ts|2.ts|3.ts|5.ts|6.ts|7.ts|8.ts” -c copy output.mp4
- Assistant
ffmpeg -i "concat://')" -c copy output.mp4
Explanation:
find . -maxdepth 1 -type f -size +400k -name '*.ts'searches the current directory (.) without going into subdirectories (-maxdepth 1) for regular files (-type f) that are larger than 400kb (-size +400k) and have a.tsfile extension (-name '*.ts')-printf '%f\\|'prints only the file names followed by a pipe symbol (|) and escapes it with a backslash to avoid interpretation by the shellsed 's/\\|$//'removes the last pipe symbol from the list of file names- The resulting list of file names is substituted in place of
0.ts|1.ts|2.ts|3.ts|5.ts|6.ts|7.ts|8.tsin the original command using command substitution$().
- User
/Applications/ffmpeg -i "concat:(find /Downloads/film/* -type f -size +990k -print | tr '\n' '|')" -c copy output.mp4 produces error: concat:(find /Downloads/film/ -type f -size +990k -print | tr '\n' '|'): No such file or directory
- Assistant
The error is most likely because the shell is treating
findandtras literal strings instead of commands to be executed. You can use command substitution$()to execute the commands and substitute the output into the ffmpeg command.Try this updated command instead:
/Applications/ffmpeg -i "concat:$(find /Downloads/film/ -type f -size +990k -print0 | tr '\0' '|')" -c copy output.mp4This command should find all regular files in the
/Downloads/film/directory (and its subdirectories) that are larger than 990kb. The-print0option is used to separate the file names with null characters instead of newlines, which is safer for handling file names with special characters or spaces. Thetr '\0' '|'command replaces null characters with pipe symbols.The resulting list of file names is substituted in place of
concat:in the ffmpeg command using command substitution$(...).