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. |
22nd January 2013, 19:16 | #1 | Link |
Registered User
Join Date: Dec 2012
Posts: 6
|
video source switch based on audio
New to avisynth. So bear with me if it sounds ridiculous.
The scenario is: I have two video sources, say A and B and one sound source, say C. I would like to replace video A (VSA) with B (VSB) when there is a certain pause detected in sound track C (STC) for a certain duration and again revert back to video source A. VSA-->pause detected in STC-->replaced by VSB for certain duration or till next pause-->replaced by VSA till another pause-->and so on. I could not figure out exactly whether and how this can be achieved in avisynth? Appreciate any inputs from the avisynth veterans! Thanks in advance. /zenny |
25th January 2013, 19:54 | #2 | Link |
Guest
Join Date: Jan 2002
Posts: 21,901
|
I don't see any way to accomplish this automatically using Avisynth.
How many such switches are there in the stream? If it is just a few then you can do it manually. Can you please describe the application so we can understand the problem better? |
29th January 2013, 13:34 | #3 | Link | |
Registered User
Join Date: Dec 2012
Posts: 6
|
Quote:
If it is one I would have done it manually in an NLE. But I would like to do in a batch mode. The application is I capture two videos of the same event with two cameras in two different locations, but with only one sound input (meaning both videos share the same sound track). Let us say 100m race. I get a video stream from a camera from the rear end facing runners and another from the camera from the audience's side. Sound is recorded at the same time on a separate device. All two video input devices and sound input devices will be triggered at the same time and ends at the same time. While compositing I would like to replace the video based on sound events (like a measureable amount of pause in milliseconds) either from video from the camera opposite of the runners or from the audience's side. I ought to do that on a command line, that is why I am exploring avisynth. Somebody stated that MinMaxAudio plugin can do, but being new to avisynth, I could neither get a head nor tail of the plugin, just figured out that it is based on the frame counts. This is to produce an automated composite. I hope I made it clear of application. Last edited by zenny; 31st January 2013 at 06:04. |
|
29th January 2013, 17:41 | #5 | Link | |
Registered User
Join Date: Dec 2012
Posts: 6
|
Quote:
However, it would be nice to know how I can just composite with a random composition based on a specific duration for each video, but not ending with the side shots (video input from audience' perspective)? Any avisynth script would be appreciated. Thus, it will give me a basis of improving what I am trying to achieve. Thanks again! Last edited by zenny; 31st January 2013 at 06:05. |
|
31st January 2013, 06:03 | #7 | Link | |
Registered User
Join Date: Dec 2012
Posts: 6
|
Quote:
The sound based setup is one of the requirement for automation with avisynth script in compositing. Let us say there is a quiet pause then I just want to replace the first video with the second and vice versa. Trims is what I have been using so far without any customizations like the one I would like to achieve. Say this is one of the recipe that I want to cook in avisynth kitchen, but this 'cook' is an 'apprentice' who may spoil the 'food' without support of the avisynth 'masterchefs'! ;-) Last edited by zenny; 31st January 2013 at 07:35. |
|
31st January 2013, 15:22 | #8 | Link |
Guest
Join Date: Jan 2002
Posts: 21,901
|
I asked why the video stream switches are correlated with audio pauses. You answer that by just saying it is a requirement. I was looking for an example of content where such correlations would be expected.
Last edited by Guest; 1st February 2013 at 02:48. |
31st January 2013, 23:04 | #9 | Link |
Registered User
Join Date: Jun 2010
Posts: 11
|
Ok, this may not be exactly what you're after, but for what it's worth...
This sample uses ConditionalFilter together with the MinMaxAudio plugin to switch from clip a (black) to b (gray) when it encounters silence in the audio (after 4 sec in this case) Histogram and the AudioGraph plugin (http://avisynth.org/warpenterprises/) are used for visualisation. The drawback is of course that this operates on a per frame basis and can't take into account the length of the silence etc. Code:
LoadPlugin("MinMaxAudio.dll") LoadPlugin("AudGraph.dll") a=BlankClip(color=color_black, pixel_type="YV12") b=BlankClip(color=color_gray, pixel_type="YV12") audio=Tone(type="Sine", frequency=3, level=0.7, length=4)+Tone(type="Silence", length=2)+Tone(type="Sine", frequency=3, level=0.7, length=4) a=AudioDub(a,audio) b=AudioDub(b,audio) ConditionalFilter(a,a,b,"AudioRMS(0)", ">", "-48", show=true) Histogram(mode="AudioLevels").ConvertToRGB32().AudioGraph(10) Another approach may be to find a way to analyze your audio outside of AviSynth and use a combination of ConditionalSelect and ConditionalReader to do the actual mixing in AviSynth. |
1st February 2013, 00:13 | #10 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
You could try a 2 pass approach. The first pass writes a log of audio levels per frame. You process the log to make your decisions. The second pass acts upon your decision output to select the video view.
Pass 1 :- Code:
LoadPlugin(".....MinMaxAudio.dll") Colon=":" # Field Separator text ...Source("Video1....") AudioDub(...Source("AudioTrack....")) WriteFile("AudioLevel.log", "current_frame", "colon", "AudioRMS()") Code:
V1=...Source("Video1....") V2=...Source("Video2....") ConditionalFilter(V1, V1, V2, "ChoiceVar", "equals", "1") # Select Video based on ChoiceVar ConditionalReader ("Choice.Log", "ChoiceVar") # Load ChoiceVar table AudioDub(...Source("AudioTrack....")) # Add Audio |
1st February 2013, 04:40 | #11 | Link | |
Registered User
Join Date: Jul 2003
Location: India
Posts: 890
|
Quote:
I have actually coded a special plugin for the purpose and is in testing phase. If I find it is satisfactory atleast in carefully prepared synthetic environment I will release it. How far it will be useful users need to judge. |
|
1st February 2013, 08:13 | #12 | Link |
Registered User
Join Date: Dec 2012
Posts: 6
|
Kudos to Helpful Members in this List!
@IanB and @SirBlunderBrain:
Thank you for your inputs. They are extremely helpful to explore. I shall try and let you know how it goes. @vcmohan: Thanks for your efforts to create a plugin, it would be extremly useful and helpful. Look forward to! You all are such a wonderful bunch of helpful people. Appreciate it! |
Thread Tools | Search this Thread |
Display Modes | |
|
|