Sponsored Content
Top Forums Shell Programming and Scripting Help with 'batch conversion using lame' shell script Post 302411133 by Kingzy on Wednesday 7th of April 2010 05:54:04 PM
Old 04-07-2010
So i entered this in the command line:

Code:
lame --mp3input hello hello1

and it worked. The output file was fine when i put back the mp3 extension. Thanks a lot.

But, in my script, i already specified in the for loop to only consider '.mp3' files. It will still ignore 'non-mp3' files. How do i make it detect any audio file of mp3 format in ~/Documents?

As for adding 'set -x', my script closes itself when all conversion is done. How do i stop that?

Code:
#!/bin/bash

set -x

cd ~/Documents

for file in *.mp3; 
do lame --mp3input "$file"; 

for i in *.mp3.mp3 ; do
mv "$i" ~/Documents/newmp3s
cd ~/Documents/newmp3s
rename 's/.mp3//' *.mp3
cd ..
done
done


Last edited by Kingzy; 04-07-2010 at 07:28 PM.. Reason: forgot to tag my code
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

batch command in a shell script

How do I execute a batch command from a script, which "waits" with the next command until the first one has finished? ======= A piece of my script looks like this: #!/bin/sh (...) # run a long batch job: ./run_calculation.sh # then rename resulting file: mv output.dat backup.dat (...) ... (7 Replies)
Discussion started by: ivvo
7 Replies

2. Shell Programming and Scripting

Change the Windows Batch script to UNIX shell script.

Hi, When I run the below script in UNIX it's throwing syntax errors. Actually it's a windows batch script. Could anyone change the below Windows Batch script to UNIX shell script... Script: REM :: File Name : Refresh_OTL.bat REM :: Parameters : %1 - Region REM :: : %2 - Cube Type REM ::... (5 Replies)
Discussion started by: tomailraj
5 Replies

3. Shell Programming and Scripting

Executing a batch of files within a shell script with option to refire the individual files in batch

Hello everyone. I am new to shell scripting and i am required to create a shell script, the purpose of which i will explain below. I am on a solaris server btw. Before delving into the requirements, i will give youse an overview of what is currently in place and its purpose. ... (2 Replies)
Discussion started by: goddevil
2 Replies

4. Shell Programming and Scripting

Dos batch script to execute unix shell script

Can anyone help me with a dos batch script to execute a shell script residing in an unix server. I am not able to use ssh. Thanks in advance (2 Replies)
Discussion started by: Shri123
2 Replies

5. Shell Programming and Scripting

Conversion batch shell script

while converting batch file to shell script ...dis command is ther i dunno how to change...can anyone knws how to change into shell script rm !(D:\temp\XX.txt) (3 Replies)
Discussion started by: monisha
3 Replies

6. Shell Programming and Scripting

Need to run the batch script from shell scripting

Hi All, I am working on shell scripting.My script is completed but I have one task that is to trigger the batch script(with or without parameter) from my shell scripting(reside on linux system) and output which is geneareted by the batch should e.g. if batch script creates any files then I want... (5 Replies)
Discussion started by: anuragpgtgerman
5 Replies

7. Shell Programming and Scripting

Batch to bash conversion

