BlockABoots
13th September 2018, 18:55
I have to clips that i trying to merge but im getting an error message, 'the number of audio channels does not match'. How do i fix this please?
Here is my script...
video=FFMpegSource2("F:\Video Captures\2018-09-12 21-20-13.mkv",atrack=-1) +FFMpegSource2("F:\Video Captures\2018-09-13 00-27-08.flv",atrack=-1)
video1=DelayAudio(video,0.0)
video2=trim(video1,1,6497).fadeout(25) +trim(video1,6497,9289).fadein(25)
video3=fadein(video2,40).fadeout(40)
video4=tweak(video3,sat=1.1,bright=10,cont=1.0)
video5=amplifydb(video,-12.0)
return video5
StainlessS
13th September 2018, 19:38
Most of your script is not part of the problem. Only the first line.
Get 1st clip and add line
Return Info
Do same for 2nd clip.
Post details.
Mobile
EDIT: BlockaBoots, you really need to start paying attention, when (I'm assuming) that it says error on line 1, (because you dont say),
you have to sort that out before posting loads of rubbish after that.
FranceBB
16th September 2018, 06:15
@BlockABoots...
Remember that Avisynth is a frame-server, so it will output an uncompressed audio/video stream and it has to be consistent.
What you are looking for is called "append". Many people do it on a daily basis, but... there's a catch: in order to append files together, they have to be at the same resolution, in the same color space, at the same frame-rate, at the same bit-depth, with the same number of audio channels and at the same sample rate.
Simple example (video1 and video2 are shot the same way):
video=FFVideoSource("video.mkv")
audio=FFAudioSource("video.mkv")
AudioDub(video, audio)
video1=last
video=FFVideoSource("video2.mkv")
audio=FFAudioSource("video2.mkv")
AudioDub(video, audio)
video2=last
video1++video2
This way video1 and video2 are gonna be one after another.
After you used the append function, which is "video1++video2", anything you do after that line is gonna apply to the sequence.
Now, let's suppose that video1 and video2 are different:
Video1 is: 1280x720, 23.976fps, YUY2, 1CH. 44100Hz, progressive, 8bit.
Video2 is 1920x1080, 29.970fps, yv12, 2CH. 48000Hz, progressive, 8bit.
video=FFVideoSource("video.mkv")
audiook=FFAudioSource("video.mkv")
audio=MergeChannels(audiook, audiook)
AudioDub(video, audio)
Converttoyv12()
ResampleAudio(48000)
ConvertFPS(29.970)
Spline64Resize(1920, 1080)
video1=last
video=FFVideoSource("video2.mkv")
audio=FFAudioSource("video2.mkv")
AudioDub(video, audio)
video2=last
video1++video2
In other words, you gotta make sure that videos are at the same resolution, in the same color space, at the same frame-rate, at the same bit-depth, with the same number of audio channels and at the same sample rate before you "append" them together.
Just use mediainfo to check their specs and make the right adjustments to make them match.
the number of audio channels does not match.
One of your videos has more audio channels than the other, you can use "mergechannels" to make them match just like in the example I posted above.
hello_hello
16th September 2018, 17:28
I prefer to add empty channels, so to borrow FranceBB's method and offer a variation.
If the first video has 5.1ch audio and and the second has stereo, you can add empty channels to the second to make it 5.1ch. And if the 5.1ch audio happened to be 44100k and the stereo audio is 48000k (not likely, but possible)....
video = FFVideoSource("video.mkv")
audio = FFAudioSource("video.mkv").ResampleAudio(48000)
AudioDub(video, audio)
video1 = last
video = FFVideoSource("video2.mkv")
TwoChannels = FFAudioSource("video2.mkv")
FourEmptyChannels = BlankClip(TwoChannels, channels=4)
SixChannels = MergeChannels(TwoChannels, FourEmptyChannels)
AudioDub(video, SixChannels)
video2 = last
video1++video2
If you have ffdshow installed you can decode the audio via directshow and add channels by selecting the required format with ffdshow's Mixer filter.
Or you can do it the other way around and downmix the multichannel audio so they're both stereo.
StainlessS
16th September 2018, 20:00
Myself, I have little use for more than two channels,
I tend to use this a lot (via some other script), to turn everything into stereo, 44.1KHz.
Function FAVCStereo(clip Video, clip Audio) {
Dubbed = Video
Chan0 = (HasAudio(Audio)==False) ? AudioDub(Video, BlankClip(Video, audio_rate=48000, stereo=true)) : nop()
Dubbed = (HasAudio(Audio)==False) ? Chan0 : Dubbed
Audio = (HasAudio(Audio)==True) ? ConvertAudioToFloat(Audio) : Audio
Chan1 = (AudioChannels(Audio)==1) ? Audiodub(Video, GetChannel(Audio, 1, 1)) : nop()
Dubbed = (AudioChannels(Audio)==1) ? Chan1 : Dubbed
Chan2 = (AudioChannels(Audio)==2) ? Audiodub(Video, Audio) : nop()
Dubbed = (AudioChannels(Audio)==2) ? Chan2 : Dubbed
FrontLeft = (AudioChannels(Audio)==3) ? MixAudio(GetChannel(Audio, 1), GetChannel(Audio, 2), 0.5, 0.5) : nop()
FrontRight = (AudioChannels(Audio)==3) ? MixAudio(GetChannel(Audio, 3), GetChannel(Audio, 2), 0.5, 0.5) : nop()
Chan3 = (AudioChannels(Audio)==3) ? Audiodub(Video, MergeChannels(FrontLeft, FrontRight)) : nop()
Dubbed = (AudioChannels(Audio)==3) ? Chan3 : Dubbed
TotalLeft = (AudioChannels(Audio)==4) ? MixAudio(GetChannel(Audio, 1), GetChannel(Audio, 3), 0.5, 0.5) : nop()
TotalRight = (AudioChannels(Audio)==4) ? MixAudio(GetChannel(Audio, 2), GetChannel(Audio, 4), 0.5, 0.5) : nop()
Chan4 = (AudioChannels(Audio)==4) ? Audiodub(Video, MergeChannels(TotalLeft, TotalRight)) : nop()
Dubbed = (AudioChannels(Audio)==4) ? Chan4 : Dubbed
FrontLeft = (AudioChannels(Audio)==5) ? MixAudio(GetChannel(Audio, 1), GetChannel(Audio, 2), 0.3694, 0.2612) : nop()
FrontRight = (AudioChannels(Audio)==5) ? MixAudio(GetChannel(Audio, 3), GetChannel(Audio, 2), 0.3694, 0.2612) : nop()
TotalLeft = (AudioChannels(Audio)==5) ? MixAudio(FrontLeft, GetChannel(Audio, 4), 1, 0.3694) : nop()
TotalRight = (AudioChannels(Audio)==5) ? MixAudio(FrontRight, GetChannel(Audio, 5), 1, 0.3694) : nop()
Chan5 = (AudioChannels(Audio)==5) ? Audiodub(Video, MergeChannels(TotalLeft, TotalRight)) : nop()
Dubbed = (AudioChannels(Audio)==5) ? Chan5 : Dubbed
BackLeft = (AudioChannels(Audio)>=6) ? MixAudio(GetChannel(Audio, 4), GetChannel(Audio, 6), 0.2698, 0.2698) : nop()
BackRight = (AudioChannels(Audio)>=6) ? MixAudio(GetChannel(Audio, 5), GetChannel(Audio, 6), 0.2698, 0.2698) : nop()
FrontLeft = (AudioChannels(Audio)>=6) ? MixAudio(GetChannel(Audio, 1), GetChannel(Audio, 2), 0.2698, 0.1906) : nop()
FrontRight = (AudioChannels(Audio)>=6) ? MixAudio(GetChannel(Audio, 3), GetChannel(Audio, 2), 0.2698, 0.1906) : nop()
TotalLeft = (AudioChannels(Audio)>=6) ? MixAudio(FrontLeft, BackLeft, 1, 1) : nop()
TotalRight = (AudioChannels(Audio)>=6) ? MixAudio(FrontRight, BackRight, 1, 1) : nop()
Chan6 = (AudioChannels(Audio)>=6) ? Audiodub(Video, MergeChannels(TotalLeft, TotalRight)) : nop()
Dubbed = (AudioChannels(Audio)>=6) ? Chan6 : Dubbed
# Dubbed = (HasAudio(Audio)==True) ? Normalize(Dubbed) : Dubbed
# Dubbed = (HasAudio(Audio)==True) ? SSRC(Dubbed, 48000) : Dubbed
Dubbed = (HasAudio(Audio)==True) ? ConvertAudioTo16bit(Dubbed) : Dubbed
return(Dubbed)
}
Function FAVCStereoDSS(clip Video, clip Audio) {
Dubbed = Video
Chan0 = (HasAudio(Audio)==False) ? AudioDub(Video, BlankClip(Video, audio_rate=48000, stereo=true)) : nop()
Dubbed = (HasAudio(Audio)==False) ? Chan0 : Dubbed
Audio = (HasAudio(Audio)==True) ? ConvertAudioToFloat(Audio) : Audio
Chan1 = (AudioChannels(Audio)==1) ? Audiodub(Video, GetChannel(Audio, 1, 1)) : nop()
Dubbed = (AudioChannels(Audio)==1) ? Chan1 : Dubbed
Chan2 = (AudioChannels(Audio)==2) ? Audiodub(Video, Audio) : nop()
Dubbed = (AudioChannels(Audio)==2) ? Chan2 : Dubbed
FrontLeft = (AudioChannels(Audio)==3) ? MixAudio(GetChannel(Audio, 1), GetChannel(Audio, 3), 0.5, 0.5) : nop()
FrontRight = (AudioChannels(Audio)==3) ? MixAudio(GetChannel(Audio, 2), GetChannel(Audio, 3), 0.5, 0.5) : nop()
Chan3 = (AudioChannels(Audio)==3) ? Audiodub(Video, MergeChannels(FrontLeft, FrontRight)) : nop()
Dubbed = (AudioChannels(Audio)==3) ? Chan3 : Dubbed
TotalLeft = (AudioChannels(Audio)==4) ? MixAudio(GetChannel(Audio, 1), GetChannel(Audio, 3), 0.5, 0.5) : nop()
TotalRight = (AudioChannels(Audio)==4) ? MixAudio(GetChannel(Audio, 2), GetChannel(Audio, 4), 0.5, 0.5) : nop()
Chan4 = (AudioChannels(Audio)==4) ? Audiodub(Video, MergeChannels(TotalLeft, TotalRight)) : nop()
Dubbed = (AudioChannels(Audio)==4) ? Chan4 : Dubbed
FrontLeft = (AudioChannels(Audio)==5) ? MixAudio(GetChannel(Audio, 1), GetChannel(Audio, 3), 0.3694, 0.2612) : nop()
FrontRight = (AudioChannels(Audio)==5) ? MixAudio(GetChannel(Audio, 2), GetChannel(Audio, 3), 0.3694, 0.2612) : nop()
TotalLeft = (AudioChannels(Audio)==5) ? MixAudio(FrontLeft, GetChannel(Audio, 4), 1, 0.3694) : nop()
TotalRight = (AudioChannels(Audio)==5) ? MixAudio(FrontRight, GetChannel(Audio, 5), 1, 0.3694) : nop()
Chan5 = (AudioChannels(Audio)==5) ? Audiodub(Video, MergeChannels(TotalLeft, TotalRight)) : nop()
Dubbed = (AudioChannels(Audio)==5) ? Chan5 : Dubbed
BackLeft = (AudioChannels(Audio)>=6) ? MixAudio(GetChannel(Audio, 5), GetChannel(Audio, 4), 0.2698, 0.2698) : nop()
BackRight = (AudioChannels(Audio)>=6) ? MixAudio(GetChannel(Audio, 6), GetChannel(Audio, 4), 0.2698, 0.2698) : nop()
FrontLeft = (AudioChannels(Audio)>=6) ? MixAudio(GetChannel(Audio, 1), GetChannel(Audio, 3), 0.2698, 0.1906) : nop()
FrontRight = (AudioChannels(Audio)>=6) ? MixAudio(GetChannel(Audio, 2), GetChannel(Audio, 3), 0.2698, 0.1906) : nop()
TotalLeft = (AudioChannels(Audio)>=6) ? MixAudio(FrontLeft, BackLeft, 1, 1) : nop()
TotalRight = (AudioChannels(Audio)>=6) ? MixAudio(FrontRight, BackRight, 1, 1) : nop()
Chan6 = (AudioChannels(Audio)>=6) ? Audiodub(Video, MergeChannels(TotalLeft, TotalRight)) : nop()
Dubbed = (AudioChannels(Audio)>=6) ? Chan6 : Dubbed
# Dubbed = (HasAudio(Audio)==True) ? Normalize(Dubbed) : Dubbed
# Dubbed = (HasAudio(Audio)==True) ? SSRC(Dubbed, 48000) : Dubbed
Dubbed = (HasAudio(Audio)==True) ? ConvertAudioTo16bit(Dubbed) : Dubbed
return(Dubbed)
}
Think maybe got it from here:- https://forum.doom9.org/showthread.php?t=106677&highlight=favc
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.