Sponsored Content
Top Forums Shell Programming and Scripting Need a script for automation the convert a lot number audio files to another format Post 302957614 by temp-usr on Tuesday 13th of October 2015 07:57:44 AM
Old 10-13-2015
Hammer & Screwdriver Need a script for automation the convert a lot number audio files to another format

I have a lot number audio files in the MP3 proprietary format, I want to convert them to 'opus' the free and higher quality format, with keep metadata also.

My selection command-line programs are SoX (Sound eXchange) for convert MP3 files to 'AIFF' format in order to keep quality and metadata* and 'opusenc'[1] the official encoder for convert 'AIFF' files to 'opus' format. Most important part of the work is use of 'mediainfo' program for exporting metadata tags of MP3 files and giving them to 'opusenc' program for importing metadata tags to encoding opus files, also giving the bit-rate value of original MP3 files to 'opusenc' for encoding large size AIFF files in order to achieve the opus files with same bit-rate of original MP3 files, so I need a script for automation listed below operations:

1. Use sox for convert MP3 files in a directory with many sub-directory to the files with AIFF format with same name.

2. Use 'mediainfo' for exporting metadata tags (Album, Performer, Track name, Recorded date, Genre) and bit-rate value of original MP3 files.

3. Giving the previous step information to 'opusenc' (artist, title, album, date YYYY-MM-DD, genre)[1] and run it.

4. Delete MP3 and AIFF files after encode successfully done.

I want mentioned operations run consecutive on directories one by one.

My goal of this work is achieve to more freedom. Thank you very much for help and time that you devote to this work.

*: I choose AIFF format because it supports ID3v2 tags but when for test I convert a MP3 file contains metadata to 'AIFF' format with 'SoX' program and convert it to 'opus' with 'opusenc', result was the output opus file lacks metadata (don't known what is the problem exactly) also there was need to specify bit-rate value of MP3 file, so use of 'mediainfo' is necessary.

[1]: https://mf4.xiph.org/jenkins/view/opus/job/opus-tools/ws/man/opusenc.html
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Want To convert script in Linux format

I have scripts which I want to convert in Linux format. Note these scripts are in txt format.But I want to convert them in Linux, as DBA's will be using this script. Any command or utility which converts tht files in proper Linux format. Thanks in Adavce. Kunal (1 Reply)
Discussion started by: niceboykunal123
1 Replies

2. Shell Programming and Scripting

convert files into csv format using perl

Hi all perl gurus, I need your help to get the desired output in perl. I have a file which has text in it in the format Connection request start timestamp = 12/08/2008 00:58:36.956700 Connect request completion timestamp = 12/08/2008 00:58:36.959729 Application idle time ... (10 Replies)
Discussion started by: azs0309
10 Replies

3. Shell Programming and Scripting

Rename a lot of files using shells script

Hi This is the list file that i have : The files is more than this. I will rename one by one file become like this : So just change the time stamp 200906 become 200905. Is it possible using script ? Thanks (3 Replies)
Discussion started by: justbow
3 Replies

4. Shell Programming and Scripting

How to convert date format such as 7/18/2015 to the number of month

How to convert date format such as 7/18/2015 to the number of month from requesting date 'date' in sh scripting ? Let say I have output in my log.txt -> 7/18/2015. How I convert it to the full number of month starting from 'date' till 7/18/2015 in shell scripting ? Thanks in advance. (1 Reply)
Discussion started by: amerabest
1 Replies

5. Shell Programming and Scripting

Python script to convert date to iso format

Hi , This is my 1st program in python never tried any python before. i am trying to write a python script which reads a .tsv file line by line and in each line it should look for mm/dd/yyyy formate and convert it to yyyy-mm-dd formate . can some one provide be some sample code to do that. (2 Replies)
Discussion started by: vikatakavi
2 Replies

6. Shell Programming and Scripting

Sed/awk command to convert number occurances into date format and club a set of lines

Hi, I have been stuck in this requirement where my file contains the below format. 20150812170500846959990854-25383-8.0.0 "ABC Report" hp96880 "4952" 20150812170501846959990854-25383-8.0.0 End of run 20150812060132846959990854-20495-8.0.0 "XYZ Report" vg76452 "1006962188"... (6 Replies)
Discussion started by: Chinmaya Kabi
6 Replies

7. Shell Programming and Scripting

Convert a lot of files in subdirectories automatically

Hi, I have a huge structure of directories and subdirectories contsining some data. The lowest folders contain a file "image.png" which need to be converted to "folder.jpg". But how can I do that for all these files automatically? That's what I alredy have find /path -type f -name... (1 Reply)
Discussion started by: KarlKarpfen
1 Replies

8. Shell Programming and Scripting

Help need to convert bi-lingual files in sub-title format

I have a large number of files in the standard subtitle format with the additional proviso that the files are bi-lingual i.e. English and a second language: in this case Hindi. A small sample is given below: 00 04 07 08 00 04 11 00 I mean very high fever... He even vomited. 00 04 07 08 00... (6 Replies)
Discussion started by: gimley
6 Replies
convert(1)						      General Commands Manual							convert(1)

NAME
convert - convert an audio file SYNOPSIS
[source_file] [target_file] [] [] [] [] [] [] [] DESCRIPTION
This command converts audio files from one supported file format, data format, sampling rate, and number of channels to another. The unconverted file is retained as a source file. are the file formats for the source and destination files. Each format can be one of these: Sun file format NeXT file format Microsoft RIFF Waveform file format MuLaw format ALaw linear 16-bit format offset (unsigned) linear 8-bit format linear 8-bit format If you omit uses the header or filename extension in the source file. You can omit if you supply a filename extension for the des- tination file. is the data type for the destination files. data_type can be one of these: MuLaw ALaw linear 16-bit offset (unsigned) linear 8-bit data linear 8-bit data If you omit uses an appropriate data type, normally the data type of the source file. are the number of samples per second for the source and destination file. Typical sampling rates range from 8 to 11k (for voice quality) to 44,100 (for CD quality). You can use to indi- cate thousands. For example, means 8,000 samples per second. If you omit uses a rate defined by the source file header or its filename extension. For a raw file with no extension, 8,000 is used. By playing the file, you can determine if 8,000 samples is too fast or too slow. If you omit uses a sampling rate appropriate for the destination file format; if possible, it matches the sampling rate of the source file. are the number of channels in the source and destination files. Use for mono; for stereo. If is omitted, uses the information in the header; for raw data files, it uses mono. If is omitted, matches what was used for the source file (through the header or option); for raw data files, it uses mono. EXAMPLES
Convert a raw data file to a headered file. Convert a raw data file to a headered file when the source has no extension, was sampled at 11,025 per second, and has stereo data. To save disk space, convert an audio file with CD quality sound to voice quality sound. AUTHOR
was developed by HP. Sun is a trademark of Sun MicroSystems, Inc. NeXT is a trademark of NeXT Computers, Inc. Microsoft is a trademark of Microsoft Corporation. SEE ALSO
audio(5), asecure(1M), aserver(1M), attributes(1), send_sound(1). convert(1)
All times are GMT -4. The time now is 05:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy