#!/linuxSucks/ffmpeg Examples

Nov 20, 2023

Extract audio from a video

ffmpeg -i video.mp4 -b:a 128k -filter:a "volume=1dB" -codec:a libmp3lame audio.mp3

For scripts

mkv to mp3

for f in *.mkv; do 
    ffmpeg -i "$f" -b:a 128k -filter:a "volume=1dB" -codec:a libmp3lame -map 0:1 "${f%mkv}mp3" 
done

mp4 to mp3

for f in *.mp4; do 
    ffmpeg -i "$f" -b:a 128k -filter:a "volume=1dB" -codec:a libmp3lame -map 0:1 "${f%mp4}mp3" 
done

Home  Linux  Notes  Blog Spot