Skip to main content
Topic: Requesting Linux script for lame to compress mp3 files recursively. (Read 8378 times)
0 Members and 1 Guest are viewing this topic.

## Requesting Linux script for lame to compress mp3 files recursively.

##### 2017-05-29 09:05:09
Hi I am Rupesh from India. I have a huge directory of size 93.5 gb with 8500 mp3 files and 2000 sub directories.

All these mp3s are speeches recorded by someone at 64 kbps. I want to compress these files recursively using lame with 16 kbps bit rate and 11050 sample rate.

I have found some guis or front end for lame like lamexp,razorlame,lamefrontend none has options to compress mp3 files recursively at 16 kbps. On searching net I found a script for ffmpeg to compress recursively. I have deleted ffmpeg code and substituted lame code instead of which I am providing below

Code: [Select]
.@echo offsetlocal EnableExtensions DisableDelayedExpansionrem // Define constants here:set "_SOURCE=I:\to convert3"set "_TARGET=H:\converted\lame4"rem // Change to source directory temporarily:pushd "%_SOURCE%" || exit /B 1rem // Enumerate source files, return paths relative to the source directory:for /F "delims=" %%F in ('xcopy /L /S /I ".\*.mp3" "%_TARGET%" ^| find ".\"') do (    echo Currently converting "%%F"...    rem // Create destination directory, suppress error if it aready exists:    mkdir "%_TARGET%\%%F\.." 2> nul    rem // Perform actual file conversion, using paths relative to target directory:    lame    --abr 16 -m j -q 0 --resample 22.05 --priority 4   "%%F" "%_TARGET%\%%F\..\%%~nF.mp3")echo Completed.popdendlocal

The above script runs only on Windows but can't run on Linux and it is better to run the script on Linux.

Please try to convert the above Windows batch script to Linux shell script and post it.

Please try to suggest if you know a front end for lame which can compress mp3 files recursively at 16 kbps.

Regards,
Rupesh.
Regards,
Rupesh.

## Re: Requesting Linux script for lame to compress mp3 files recursively.

##### Reply #1 – 2017-05-29 09:26:45
There is an outline of the  two-step process to avoid overcomplicated scripting
https://www.youtube.com/watch?v=YFcw6H8ht1A
Debate somewhere on this very forums (can't find right now).
PANIC: CPU 1: Cache Error (unrecoverable - dcache data) Eframe = 0x90000000208cf3b8
NOTICE - cpu 0 didn't dump TLB, may be hung

## Re: Requesting Linux script for lame to compress mp3 files recursively.

##### Reply #2 – 2017-05-29 17:04:15
I am positive foobar2000 can do this.

## Re: Requesting Linux script for lame to compress mp3 files recursively.

##### Reply #3 – 2017-05-29 19:29:54
There is a tool called pacpl which I have used to convert FLAC/whatever files to mp3s for portable use. It is recursive, and replicates the directory tree --- but I don't think it can be be used to convert and  overwrite in place.

It is quite powerful and option-rich

pacpl home

man pacpl

There is almost certainly a possible single-line "find" command which would do what you want. See the -exec option of find. You'd better have a good backup before experimenting, though!

man find

find searches recursively and does whatever you tell it to do with the results. Be careful: it does what you tell it, whether it was what you wanted or something you absolutely did not want.

That's the nature of command-line Unix/Linux. If you are working with Linux already, then you probably know that already. It is an awful lot safer to copy/convert the directory tree somewhere else, deleting the original files only when you  are sure the conversion has given you what you want. And pacpl should do that for you without scripting or intricate find-command stuff.

EDIT: looks like the script in the video above is using find, but it really hurts my head to watch text stuff on youtube.

The most important audio cables are the ones in the brain

SimplePortal 1.0.0 RC1 © 2008-2020