Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
25th November 2021, 20:57 | #1 | Link |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
|
GetChannels() wants a series of integers?
If I do something like:
Code:
ColorBars(848, 480, pixel_type="YV12") GetChannels(1,2,2) Now, if I declare this function: Code:
function mylist(int n, string "s") { s = default(s, "") return (n > 0) ? mylist(n - 1, String(n) + "," + s) \ : s } Code:
ColorBars(848, 480, pixel_type="YV12") clip1_channels=(HasAudio) ? (AudioChannels) : 0 clip1_channels_list=mylist(clip1_channels) + String(clip1_channels) MessageClip(clip1_channels_list) however if I try to use the variable I've just got with 1,2,2 inside GetChannels() it doesn't work: Code:
ColorBars(848, 480, pixel_type="YV12") clip1_channels=(HasAudio) ? (AudioChannels) : 0 clip1_channels_list=mylist(clip1_channels) + String(clip1_channels) GetChannels(clip1_channels_list) Script error: Invalid arguments to function 'GetChannels'. p.s the reason I brought this up is because I'm trying to write a function that takes two inputs, clip1 and clip2, uses the video from clip1 and the audio from clip1 and uses mergechannels to append the channels from clip2 to clip1. The user is gonna have two more parameters: InsertAt and DeleteCount. The first, InsertAt, allows the user to choose after which channel of the clip1 the audio from clip2 is inserted. DeleteCount instead allows the user to delete a certain channel he specifies from clip1. I was writing the basics but the aforementioned issue came up... Code:
function InsertExternalAudio(clip clp1, clip clp2) { clip1_channels=(clp1.HasAudio) ? (clp1.AudioChannels) : 0 clip2_channels=(clp2.HasAudio) ? (clp2.AudioChannels) : 0 my_clip1=(clip1_channels>0) ? clp1.ResampleAudio(48000).ConvertAudioToFloat() : clp1 my_clip2=(clip2_channels>0) ? clp2.ResampleAudio(48000).ConvertAudioToFloat() : clp2 clip1_channels_list=mylist(clip1_channels) + String(clip1_channels) clip2_channels_list=mylist(clip2_channels) + String(clip2_channels) audio1=GetChannels(my_clip1, clip1_channels_list) audio2=GetChannels(my_clip2, clip2_channels_list) video=clp1.KillAudio() audio=MergeChannels(audio1, audio2) AudioDub(video, audio) } Last edited by FranceBB; 25th November 2021 at 21:29. |
26th November 2021, 06:37 | #2 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
I just popped by before I went to bed [05:32], and have done little more than glance at less than half of your post,
but methinks that [4th code block] Code:
GetChannels(clip1_channels_list) Code:
Eval ( "GetChannels(" + clip1_channels_list + ")" )
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 26th November 2021 at 06:40. |
26th November 2021, 10:54 | #3 | Link |
Banana User
Join Date: Sep 2008
Posts: 989
|
I dunno what GetChannels is, but your current mylist() could be replaced with something like this [how many channels there can be?]:
Code:
if (clip1_channels == 0) { audio1=GetChannels(my_clip1, 0) } else if (clip1_channels == 1) { audio1=GetChannels(my_clip1, 1,1) } else if (clip1_channels == 2) { audio1=GetChannels(my_clip1, 1,2,2) } else if (clip1_channels == 3) { audio1=GetChannels(my_clip1, 1,2,3,3) } else if (clip1_channels == 4) { audio1=GetChannels(my_clip1, 1,2,3,4,4) } else if (clip1_channels == 5) { audio1=GetChannels(my_clip1, 1,2,3,4,5,5) }
__________________
InpaintDelogo, DoomDelogo, JerkyWEB Fixer, Standalone Faster-Whisper - AI subtitling Last edited by VoodooFX; 26th November 2021 at 11:01. |
Thread Tools | Search this Thread |
Display Modes | |
|
|