Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE


This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

Requesting a Linux script to compress mp3 files recursively.

A collection of useful tutorials for some common tasks.

Requesting a Linux script to compress mp3 files recursively.

Postby rupeshforu3 » Mon May 29, 2017 5:39 am

Hi I am Rupesh from India. I have a huge directory of size 93 gb with 8500 mp3 files and 2200 sub directories.

I want to compress these mp3 recursively using script and found a Windows batch script which can run only on Windows but can't run on Linux. I am providing the code below.

Code: Select all
.
@echo off
setlocal EnableExtensions DisableDelayedExpansion

rem // Define constants here:
set "_SOURCE=C:\Rupesh\to convert"
set "_TARGET=E:\Rupesh\ffmpeg out"

rem // Change to source directory temporarily:
pushd "%_SOURCE%" || exit /B 1
rem // 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:
    ffmpeg -i  "%%F" -v quiet -codec:a libmp3lame -b:a 16k -ar 11025 -map_metadata 0 -id3v2_version 3 -write_id3v1 1 "%_TARGET%\%%F\..\%%~nF.mp3"
)
echo Completed.
popd

endlocal
exit /B


I am not an experienced Linux user and so I am requesting you to convert the above code into shell script and post it.


Regards,
Rupesh.
rupeshforu3
 
Posts: 12
Joined: Sun Mar 19, 2017 11:12 am

Return to Tutorials

Who is online

Users browsing this forum: Google [Bot] and 2 guests