Convert audio files to mp3 using ffmpeg

后端 未结 11 2006
太阳男子
太阳男子 2020-12-22 15:09

I need to convert audio files to mp3 using ffmpeg.

When I write the command as ffmpeg -i audio.ogg -acodec mp3 newfile.mp3, I get the error:

<         


        
相关标签:
11条回答
  • 2020-12-22 15:13

    Try FFmpeg Static Build Link

    Documentation: https://www.johnvansickle.com/ffmpeg/

    Host the static build on your server in same directory

    $ffmpeg = dirname(__FILE__).'/ffmpeg';
    
    $command = $ffmpeg.'ffmpeg -i audio.ogg -acodec libmp3lame audio.mp3';
    
    shell_exec($command);
    
    0 讨论(0)
  • 2020-12-22 15:14

    I had to purge my ffmpeg and then install another one from a ppa:

    sudo apt-get purge ffmpeg
    sudo apt-add-repository -y ppa:jon-severinsson/ffmpeg 
    sudo apt-get update 
    sudo apt-get install ffmpeg
    

    Then convert:

     ffmpeg -i audio.ogg -f mp3 newfile.mp3
    
    0 讨论(0)
  • 2020-12-22 15:19

    1) wav to mp3

    ffmpeg -i audio.wav -acodec libmp3lame audio.mp3
    

    2) ogg to mp3

    ffmpeg -i audio.ogg -acodec libmp3lame audio.mp3
    

    3) ac3 to mp3

    ffmpeg -i audio.ac3 -acodec libmp3lame audio.mp3
    

    4) aac to mp3

    ffmpeg -i audio.aac -acodec libmp3lame audio.mp3
    
    0 讨论(0)
  • 2020-12-22 15:22

    For batch processing with files in folder aiming for 190 VBR and file extension = .mp3 instead of .ac3.mp3 you can use the following code

    Change .ac3 to whatever the source audio format is.

    ffmpeg mp3 settings

    for f in *.ac3 ; do ffmpeg -i "$f" -acodec libmp3lame -q:a 2 "${f%.*}.mp3"; done
    
    0 讨论(0)
  • 2020-12-22 15:22

    For batch processing files in folder:

    for i in *.wav; do ffmpeg -i "$i" -f mp3 "${i%}.mp3"; done
    

    This script converts all "wav" files in folder to mp3 files and adds mp3 extension

    ffmpeg have to be installed. (See other answers)

    0 讨论(0)
  • 2020-12-22 15:25

    High quality for Mac OS works perfectly!

    ffmpeg -i input.wma -q:a 0 output.mp3

    0 讨论(0)
提交回复
热议问题