ffmpeg batch convert files











up vote
0
down vote

favorite












I have a folder that contains audio files, files are in sequence named from 1 to 150 but none of the files have file extension.
What I want is to convert them to aac or.mp3 and If I can join them as a one audio file that I will be fantastic.



Can some one help me out with this??



Thank you in advanced










share|improve this question


















  • 1




    What format are the files? Are they all the same format? Please show the complete ffmpeg console output of: ffmpeg -i one_of_the_input_files
    – llogan
    Feb 13 '14 at 18:51










  • thank you for the reply no there are a lot of different formats There are lossy and lossless formats
    – Levan
    Feb 13 '14 at 18:57

















up vote
0
down vote

favorite












I have a folder that contains audio files, files are in sequence named from 1 to 150 but none of the files have file extension.
What I want is to convert them to aac or.mp3 and If I can join them as a one audio file that I will be fantastic.



Can some one help me out with this??



Thank you in advanced










share|improve this question


















  • 1




    What format are the files? Are they all the same format? Please show the complete ffmpeg console output of: ffmpeg -i one_of_the_input_files
    – llogan
    Feb 13 '14 at 18:51










  • thank you for the reply no there are a lot of different formats There are lossy and lossless formats
    – Levan
    Feb 13 '14 at 18:57















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a folder that contains audio files, files are in sequence named from 1 to 150 but none of the files have file extension.
What I want is to convert them to aac or.mp3 and If I can join them as a one audio file that I will be fantastic.



Can some one help me out with this??



Thank you in advanced










share|improve this question













I have a folder that contains audio files, files are in sequence named from 1 to 150 but none of the files have file extension.
What I want is to convert them to aac or.mp3 and If I can join them as a one audio file that I will be fantastic.



Can some one help me out with this??



Thank you in advanced







ffmpeg convert batch join






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 13 '14 at 18:21









Levan

4,712215782




4,712215782








  • 1




    What format are the files? Are they all the same format? Please show the complete ffmpeg console output of: ffmpeg -i one_of_the_input_files
    – llogan
    Feb 13 '14 at 18:51










  • thank you for the reply no there are a lot of different formats There are lossy and lossless formats
    – Levan
    Feb 13 '14 at 18:57
















  • 1




    What format are the files? Are they all the same format? Please show the complete ffmpeg console output of: ffmpeg -i one_of_the_input_files
    – llogan
    Feb 13 '14 at 18:51










  • thank you for the reply no there are a lot of different formats There are lossy and lossless formats
    – Levan
    Feb 13 '14 at 18:57










1




1




What format are the files? Are they all the same format? Please show the complete ffmpeg console output of: ffmpeg -i one_of_the_input_files
– llogan
Feb 13 '14 at 18:51




What format are the files? Are they all the same format? Please show the complete ffmpeg console output of: ffmpeg -i one_of_the_input_files
– llogan
Feb 13 '14 at 18:51












thank you for the reply no there are a lot of different formats There are lossy and lossless formats
– Levan
Feb 13 '14 at 18:57






thank you for the reply no there are a lot of different formats There are lossy and lossless formats
– Levan
Feb 13 '14 at 18:57












2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










get a recent, real ffmpeg build



The fake version in the repository from the Libav fork can not do this. You can download a Linux build of ffmpeg or follow a step-by-step guide to compile ffmpeg.



concatenate/join/combine the audio



Generally the concat demuxer or the concat filter can be used if all of the inputs are similar, but that may be difficult with so many inputs of various formats and properties. Usually I tend to avoid creating temporary files since the concat demuxer or the concat filter alone usually work, but perhaps you can encode them to PCM in WAV and then use the concat demuxer. Assuming there are only audio files in the directory, and your audio files are in ~/Desktop/test:



$ cd ~/Desktop/test
$ mkdir audio
$ for f in *; do ffmpeg -i "$f" -acodec pcm_s16le -ar 44100 -ac 2 audio/"$f".wav; done
$ for f in audio/*.wav; do echo "file '$f'" >> mylist.txt; done
$ ffmpeg -loglevel error -f concat -i mylist.txt -acodec libmp3lame -aq 4 -metadata title="Your Title" -metadata author="Levan" output.mp3





share|improve this answer























  • Thank you very much for the reply if it is not too much trouble can you help me out a bit more. I am having trouble understanding what to do with all of this Ok the first step make directory sure next step is to encode but where should I put my folder in for example if my folder is '/home/levan/Desktop/test' were should I put it ?? in the first commend ?? Thank you
    – Levan
    Feb 13 '14 at 20:33






  • 1




    @Levan My examples assume that you start in the directory that contains your files that you want to convert. I'll update it to make it more clear.
    – llogan
    Feb 13 '14 at 22:35




















up vote
0
down vote













find *.mp4 -exec ffmpeg -i {} {}.mp3 ;



To strip the audio from a batch of mp4 files into mp3 files, retaining the file name, open the directory to the files and enter the above command.






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    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',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2faskubuntu.com%2fquestions%2f420495%2fffmpeg-batch-convert-files%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










    get a recent, real ffmpeg build



    The fake version in the repository from the Libav fork can not do this. You can download a Linux build of ffmpeg or follow a step-by-step guide to compile ffmpeg.



    concatenate/join/combine the audio



    Generally the concat demuxer or the concat filter can be used if all of the inputs are similar, but that may be difficult with so many inputs of various formats and properties. Usually I tend to avoid creating temporary files since the concat demuxer or the concat filter alone usually work, but perhaps you can encode them to PCM in WAV and then use the concat demuxer. Assuming there are only audio files in the directory, and your audio files are in ~/Desktop/test:



    $ cd ~/Desktop/test
    $ mkdir audio
    $ for f in *; do ffmpeg -i "$f" -acodec pcm_s16le -ar 44100 -ac 2 audio/"$f".wav; done
    $ for f in audio/*.wav; do echo "file '$f'" >> mylist.txt; done
    $ ffmpeg -loglevel error -f concat -i mylist.txt -acodec libmp3lame -aq 4 -metadata title="Your Title" -metadata author="Levan" output.mp3





    share|improve this answer























    • Thank you very much for the reply if it is not too much trouble can you help me out a bit more. I am having trouble understanding what to do with all of this Ok the first step make directory sure next step is to encode but where should I put my folder in for example if my folder is '/home/levan/Desktop/test' were should I put it ?? in the first commend ?? Thank you
      – Levan
      Feb 13 '14 at 20:33






    • 1




      @Levan My examples assume that you start in the directory that contains your files that you want to convert. I'll update it to make it more clear.
      – llogan
      Feb 13 '14 at 22:35

















    up vote
    2
    down vote



    accepted










    get a recent, real ffmpeg build



    The fake version in the repository from the Libav fork can not do this. You can download a Linux build of ffmpeg or follow a step-by-step guide to compile ffmpeg.



    concatenate/join/combine the audio



    Generally the concat demuxer or the concat filter can be used if all of the inputs are similar, but that may be difficult with so many inputs of various formats and properties. Usually I tend to avoid creating temporary files since the concat demuxer or the concat filter alone usually work, but perhaps you can encode them to PCM in WAV and then use the concat demuxer. Assuming there are only audio files in the directory, and your audio files are in ~/Desktop/test:



    $ cd ~/Desktop/test
    $ mkdir audio
    $ for f in *; do ffmpeg -i "$f" -acodec pcm_s16le -ar 44100 -ac 2 audio/"$f".wav; done
    $ for f in audio/*.wav; do echo "file '$f'" >> mylist.txt; done
    $ ffmpeg -loglevel error -f concat -i mylist.txt -acodec libmp3lame -aq 4 -metadata title="Your Title" -metadata author="Levan" output.mp3





    share|improve this answer























    • Thank you very much for the reply if it is not too much trouble can you help me out a bit more. I am having trouble understanding what to do with all of this Ok the first step make directory sure next step is to encode but where should I put my folder in for example if my folder is '/home/levan/Desktop/test' were should I put it ?? in the first commend ?? Thank you
      – Levan
      Feb 13 '14 at 20:33






    • 1




      @Levan My examples assume that you start in the directory that contains your files that you want to convert. I'll update it to make it more clear.
      – llogan
      Feb 13 '14 at 22:35















    up vote
    2
    down vote



    accepted







    up vote
    2
    down vote



    accepted






    get a recent, real ffmpeg build



    The fake version in the repository from the Libav fork can not do this. You can download a Linux build of ffmpeg or follow a step-by-step guide to compile ffmpeg.



    concatenate/join/combine the audio



    Generally the concat demuxer or the concat filter can be used if all of the inputs are similar, but that may be difficult with so many inputs of various formats and properties. Usually I tend to avoid creating temporary files since the concat demuxer or the concat filter alone usually work, but perhaps you can encode them to PCM in WAV and then use the concat demuxer. Assuming there are only audio files in the directory, and your audio files are in ~/Desktop/test:



    $ cd ~/Desktop/test
    $ mkdir audio
    $ for f in *; do ffmpeg -i "$f" -acodec pcm_s16le -ar 44100 -ac 2 audio/"$f".wav; done
    $ for f in audio/*.wav; do echo "file '$f'" >> mylist.txt; done
    $ ffmpeg -loglevel error -f concat -i mylist.txt -acodec libmp3lame -aq 4 -metadata title="Your Title" -metadata author="Levan" output.mp3





    share|improve this answer














    get a recent, real ffmpeg build



    The fake version in the repository from the Libav fork can not do this. You can download a Linux build of ffmpeg or follow a step-by-step guide to compile ffmpeg.



    concatenate/join/combine the audio



    Generally the concat demuxer or the concat filter can be used if all of the inputs are similar, but that may be difficult with so many inputs of various formats and properties. Usually I tend to avoid creating temporary files since the concat demuxer or the concat filter alone usually work, but perhaps you can encode them to PCM in WAV and then use the concat demuxer. Assuming there are only audio files in the directory, and your audio files are in ~/Desktop/test:



    $ cd ~/Desktop/test
    $ mkdir audio
    $ for f in *; do ffmpeg -i "$f" -acodec pcm_s16le -ar 44100 -ac 2 audio/"$f".wav; done
    $ for f in audio/*.wav; do echo "file '$f'" >> mylist.txt; done
    $ ffmpeg -loglevel error -f concat -i mylist.txt -acodec libmp3lame -aq 4 -metadata title="Your Title" -metadata author="Levan" output.mp3






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited May 23 '17 at 12:39









    Community

    1




    1










    answered Feb 13 '14 at 19:54









    llogan

    4,8951334




    4,8951334












    • Thank you very much for the reply if it is not too much trouble can you help me out a bit more. I am having trouble understanding what to do with all of this Ok the first step make directory sure next step is to encode but where should I put my folder in for example if my folder is '/home/levan/Desktop/test' were should I put it ?? in the first commend ?? Thank you
      – Levan
      Feb 13 '14 at 20:33






    • 1




      @Levan My examples assume that you start in the directory that contains your files that you want to convert. I'll update it to make it more clear.
      – llogan
      Feb 13 '14 at 22:35




















    • Thank you very much for the reply if it is not too much trouble can you help me out a bit more. I am having trouble understanding what to do with all of this Ok the first step make directory sure next step is to encode but where should I put my folder in for example if my folder is '/home/levan/Desktop/test' were should I put it ?? in the first commend ?? Thank you
      – Levan
      Feb 13 '14 at 20:33






    • 1




      @Levan My examples assume that you start in the directory that contains your files that you want to convert. I'll update it to make it more clear.
      – llogan
      Feb 13 '14 at 22:35


















    Thank you very much for the reply if it is not too much trouble can you help me out a bit more. I am having trouble understanding what to do with all of this Ok the first step make directory sure next step is to encode but where should I put my folder in for example if my folder is '/home/levan/Desktop/test' were should I put it ?? in the first commend ?? Thank you
    – Levan
    Feb 13 '14 at 20:33




    Thank you very much for the reply if it is not too much trouble can you help me out a bit more. I am having trouble understanding what to do with all of this Ok the first step make directory sure next step is to encode but where should I put my folder in for example if my folder is '/home/levan/Desktop/test' were should I put it ?? in the first commend ?? Thank you
    – Levan
    Feb 13 '14 at 20:33




    1




    1




    @Levan My examples assume that you start in the directory that contains your files that you want to convert. I'll update it to make it more clear.
    – llogan
    Feb 13 '14 at 22:35






    @Levan My examples assume that you start in the directory that contains your files that you want to convert. I'll update it to make it more clear.
    – llogan
    Feb 13 '14 at 22:35














    up vote
    0
    down vote













    find *.mp4 -exec ffmpeg -i {} {}.mp3 ;



    To strip the audio from a batch of mp4 files into mp3 files, retaining the file name, open the directory to the files and enter the above command.






    share|improve this answer

























      up vote
      0
      down vote













      find *.mp4 -exec ffmpeg -i {} {}.mp3 ;



      To strip the audio from a batch of mp4 files into mp3 files, retaining the file name, open the directory to the files and enter the above command.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        find *.mp4 -exec ffmpeg -i {} {}.mp3 ;



        To strip the audio from a batch of mp4 files into mp3 files, retaining the file name, open the directory to the files and enter the above command.






        share|improve this answer












        find *.mp4 -exec ffmpeg -i {} {}.mp3 ;



        To strip the audio from a batch of mp4 files into mp3 files, retaining the file name, open the directory to the files and enter the above command.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 11 at 4:40









        rob grune

        528149




        528149






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • 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%2faskubuntu.com%2fquestions%2f420495%2fffmpeg-batch-convert-files%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 did Captain America manage to do this?

            迪纳利

            南乌拉尔铁路局