View Full Version : Batch convert audio in video
Slogra
30th August 2023, 09:47
I have a lot of videos with a 256kbps audio track (with a ~500kbps video, lol). So i want to reencode the audio to something smaller with qaac.
Is there a gui that can do this? Or perhaps a batch script?
I was thinking ffmpeg but i don't think it supports qaac.
tebasuna51
30th August 2023, 11:54
Maybe with a batch like:
@echo off
set FFMPEG=C:\Portable\0\ffmpeg.exe
set QAAC=C:\Portable\0\qaac.exe
md mkv
FOR %%I in (*.avi) DO (
"%FFMPEG%" -hide_banner -drc_scale 0 -i "%%I" -acodec pcm_s24le -f wav - | "%QAAC%" --ignorelength --adts --no-delay -V 80 -o "%%~nI.aac" -
"%FFMPEG%" -hide_banner -i "%%I" -i "%%~nI.aac" -map 0:v:0 -vcodec copy -map 1:a:0 -acodec copy ".\mkv\%%~nI.mkv"
)
pause
Replace your ffmpeg and qaac paths, the extension/s of your input files, some qaac parameters, etc.
Create a subfolder mkv to avoid name problems if inputs are mkv's.
And video/audio input must be compatible with ffmpeg, and video with mkv.
Slogra
31st August 2023, 11:10
Thank you tebasuna51!
I changed it a bit because i could not get the pipe to work.
And it is reading (and writing) in subdirectories now.
It is running now. It'll take a while because qaac is terribly slow (5x). Not sure why.
@echo off
set FFMPEG=N:\SSD\utils\ffmpeg\ffmpeg.exe
set QAAC=N:\SSD\utils\Qaac64\qaac64.exe
md mkv
FOR /R %%I in (*.mp4) DO (
echo Input: %%I
echo Mp3: %%~pI%%~nI.mp3
echo Aac: %%~pI%%~nI.aac
echo Output: %%~pI%%~nI.mkv
"%FFMPEG%" -i "%%I" -map 0:1 -c copy "%%~pI%%~nI.mp3"
"%QAAC%" --ignorelength --adts --no-delay -V 63 -o "%%~pI%%~nI.aac" "%%~pI%%~nI.mp3"
"%FFMPEG%" -hide_banner -i "%%I" -i "%%~pI%%~nI.aac" -map 0:v:0 -vcodec copy -map 1:a:0 -acodec copy "%%~pI%%~nI.mkv"
)
pause
tebasuna51
31st August 2023, 13:06
It is running now. It'll take a while because qaac is terribly slow (5x). Not sure why.
Maybe is slow decoding mp3 (mp3 in mp4 files?)
Try decode with ffmpeg:
...
"%FFMPEG%" -i "%%I" -map 0:1 -acodec pcm_s24le "%%~pI%%~nI.wav"
"%QAAC%" --ignorelength --adts --no-delay -V 63 -o "%%~pI%%~nI.aac" "%%~pI%%~nI.wav"
...
Slogra
31st August 2023, 16:55
Thanks again.
Without the "-drc_scale 0" part, the piping works.
It's running at 12x speed now, which is a whole lot better, but still not very fast.
I'll just let it run until it's finished.
Slogra
31st August 2023, 19:52
The slowness only happens on my NAS.
I copied the files to a local drive where the Qaac speed is around 100x.
tebasuna51
1st September 2023, 00:54
Without the "-drc_scale 0" part, the piping works.
Forget warning messages, work with "-drc_scale 0", not used with mp3 audio but necesary if the audio is ac3.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.