Created
April 17, 2019 22:09
-
-
Save cskonopka/8d8a6a5c54c463be750df09cc1934ac1 to your computer and use it in GitHub Desktop.
Use ffmpeg to sequentially overlay a folder of audio files
This file contains 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
package main | |
import ( | |
"fmt" | |
"os/exec" | |
"strconv" | |
) | |
func main() { | |
countdown(4) | |
} | |
func countdown(seconds int) { | |
if seconds == 0 { | |
fmt.Println("Complete!") | |
} else { | |
nextCount := seconds - 1 | |
wav1 := strconv.Itoa(seconds) + ".wav" | |
wav2 := strconv.Itoa(nextCount) + ".wav" | |
newWav := "newwav" + strconv.Itoa(nextCount) + ".wav" | |
fmt.Println(wav1) | |
fmt.Println(wav2) | |
fmt.Println(newWav) | |
cmd2 := exec.Command( | |
"ffmpeg", | |
"-y", | |
"-i", | |
wav1, | |
"-i", | |
wav2, | |
"-filter_complex", | |
"[0:0][1:0] amix=inputs=2:duration=longest", | |
"-c:a", | |
"libmp3lame", | |
newWav, | |
) | |
cmd2.Start() | |
countdown(nextCount) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment