-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgimmeasec.bat
37 lines (32 loc) · 1.04 KB
/
gimmeasec.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
: Add one second of silence to an audio file
: Author: Ellery Chan <[email protected]>
: Date: 28-JUN-2022
: Copyright (c) 2022 Ellery Chan
@echo off
setlocal enabledelayedexpansion
: Add one second of silence to the beginning of an audio file
: Usage: gimmeasec <audio_file>
:
: Example: gimmeasec song.mp3
: - creates song_1s.mp3
: - does not modify song.mp3
set FFMPEG="c:\Program Files\ffmpeg\bin\ffmpeg.exe"
: Get the command line arg count
set argc=0
for %%x in (%*) do set /A argc+=1
: Print the usage if wrong number of args
if %argc% equ 0 (
echo Usage: gimmeasec audio_file
echo.
echo Example: gimmeasec song.mp3
echo - creates song_1s.mp3
echo - does not modify song.mp3
exit /b 1
)
for %%f in (%*) do (
: set audio_file=%%f
set audio_file_dir=%%~pf
set audio_file_no_ext=%%~nf
set audio_file_ext=%%~xf
%FFMPEG% -i "!audio_file_dir!!audio_file_no_ext!!audio_file_ext!" -af "adelay=1s:all=true" "!audio_file_dir!!audio_file_no_ext!_1s!audio_file_ext!"
)