Batch convert (decode) audio into multiple formats with ffmpeg

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have a directory with a bunch of CD quality (16bit 44100Hz) wave-files.



How can I batch decode those into different formats (lets say FLAC, OGG and MP3) using ffmpeg?




Update: here are the commands one by one as suggested by @StephenHarris



ffmpeg -i input.wav output.ogg
ffmpeg -i input.wav output.mp3
ffmpeg -i input.wav output.flac









share|improve this question



















  • 2




    Take it step by step. How would you convert one file? If you can work out how to convert one wav file into flac, into ogg, into mp3 (3 separate commands) then we can add a loop around it. So "what command would you use to convert wav to flac?" "what command would convert wav to ogg?" "What command would convert wav to mp3?"
    – Stephen Harris
    Dec 10 at 0:56






  • 1




    @StephenHarris, thanks, just working it out :-)
    – nath
    Dec 10 at 0:58






  • 1




    @StephenHarris done :-)))
    – nath
    Dec 10 at 1:37














up vote
1
down vote

favorite












I have a directory with a bunch of CD quality (16bit 44100Hz) wave-files.



How can I batch decode those into different formats (lets say FLAC, OGG and MP3) using ffmpeg?




Update: here are the commands one by one as suggested by @StephenHarris



ffmpeg -i input.wav output.ogg
ffmpeg -i input.wav output.mp3
ffmpeg -i input.wav output.flac









share|improve this question



















  • 2




    Take it step by step. How would you convert one file? If you can work out how to convert one wav file into flac, into ogg, into mp3 (3 separate commands) then we can add a loop around it. So "what command would you use to convert wav to flac?" "what command would convert wav to ogg?" "What command would convert wav to mp3?"
    – Stephen Harris
    Dec 10 at 0:56






  • 1




    @StephenHarris, thanks, just working it out :-)
    – nath
    Dec 10 at 0:58






  • 1




    @StephenHarris done :-)))
    – nath
    Dec 10 at 1:37












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have a directory with a bunch of CD quality (16bit 44100Hz) wave-files.



How can I batch decode those into different formats (lets say FLAC, OGG and MP3) using ffmpeg?




Update: here are the commands one by one as suggested by @StephenHarris



ffmpeg -i input.wav output.ogg
ffmpeg -i input.wav output.mp3
ffmpeg -i input.wav output.flac









share|improve this question















I have a directory with a bunch of CD quality (16bit 44100Hz) wave-files.



How can I batch decode those into different formats (lets say FLAC, OGG and MP3) using ffmpeg?




Update: here are the commands one by one as suggested by @StephenHarris



ffmpeg -i input.wav output.ogg
ffmpeg -i input.wav output.mp3
ffmpeg -i input.wav output.flac






audio ffmpeg mp3 flac ogg






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 10 at 4:42

























asked Dec 10 at 0:20









nath

814424




814424







  • 2




    Take it step by step. How would you convert one file? If you can work out how to convert one wav file into flac, into ogg, into mp3 (3 separate commands) then we can add a loop around it. So "what command would you use to convert wav to flac?" "what command would convert wav to ogg?" "What command would convert wav to mp3?"
    – Stephen Harris
    Dec 10 at 0:56






  • 1




    @StephenHarris, thanks, just working it out :-)
    – nath
    Dec 10 at 0:58






  • 1




    @StephenHarris done :-)))
    – nath
    Dec 10 at 1:37












  • 2




    Take it step by step. How would you convert one file? If you can work out how to convert one wav file into flac, into ogg, into mp3 (3 separate commands) then we can add a loop around it. So "what command would you use to convert wav to flac?" "what command would convert wav to ogg?" "What command would convert wav to mp3?"
    – Stephen Harris
    Dec 10 at 0:56






  • 1




    @StephenHarris, thanks, just working it out :-)
    – nath
    Dec 10 at 0:58






  • 1




    @StephenHarris done :-)))
    – nath
    Dec 10 at 1:37







2




2




Take it step by step. How would you convert one file? If you can work out how to convert one wav file into flac, into ogg, into mp3 (3 separate commands) then we can add a loop around it. So "what command would you use to convert wav to flac?" "what command would convert wav to ogg?" "What command would convert wav to mp3?"
– Stephen Harris
Dec 10 at 0:56