Hi, I am just trying to convert the batch script to bash script and i am stuck at one point where I have the below code for /f "delims=" %%a in (a.txt) do ( for /f "tokens=1,2,3* delims==" %%i in ("%%a") do ( for /f "tokens=1,2,3* delims= " %%x in ("%%i") do ( if... (4 Replies)
Discussion started by: prasanna2166
4 Replies

8. Shell Programming and Scripting

Shell script from batch file

Hi, I am a junior dba and started carrier very new. I have a batch file to create some script of db creation. I want that batch file to convert in .sh file so that I can directly run that in the AIX box to generate those files. Please help me with the code for AIX. Batch file is here: ... (2 Replies)
Discussion started by: dba_aix
2 Replies

9. Shell Programming and Scripting

Batch script to execute shell script in UNIX server

Hi team, My requirement is to transfer pdf files from windows machine to unix server and then from that unix server we should sftp to another server. I have completed the first part i.e From windows to using to unix server with the help of psftp.exe code: psftp user@host -pw password <... (1 Reply)
Discussion started by: bhupeshchavan
1 Replies

10. Shell Programming and Scripting

Batch to shell script conversion

Hi All, I have a small tool which is currently configured in batch scripts only. But my need is to run it on Linux platform, so I have been trying to convert a batch script to shell script. below is the batch script: @echo off IF "%1"== "" GOTO ARGERR REM UPDATE THESE PROPERTIES TO... (2 Replies)
Discussion started by: sukhdip
2 Replies
qmp3cut(1)							 quelcom man pages							qmp3cut(1)

NAME
qmp3cut - extract and/or delete parts of a mp3 file SYNOPSIS
qmp3cut [option]... file DESCRIPTION
qmp3cut allows to extract and/or delete a fragment of a mp3 file. some parameters must be supplied in order to define the start/size/end cut points and what to do then: either the fragment must be copied to another file or erased from the file (or both) GENERAL OPTIONS
-d, --delete deletes the fragment from the file. if option --output is used, deletion action is always done after fragment extraction. -h, --help show a brief help and exit. -o <outfile>, --output=<outfile> outfile is the file where the frames contained in the specified fragment will be copied. -v, --verbose verbose. -V, --version show version and exit. CUT OPTIONS
cut options are used to specify at which frame the fragment begins (options -b or -B), ends (options -e and -E), or which size it has (option -s). at least, one cut option must be specified. neither the options -b and -B, and the options -e and -E can be used together; also, a begin, end and size option can be used at the same time. by default, the fragment begins at the first frame and ends at the last frame; there's no default value for size. all the values are treated as a frame number unless a format specifier is used. see the FORMATS section below for information. values must be positive integer. -b <begin>[<format>], --set-begin-from-eof=<begin>[<format>] begin specifies the first frame of the file that belongs to the cut counting from the end of the file. -B <begin>[<format>], --set-begin=<begin>[<format>] begin specifies the first frame of the file that belongs to the cut counting from the beginning of the file. -e <end>[<format>], --set-end-from-eof=<end>[<format>] end specifies the last frame of the file that belongs to the cut counting from the end of the file. -E <end>[<format>], --set-end=<end>[<format>] end specifies the last frame of the file that belongs to the cut counting from the beginning of the file. -s <size>[<format>], --set-size=<size>[<format>] size specifies the number of frames contained in the cut. -S <begin>-<end>, --slice <begin>-<end> slice specifies the starting and ending points of the cut as a timeslice, which is to say, two time specifications ([[h:]m:]s[.ms]) joined by a hyphen. FORMATS
cut options can have also an optional modifier. if this modifier is not used, then the value provided with the corresponding cut option will be interpreted as a number of frames. since most of the times will be difficult to specify a cut in terms of frames, the following modifiers are provided: j value is interpreted as milliseconds. m value is interpreted as minutes. s value is interpreted as seconds. b value is interpreted as bytes. k value is interpreted as kbytes (1024 bytes). M value is interpreted as megabytes (1024 kbytes). in either case, the values specified will be rounded to get an integer number of frames. EXAMPLES
here are some examples: to get the last ten seconds of a file: qmp3cut -b 10s -o outfile.mp3 infile.mp3 two ways of getting the first minute of a file: qmp3cut -E 1m -o outfile.mp3 infile.mp3 qmp3cut -s 1m -o outfile.mp3 infile.mp3 three ways of getting the second quarter of a file: qmp3cut -S 15:0-30:0 -o outfile.mp3 infile.mp3 qmp3cut -B 15m -E 30m -o outfile.mp3 infile.mp3 qmp3cut -s 15m -E 30m -o outfile.mp3 infile.mp3 qmp3cut -B 15m -s 15m -o outfile.mp3 infile.mp3 NOTES
if neither the options --output nor --delete are specified, the program will do nothing. BUGS
usually, the mpg123 player (and any other app mp3-read capable) report messages in the way like "cannot rewind by XXX bytes" where XXX is a negative value on streams extracted with qmp3cut. this is due to frame dependency (frame decoding depends sometimes of neighbourhood frames when bit reservoir technique is used at encoding time) and possibly will be corrected in a (near?) future. there's no support for variable bit rate (vbr) files. tests have been done only with mpeg version 1 layer iii streams, though it may (or not) work with other versions/layers. AUTHOR
dmanye@etse.urv.es http://www.etse.urv.es/~dmanye/quelcom/quelcom.html SEE ALSO
qmp3info(1), qmp3join(1), qmp3check(1), qmp3report(1) qwavinfo(1), qwavjoin(1), qwavcut(1), qwavsilence(1), qwavfade(1), qwavheaderdump(1) quelcom 0.4.0 february 2001 qmp3cut(1)
All times are GMT -4. The time now is 02:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy