There are .mp4 files that I want to convert.
$ find . -name '*.mp4' ./01.mp4 ./02.mp4 ./03.mp4
I was expecting to issue copy-01.mp4 , copy-02.mp4 and copy-03.mp4 with this command.
find . -name '*.mp4' -exec ffmpeg -i {} -c copy -aspect 16:9 copy-{} ";"
But this failed with errors Unable to find a suitable output format for 'copy-' . I thought {} represents the file name, right?
How to use original file names when using the -exec find option?
find version:
$ find --version find (GNU findutils) 4.4.2 Copyright (C) 2007 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Eric B. Decker, James Youngman, and Kevin Dalley. Built using GNU gnulib version e5573b1bad88bfabcda181b9e0125fb0c52b7d3b Features enabled: O_NOFOLLOW(disabled) LEAF_OPTIMISATION FTS() CBO(level=0)
This is the xargs version.
xargs --version xargs (GNU findutils) 4.4.2 Copyright (C) 2007 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Eric B. Decker, James Youngman, and Kevin Dalley. Built using GNU gnulib version e5573b1bad88bfabcda181b9e0125fb0c52b7d3b
Ffmpeg result
$ find * -type f -name '*.mp4' -exec ffmpeg -i {} -c copy -aspect 16:9 copy-{} ";"
source share