Take it step by step. How would you convert one file? If you can work out how to convert one wav file into flac, into ogg, into mp3 (3 separate commands) then we can add a loop around it. So "what command would you use to convert wav to flac?" "what command would convert wav to ogg?" "What command would convert wav to mp3?"
– Stephen Harris
Dec 10 at 0:56




1




1




@StephenHarris, thanks, just working it out :-)
– nath
Dec 10 at 0:58




@StephenHarris, thanks, just working it out :-)
– nath
Dec 10 at 0:58




1




1




@StephenHarris done :-)))
– nath
Dec 10 at 1:37




@StephenHarris done :-)))
– nath
Dec 10 at 1:37










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










ffmpeg accepts multiple output formats. Set the input file.format with -i followed by the output file.format: ffmpeg -i input.wav output.ogg output.mp3 output.flac




Batch conversion:



As a simple one liner with putting each format in a separate folder:



mkdir mp3 ogg flac; for i in *.wav; do ffmpeg -i "$i" -b:a 320000 "./mp3/$i%.*.mp3" -b:a 320000 "./ogg/$i%.*.ogg" "./flac/$i%.*.flac"; done


Decode all into one folder:



for i in *.wav; do ffmpeg -i "$i" -b:a 320000 "$i%.*.mp3" -b:a 320000 "$i%.*.ogg" "$i%.*.flac"; done


-b:a 320000 sets the bitrate for the decoding of mp3 and ogg and can be adjusted (the bitrate is measured in bits/sec so 320kbit/s equals 320000).




thanks to https://stackoverflow.com/a/33766147 for the parameter-expansion






