1

I want to convert my entire music library (in the current folder, I'd like to convert the subfolders too) to Opus using FFmpeg. The converted files should go to a folder in ~/Desktop/Opus and keep their hierarchy. I wrote the following command:

find . -name "*.mp3" -exec ffmpeg -i "./{}" "~/Desktop/Opus/{}.opus" \;

The problem is that it doesn't work. It seems to have problems parsing the embedded FFmpeg command, as it shows errors like this one for every file:

ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
configuration: --prefix=/Users/Famille_Pintado/brew/Cellar/ffmpeg/4.0 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libcaca --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
libavutil      56. 14.100 / 56. 14.100
libavcodec     58. 18.100 / 58. 18.100
libavformat    58. 12.100 / 58. 12.100
libavdevice    58.  3.100 / 58.  3.100
libavfilter     7. 16.100 /  7. 16.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  1.100 /  5.  1.100
libswresample   3.  1.100 /  3.  1.100
libpostproc    55.  1.100 / 55.  1.100
[mp3 @ 0x7fa947802600] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from '././690885_Zaphkiel.mp3':
Metadata:
TBPM            : 128
encoded_by      : LAME in FL Studio 12
date            : 2016
Duration: 00:04:48.34, start: 0.000000, bitrate: 160 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 160 kb/s
~/Desktop/Opus/./690885_Zaphkiel.mp3.opus: No such file or directory

What am I doing wrong?

1

find [...] -exec will use the (relative) path to the found files. If you want to use -exec with the assumption that the found file is in the current directory, you want to instead use -execdir.

  • If it uses the relative path, it kinda makes the assumption that the found file is in the current directory, no? It didn't seem to change anything to the output. Any other ideas? – Spooikypok_Dev May 16 '18 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.