Last active
December 29, 2024 07:13
-
-
Save germanviscuso/200f27f975d685dd89d4fcc4c334ef10 to your computer and use it in GitHub Desktop.
Audio file conversion for Alexa skills
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert audio to SSML compatible mp3 | |
ffmpeg -i <input-file> -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 <output-file.mp3> | |
# Normalize audio | |
ffmpeg -i <input-file.mp3> -af loudnorm=I=-14:TP=-3:LRA=11:print_format=json -b:a 48k -ar 16000 <output-file.mp3> | |
# Do both at the same time | |
ffmpeg -i <input-file.mp3> -ac 2 -codec:a libmp3lame -af loudnorm=I=-16:TP=-3:LRA=11:print_format=json -b:a 48k -ar 16000 <output-file.mp3> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.bat
@echo off
:: Ruta del archivo de entrada y salida
set INPUT_FILE=input.mp3
set OUTPUT_FILE=output.mp3
:: Convertir audio a MP3 compatible con SSML
ffmpeg -i "%INPUT_FILE%" -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 "%OUTPUT_FILE%"
if errorlevel 1 (
echo Error al convertir el audio.
exit /b 1
)
:: Normalizar audio
ffmpeg -i "%OUTPUT_FILE%" -af loudnorm=I=-14:TP=-3:LRA=11 -b:a 48k -ar 16000 "%OUTPUT_FILE%"
if errorlevel 1 (
echo Error al normalizar el audio.
exit /b 1
)
:: Hacer ambas cosas al mismo tiempo
ffmpeg -i "%INPUT_FILE%" -ac 2 -codec:a libmp3lame -af loudnorm=I=-16:TP=-3:LRA=11 -b:a 48k -ar 16000 "%OUTPUT_FILE%"
if errorlevel 1 (
echo Error al convertir y normalizar el audio.
exit /b 1
)
echo Operación completada con éxito.
pause