Convert mp4 to mp3 with ffmpeg

0

I want to convert a whole folder of mp4 files to mp3. But I have no idea how to do that? But I want to keep the thumbnail. Can anyone help me?

user-Dxl938Qqjd

Posted 2019-07-24T22:18:10.387

Reputation: 1

1Sure! Please click on [edit] and post the code you've tried so far which did not work. Please use [edit] and not Add Comment. – K7AAY – 2019-07-24T23:26:19.623

This breaks down into setting up a loop (for Linux:) https://www.shellscript.sh/loops.html which, for each MP4 file, will A) extract the thumbnail https://superuser.com/questions/538112/meaningful-thumbnails-for-a-video-using-ffmpeg B) extract the audio into an MP3 https://mutsinzi.com/alternative-to-pacpl-mp4-to-mp3-converter/ and C) add the thumbnail into the MP3.https://stackoverflow.com/questions/18710992/how-to-add-album-art-with-ffmpeg

– K7AAY – 2019-07-24T23:53:49.690

What is your OS? – llogan – 2019-07-25T18:02:31.020

Answers

0

You don't need to do this in three steps:

ffmpeg -vn -sn -dn -i input.mp4 -codec:a libmp3lame -qscale:a 4 output.mp3

This creates a MP3 file with a VBR (variable bit rate) of 165. Check here for more options.

Arguments (beware, the order matters!):

  • -vn disables all video-streams from the input
  • -sn disables all subtitle-streams from the input
  • -dn disables all data-streams from the input
  • -i specifies the input file
  • -codec:a libmp3lame specifies the encoder
  • -qscale:a 4 specifies the quality target for libmp3lame
  • The last argument is the output-file. Note that the file-extension might be used to infer additional information.

Lukas Knuth

Posted 2019-07-24T22:18:10.387

Reputation: 195