share|improve this answer





























    up vote
    1
    down vote













    Using GNU Parallel you can run:



    parallel ffmpeg -i 1 1..2 ::: *.wav ::: ogg mp3 flac

    1 = replacement string for first input source
    1. = replacement string for first input source with extension removed
    2 = replacement string for second input source
    ::: *.wav = input source 1
    ::: ogg mp3 flac = input source 2


    This will use all your cores.






    share|improve this answer






















    • thanks for your reply, would you mind explaining the line?
      – nath
      Dec 16 at 3:25










    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f487024%2fbatch-convert-decode-audio-into-multiple-formats-with-ffmpeg%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    ffmpeg accepts multiple output formats. Set the input file.format with -i followed by the output file.format: ffmpeg -i input.wav output.ogg output.mp3 output.flac




    Batch conversion:



    As a simple one liner with putting each format in a separate folder:



    mkdir mp3 ogg flac; for i in *.wav; do ffmpeg -i "$i" -b:a 320000 "./mp3/$i%.*.mp3" -b:a 320000 "./ogg/$i%.*.ogg" "./flac/$i%.*.flac"; done


    Decode all into one folder:



    for i in *.wav; do ffmpeg -i "$i" -b:a 320000 "$i%.*.mp3" -b:a 320000 "$i%.*.ogg" "$i%.*.flac"; done


    -b:a 320000 sets the bitrate for the decoding of mp3 and ogg and can be adjusted (the bitrate is measured in bits/sec so 320kbit/s equals 320000).




    thanks to https://stackoverflow.com/a/33766147 for the parameter-expansion






    share|improve this answer


























      up vote
      2
      down vote



      accepted










      ffmpeg accepts multiple output formats. Set the input file.format with -i followed by the output file.format: ffmpeg -i input.wav output.ogg output.mp3 output.flac




      Batch conversion:



      As a simple one liner with putting each format in a separate folder:



      mkdir mp3 ogg flac; for i in *.wav; do ffmpeg -i "$i" -b:a 320000 "./mp3/$i%.*.mp3" -b:a 320000 "./ogg/$i%.*.ogg" "./flac/$i%.*.flac"; done


      Decode all into one folder:



      for i in *.wav; do ffmpeg -i "$i" -b:a 320000 "$i%.*.mp3" -b:a 320000 "$i%.*.ogg" "$i%.*.flac"; done


      -b:a 320000 sets the bitrate for the decoding of mp3 and ogg and can be adjusted (the bitrate is measured in bits/sec so 320kbit/s equals 320000).




      thanks to https://stackoverflow.com/a/33766147 for the parameter-expansion






      share|improve this answer
























        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        ffmpeg accepts multiple output formats. Set the input file.format with -i followed by the output file.format: ffmpeg -i input.wav output.ogg output.mp3 output.flac




        Batch conversion:



        As a simple one liner with putting each format in a separate folder:



        mkdir mp3 ogg flac; for i in *.wav; do ffmpeg -i "$i" -b:a 320000 "./mp3/$i%.*.mp3" -b:a 320000 "./ogg/$i%.*.ogg" "./flac/$i%.*.flac"; done


        Decode all into one folder:



        for i in *.wav; do ffmpeg -i "$i" -b:a 320000 "$i%.*.mp3" -b:a 320000 "$i%.*.ogg" "$i%.*.flac"; done


        -b:a 320000 sets the bitrate for the decoding of mp3 and ogg and can be adjusted (the bitrate is measured in bits/sec so 320kbit/s equals 320000).




        thanks to https://stackoverflow.com/a/33766147 for the parameter-expansion






        share|improve this answer














        ffmpeg accepts multiple output formats. Set the input file.format with -i followed by the output file.format: ffmpeg -i input.wav output.ogg output.mp3 output.flac




        Batch conversion:



        As a simple one liner with putting each format in a separate folder:



        mkdir mp3 ogg flac; for i in *.wav; do ffmpeg -i "$i" -b:a 320000 "./mp3/$i%.*.mp3" -b:a 320000 "./ogg/$i%.*.ogg" "./flac/$i%.*.flac"; done


        Decode all into one folder:



        for i in *.wav; do ffmpeg -i "$i" -b:a 320000 "$i%.*.mp3" -b:a 320000 "$i%.*.ogg" "$i%.*.flac"; done


        -b:a 320000 sets the bitrate for the decoding of mp3 and ogg and can be adjusted (the bitrate is measured in bits/sec so 320kbit/s equals 320000).




        thanks to https://stackoverflow.com/a/33766147 for the parameter-expansion







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 10 at 2:50

























        answered Dec 10 at 1:37









        nath

        814424




        814424






















            up vote
            1
            down vote













            Using GNU Parallel you can run:



            parallel ffmpeg -i 1 1..2 ::: *.wav ::: ogg mp3 flac

            1 = replacement string for first input source
            1. = replacement string for first input source with extension removed
            2 = replacement string for second input source
            ::: *.wav = input source 1
            ::: ogg mp3 flac = input source 2


            This will use all your cores.






            share|improve this answer






















            • thanks for your reply, would you mind explaining the line?
              – nath
              Dec 16 at 3:25














            up vote
            1
            down vote













            Using GNU Parallel you can run:



            parallel ffmpeg -i 1 1..2 ::: *.wav ::: ogg mp3 flac

            1 = replacement string for first input source
            1. = replacement string for first input source with extension removed
            2 = replacement string for second input source
            ::: *.wav = input source 1
            ::: ogg mp3 flac = input source 2


            This will use all your cores.






            share|improve this answer






















            • thanks for your reply, would you mind explaining the line?
              – nath
              Dec 16 at 3:25












            up vote
            1
            down vote










            up vote
            1
            down vote









            Using GNU Parallel you can run:



            parallel ffmpeg -i 1 1..2 ::: *.wav ::: ogg mp3 flac

            1 = replacement string for first input source
            1. = replacement string for first input source with extension removed
            2 = replacement string for second input source
            ::: *.wav = input source 1
            ::: ogg mp3 flac = input source 2


            This will use all your cores.






            share|improve this answer














            Using GNU Parallel you can run:



            parallel ffmpeg -i 1 1..2 ::: *.wav ::: ogg mp3 flac

            1 = replacement string for first input source
            1. = replacement string for first input source with extension removed
            2 = replacement string for second input source
            ::: *.wav = input source 1
            ::: ogg mp3 flac = input source 2


            This will use all your cores.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 16 at 14:06

























            answered Dec 16 at 1:09









            Ole Tange

            11.9k1451105




            11.9k1451105











            • thanks for your reply, would you mind explaining the line?
              – nath
              Dec 16 at 3:25
















            • thanks for your reply, would you mind explaining the line?
              – nath
              Dec 16 at 3:25















            thanks for your reply, would you mind explaining the line?
            – nath
            Dec 16 at 3:25




            thanks for your reply, would you mind explaining the line?
            – nath
            Dec 16 at 3:25

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f487024%2fbatch-convert-decode-audio-into-multiple-formats-with-ffmpeg%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay