Reputation: 343
I would like to combine the two following commands to find mp4 files and convert them to mp3 and save them with same name. The two command line:
find ./ -name '*.mp4'
ffmpeg -i video.mp4 -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 audio.mp3
Upvotes: 6
Views: 6909
Reputation: 1
To just use the name without the extension add first -exec sed -E s/.mp4$//g
followed by your ffmpeg
command.
Upvotes: 0
Reputation: 9282
With find
's -exec
functionality:
find ./ -name '*.mp4' -exec bash -c 'ffmpeg -i $0 -vn -acodec libmp3lame -ac 2 \
-ab 160k -ar 48000 ${0/mp4/mp3}' {} \;
This should make xyz.mp4
to xyz.mp3
.
Upvotes: 12