Skip to main content
Topic: Converting mp3 files to opus and m4a recursively using cli tools scripts Linux (Read 422 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Converting mp3 files to opus and m4a recursively using cli tools scripts 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.
Regards,
Rupesh.

Re: Converting mp3 files to opus and m4a recursively using cli tools scripts Linux

Reply #1
[...] large collection of music (mp3) file's and I want to convert some of them to [...]
Very-very-very bad idea. You can need very-very-very important reason for this.

Re: Converting mp3 files to opus and m4a recursively using cli tools scripts Linux

Reply #2
If you must do this, a quick search online throws up several scripts for this - for example

https://github.com/kbat/mp32opus

Not mine, and I have no experience of converting from mp3 in this way, but I agree with m14u - generally  a bad idea to convert from one lossy format to another without a very good reason....

Re: Converting mp3 files to opus and m4a recursively using cli tools scripts Linux

Reply #3
If you must do this, a quick search online throws up several scripts for this - for example

https://github.com/kbat/mp32opus

Not mine, and I have no experience of converting from mp3 in this way, but I agree with m14u - generally  a bad idea to convert from one lossy format to another without a very good reason....

Thanks for your suggestion and previously converted opus file's are of good to me.

I want to convert to opus for my personal use not for other's.

Can you suggest any other scripts.
Regards,
Rupesh.

Re: Converting mp3 files to opus and m4a recursively using cli tools scripts Linux

Reply #4
try deadbeef ( http://deadbeef.sourceforge.net ) - foobar-like player with converter

Re: Converting mp3 files to opus and m4a recursively using cli tools scripts Linux

Reply #5
Have a look at the source forge website for the words " convert opus mp3 command lline"
Regards,
Rupesh.


Re: Converting mp3 files to opus and m4a recursively using cli tools scripts Linux

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

 

Re: Converting mp3 files to opus and m4a recursively using cli tools scripts Linux

Reply #8
Can you examine the perl script called "perl audio converter"  ie., pcapl.

I have used this in the past and it worked fine for me. Check if it meets your needs especially re tagging converted files.

Re: Converting mp3 files to opus and m4a recursively using cli tools scripts Linux

Reply #9
I want to use pcapl but I want to know how to use it efficiently and so I searched for the words "pcapl help" "pcapl documentation" etc., but not found except manual page of it.

Can anyone of you suggest a link to it's documentation.
Regards,
Rupesh.

Re: Converting mp3 files to opus and m4a recursively using cli tools scripts Linux

Reply #10
Sorry Rupesh, I had forgotten exactly how my experience was with pacpl. I went back and had a look at the config file this morning and it prompted a better recollection. I also could find little documentation except at the homepage, but looking at the config file  (pacpl.conf) it allows only for basic  setup. Other than that it will use default encoder options for eg tagging. I switched away from it in order to get better control of tagging. Others may have had a better experience with it, or have better skills to deal with the tagging issue.

 
SimplePortal 1.0.0 RC1 © 2008-2018