ffmpeg-go icon indicating copy to clipboard operation
ffmpeg-go copied to clipboard

Concat + Audio missing.

Open kishorevaishnav opened this issue 2 years ago • 1 comments

@u2takey For some reason, the audio is getting lost during concat.

I tried the example you mentioned here and lost the audio completely on the concat.mp4 even though I had perfect audio on the two files.

Here is my version of the code, still the audio is not working - note the Video is completely fine:

// Lets concate everything.
finalFiles := []*ffmpeg.Stream{}
for _, file := range listFiles() {
	finalFiles = append(finalFiles, ffmpeg.Input(file.Name()))
}

ffmpeg.Concat(finalFiles).
	Output("w_final.mp4").
	OverWriteOutput().
	ErrorToStdOut().
	Run()

If I modify the command output (by adding :a=1) & execute on command line it works perfectly fine: ffmpeg -i ./w_one.mp4 -i ./w_two.mp4 -i ./w_three.mp4 -filter_complex "[0][1][2]concat=n=3[s0]" -map "[s0]" ./concat.mp4 -y to ffmpeg -i ./w_one.mp4 -i ./w_two.mp4 -i ./w_three.mp4 -filter_complex "[0][1][2]concat=n=3:a=1[s0]" -map "[s0]" ./concat.mp4 -y

Please let me know where to add these parameter to make it work? Though I tried this below and it doesn't work, instead it throws an error

ffmpeg.Concat(finalFiles, ffmpeg.KwArgs{"a": "1"}).

Error:

panic: interface conversion: interface {} is string, not int

goroutine 1 [running]:
github.com/u2takey/ffmpeg-go.Concat({0x140000d2ea0, 0x3, 0x4}, {0x1400019fdf0, 0x1, 0x100e84ee8?})
        /Users/kishore/go/pkg/mod/github.com/u2takey/[email protected]/filters.go:108 +0x2d0
main.main()
        /Users/kishore/proj/github.com/kishorevaishnav/hotbrain/main.go:120 +0x158
exit status 2

kishorevaishnav avatar Apr 24 '22 02:04 kishorevaishnav

Hello,

Maybe take a look at this issue #39 , hope this will help :smile:

Tnemlec avatar Jun 08 '22 14:06 Tnemlec