Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Converting mp3 files to opus and m4a recursively using command line tools and scripts in Linux.

  1. #1
    Join Date
    Aug 2011
    Location
    India
    Posts
    244

    Default Converting mp3 files to opus and m4a recursively using command line tools and scripts in Linux.

    Hi I am Rupesh from India and I have large collection of music (mp3) file's and I want to convert some of them to m4a ( advanced audio coding aac ) format and some of them to opus (specifically for speech) format. Previously I have converted using third party GUI tool in windows and the quality is acceptable but I want to try in Linux using scripts.

    I have installed opensuse leap 15.0 on my system. My system has powerful components like amd fx 4100 processor which is quad core and 8 GB ram, 1 tb internal hard disk with 64 mb cache memory. So try to suggest which provide quality encoding.

    In windows there are GUI tool's for everything and within a few click's we can do anything but in Linux there are command line tool's for everything and we can do anything. There are advantages and disadvantages for the above two methods. For windows software's are available which need less knowledge to use them but in Linux user needs thorough knowledge on what he is doing.

    I want to convert music mp3 file's to m4a and opus recursively using scripts on which I don't have deep understanding and so I am requesting your help.

    Actually what my intention is I want a bash script in which we can specify source directory path which contains mp3 files and after that we can specify destination directory path which contains converted m4a or opus file's.

    I want two scripts one for converting mp3 file's to opus file's and another for converting mp3 files to m4a files.

    After converting each and every mp3 file to opus or m4a files all the track information or metadata present in mp3 file must be copied to converted m4a or opus file's. Track information means album art ie., composer of the track etc.,.

    The source mp3 file and the converted m4a or opus must look like same and also contains same music present in source mp3 file.

    I think that there are two specific command line utilities to convert mp3 files to m4a or opus file's and they are fdkaac and opusenc.

    My source directory consists of some mp3 file's and also some sub directories and again these sub directories consists of some mp3 file's and also some sub directories. So I want to maintain same directory structure as source for the converted m4a or opus file's.

    I am going to illustrate the situation as follows

    directory 1
    {
    file 1.mp3
    file 2.mp3
    file 3.mp3
    {
    directory 2
    {
    file 4.mp3
    file 5.mp3
    }
    file 6.mp3
    }

    Upon converting the above directory I want suppose opus file's with directory structure as follows

    directory 1
    {
    file 1.opus
    file 2.opus
    file 3.opus
    {
    directory 2
    {
    file 4.opus
    file 5.opus
    }
    file 6.opus
    }

    Upon converting each and every mp3 file to m4a or opus if any error occur the corresponding file name and its path must be redirected to a text file so that I can examine them later.

    Is it possible to use opusenc tool or fdkaac tool to convert directly from mp3 to opus or m4a like

    opusenc -i input.mp3 -o output.mp3.

    Once upon a time I read that the mp3 file must be decoded using tools like sox to wave file and then it must be redirected to opusenc tool or fdkaac tool. If this statement is true may I know which is the best tool to decode mp3 to wave file.

    In windows if I want to accomplish this task I must buy a software which costs upto 100 dollars and that too we do not have complete control. We can accomplish the same task at free of cost and at the same time with complete control.

    Many of you suggest to use ffmpeg but I think that file which is transcoded using opusenc tool has good sound quality. Many of you may even suggest to try foobar but my answer is that sound quality may be poor.

    I think that a great script or any software cannot be created by a single person and it can be achieved only through group work.

    I have created this thread to get a great script which converts mp3 to m4a or opus file's which have excellent sound quality. Please try to cooperate and suggest all your valuable thoughts with patience.
    Regards,
    Rupesh.

  2. #2
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,262
    Blog Entries
    1

    Default Re: Converting mp3 files to opus and m4a recursively using command line tools and scripts in Linux.

    If you'd like to start a community group effort,
    One of the first and best ways is to create a Github project for the group. You can create a personal repo or create an entirely separate account and entity while you retain management rights (and can delegate if you want to).

    I've done CLI transcoding in the past using ffmpeg and mpeg and been satisfied with the results.
    The quality is determined by the codecs library you use, not by the application or script that does the transcoding or even the container chosen..
    I've looked into gstreamer codecs but found (at least at the time) that it's not as easy to reference directly in a CLI console.
    A GUI app I use for transcoding is Handbrake, but AFAIK it's only set up to use ffmpeg.

    If you propose using a different codecs library, remember that communities will generally support only what is legal, and preferably with free licensing (at least partial like x264/x265) or entirely free like Xvid and MP3 today(wasn't always free to use). So, be sure you get a crystal clear understanding of what is being used and post it because everyone will want to be equally clear before investing themselves.

    Good Luck,
    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  3. #3
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,333
    Blog Entries
    14

    Default Re: Converting mp3 files to opus and m4a recursively using command line tools and scripts in Linux.

    Hi Rupesh,

    IIRC you already asked similar questions here, can't you modify the scripts you wrote at the time?
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  4. #4

    Default Re: Converting mp3 files to opus and m4a recursively using command line tools and scripts in Linux.

    Quote Originally Posted by rupeshforu3 View Post
    Hi I am Rupesh from India and I have large collection of music (mp3) file's and I want to convert some of them to m4a ( advanced audio coding aac ) format and some of them to opus (specifically for speech) format. Previously I have converted using third party GUI tool in windows and the quality is acceptable but I want to try in Linux using scripts.

    I have installed opensuse leap 15.0 on my system. My system has powerful components like amd fx 4100 processor which is quad core and 8 GB ram, 1 tb internal hard disk with 64 mb cache memory. So try to suggest which provide quality encoding.

    In windows there are GUI tool's for everything and within a few click's we can do anything but in Linux there are command line tool's for everything and we can do anything. There are advantages and disadvantages for the above two methods. For windows software's are available which need less knowledge to use them but in Linux user needs thorough knowledge on what he is doing.

    I want to convert music mp3 file's to m4a and opus recursively using scripts on which I don't have deep understanding and so I am requesting your help.

    Actually what my intention is I want a bash script in which we can specify source directory path which contains mp3 files and after that we can specify destination directory path which contains converted m4a or opus file's.

    I want two scripts one for converting mp3 file's to opus file's and another for converting mp3 files to m4a files.

    suggest all your valuable thoughts with patience.

    Hi,

    You can probably do what you want in just one script. It all boils down to how options are handled in the script. Like for example you can have an option that accepts the path to your files and another that specify which format is the input and the output. This what I have in mind using short and long options.

    With the short options.
    Code:
    myscript -i mp3 -o m4a -p /path/to/the/files
    With the long options (like what a GNU program would normally support)
    Code:
    myscript --input mp3 --output m4a --path /path/to/the/files
    One good advantage is that the options (words or a single letter that starts with a dash or a duoble dash) can be in any order.
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  5. #5
    Join Date
    Aug 2011
    Location
    India
    Posts
    244

    Default Re: Converting mp3 files to opus and m4a recursively using command line tools and scripts in Linux.

    Someone has already created scripts.

    Please examine the following llinks

    https://github.com/kbat/mp32opus

    https://sourceforge.net/directory/?q=convert%20opus%20mp3%20command%20line

    These scripts are free to use.

  6. #6
    Join Date
    Aug 2011
    Location
    India
    Posts
    244

    Default Re: Converting mp3 files to opus and m4a recursively using command line tools and scripts in Linux.

    Can you examine the perl script called "perl audio converter" ie., pcapl.
    Regards,
    Rupesh.

  7. #7

    Default Re: Converting mp3 files to opus and m4a recursively using command line tools and scripts in Linux.

    Hi,

    Examine what exactly? There should be an author somewhere in the script and you can communicate with the author(s) if needed.
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  8. #8
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,333
    Blog Entries
    14

    Default Re: Converting mp3 files to opus and m4a recursively using command line tools and scripts in Linux.

    Quote Originally Posted by rupeshforu3 View Post
    Can you examine the perl script called "perl audio converter" ie., pcapl.
    Dear Rupesh,

    Please be aware that we are all volunteers, doing what we do in our spare time, on our own hardware. We cannot mimic your install, your files etc etc. We cannot do your work for you, however we can support you in getting your work done. But you simply cannot ask from anyone here to start examining any script you find out there on the internet.
    My advice: Create a test environment with just a couple of folders and files, and start testing whatever scripts you find that you think may work.
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  9. #9
    Join Date
    Aug 2011
    Location
    India
    Posts
    244

    Default Re: Converting mp3 files to opus and m4a recursively using command line tools and scripts in Linux.

    As I was searching for the words "multimedia codecs in Linux" I found the following

    gstreamer plugins good
    gstreamer plugins bad
    gstreamer plugins ugly
    libavcodec
    xine
    etc.,

    Which is the best one to use in Linux scripts. Are there any proprietary codecs available for Linux.

    I heard somewhere that libavcodec is inferior than others. Is it true.
    Regards,
    Rupesh.

  10. #10
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,262
    Blog Entries
    1

    Default Re: Converting mp3 files to opus and m4a recursively using command line tools and scripts in Linux.

    Quote Originally Posted by rupeshforu3 View Post
    As I was searching for the words "multimedia codecs in Linux" I found the following

    gstreamer plugins good
    gstreamer plugins bad
    gstreamer plugins ugly
    libavcodec
    xine
    etc.,

    Which is the best one to use in Linux scripts. Are there any proprietary codecs available for Linux.

    I heard somewhere that libavcodec is inferior than others. Is it true.
    With a little bit of reading (and IIRC since I haven't looked at this again for quite awhile)

    Anything that's a plugin generally means it's built to interface in a certain way with an application, at least I didn't see a way to use it in a very basic CLI. And, because that's generally how gstreamer codecs were provided when I looked at this, it then meant that gstreamer could only be used with applications that supported those gstreamer plugins.

    There are some recommended codecs, but you should just do a little testing for yourself.
    Not only will you be able to actually do an apples to apples comparison, but you'll also develop some skills using the transcoding app you choose.

    As for proprietary codecs...
    They're out there.

    If you haven't already downloaded and installed MediaInfo, you should to analyze every media file you have.
    You'll then get to see what codecs others have chosen, and the application used to transcode... plus a number of other things like whether certain parameters might have an effect.

    Remember also that unless you do your own transcoding, you won't know if compression rates are the same or what you would want. Raw (less compression) of course typically contains more data points so would be better at higher resolutions or produce better quality, but at some point given the limits of your playback application and hardware won't make any difference.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •