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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 4th March 2015, 17:06   #1  |  Link
Kein
Registered User
 
Kein's Avatar
 
Join Date: Mar 2010
Posts: 79
Joining 2 AVS scripts and one base vide through FFMPEGS2 in a consistent colorspace

Items:
* 1 script that generates 5 seconds title with static image, converts output in YV12
* 1 base lossless AVI recording in YV12
* 1 script that generates 5 seconds ending with static image, converts output in YV12

Target:
Merge all 3 in order with aligned space so the lack of audio will be filled with silence as per "AlignedSplice" specs.

Code:
a = FFAudioSource("base.avi")
v = FFVideoSource("base.avi")
z = AudioDub(v, a)
Crop(z,0, 96, -0, -96)
Lanczos4Resize(z,1280, 720)
# start
titlev = AviSource("able-title.avs")
titlea = BlankClip(titlev, audio_rate=48000)
y = AudioDub(titlev, titlea)

# end
endv = AviSource("able-end.avs")
enda = BlankClip(titlev, audio_rate=48000)
x = AudioDub(endv, enda)

AlignedSplice(y,z,x)
What's wrong? Resolution matches, colrospace too.
Kein is offline   Reply With Quote
Old 4th March 2015, 17:27   #2  |  Link
BakaProxy
Registered User
 
Join Date: Jan 2015
Posts: 47
So what error is it giving?
U can also just do like so "x ++ y ++ z" instead of using the function it's pretty much the sama afaik but a lot more clean.
BakaProxy is offline   Reply With Quote
Old 4th March 2015, 17:30   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Taking a guess at what you are trying to do
Code:
a = FFAudioSource("base.avi")
v = FFVideoSource("base.avi")
z = AudioDub(v, a).Crop(0, 96, -0, -96).Lanczos4Resize(1280, 720).Trim(0,0)

# start
y = AviSource("able-title.avs").ResampleAudio(48000).Trim(0,0)

# end
x = AviSource("able-end.avs").ResampleAudio(48000).Trim(0,0)

AlignedSplice(y,z,x)    # Same as y++z++x
If that dont work, try comment out last line and do a
Code:
return y.Info # same for z and x to see framerate etc
Edit:
Code:
a = FFAudioSource("base.avi")
v = FFVideoSource("base.avi")
z = AudioDub(v, a)
Crop(z,0, 96, -0, -96)                              #
Lanczos4Resize(z,1280, 720)                         # Result implicitly assigned to Last clip (NOT z)
# start
titlev = AviSource("able-title.avs")
titlea = BlankClip(titlev, audio_rate=48000)        #
y = AudioDub(titlev, titlea)                        # You just killed off original audio (if there was any)

# end
endv = AviSource("able-end.avs")
enda = BlankClip(titlev, audio_rate=48000)          #
x = AudioDub(endv, enda)                            # You just killed off original audio (if there was any)

AlignedSplice(y,z,x)                                # z not cropped nor resized
__________________
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; 4th March 2015 at 17:43.
StainlessS is offline   Reply With Quote
Old 4th March 2015, 17:30   #4  |  Link
BakaProxy
Registered User
 
Join Date: Jan 2015
Posts: 47
Oh nvm I see what ur doing wrong: you're calling the z variable from befote u reszised and cropped.
write "last" instead of z or save the crop and resize again in the z variable
BakaProxy is offline   Reply With Quote
Old 4th March 2015, 17:33   #5  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
blankclip() 's audio is mono by default

stereo=true

Or if you use blankclip(z) , it will automatically take on the characteristics of video "z", including audio sample rate, fps, dimensions etc...
poisondeathray is offline   Reply With Quote
Old 4th March 2015, 17:39   #6  |  Link
Kein
Registered User
 
Kein's Avatar
 
Join Date: Mar 2010
Posts: 79
Thanks for the suggestions, I figured out what caused issue:

Quote:
video = ImageSource("able-title.png", end = 150, fps=30, use_DevIL=true, pixel_type="RGB24")
videoyuv = ConvertToYV12(video)
audio = BlankClip(videoyuv, audio_rate=48000, sample_type=16bit, channels=2)
AudioDub(videoyuv, audio)
AviSynth is unable to return anything in this case for some reason. Even if I call AVS that generates clip as separate source in top-level script and then do the dub it still unable to render it with audio properly (no render, just error opening).

Any workarounds for what I want?
Kein is offline   Reply With Quote
Old 4th March 2015, 17:41   #7  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
You'll probably also have to specify the color space for blankclip (pixel_type="YV12"). Default is RGB32.
Groucho2004 is offline   Reply With Quote
Old 4th March 2015, 17:44   #8  |  Link
Kein
Registered User
 
Kein's Avatar
 
Join Date: Mar 2010
Posts: 79
Quote:
Originally Posted by Groucho2004 View Post
You'll probably also have to specify the color space for blankclip (pixel_type="YV12"). Default is RGB32.
Nope, no effect. Don't think it matters since I join already prepared YV12 video stream to audio stream, the blank one being replaced.
Kein is offline   Reply With Quote
Old 4th March 2015, 17:47   #9  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
Quote:

Quote:
video = ImageSource("able-title.png", end = 150, fps=30, use_DevIL=true, pixel_type="RGB24")
videoyuv = ConvertToYV12(video)
audio = BlankClip(videoyuv, audio_rate=48000, sample_type=16bit, channels=2)
AudioDub(videoyuv, audio)


16bit has to be in quotes

audio = BlankClip(videoyuv, audio_rate=48000, sample_type="16bit", channels=2)
poisondeathray is offline   Reply With Quote
Old 4th March 2015, 17:49   #10  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Also, Avisynth throws an error if something doesn't match when using AlignedSplice. Why can't you post the errors?
Groucho2004 is offline   Reply With Quote
Old 4th March 2015, 17:50   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
My mistake, start and end are already silent. Below revised.
Code:
a = FFAudioSource("base.avi")
v = FFVideoSource("base.avi")
z = AudioDub(v, a).Crop(0, 96, -0, -96).Lanczos4Resize(1280, 720).Trim(0,0)

# start
titlev = AviSource("able-title.avs")
titlea = BlankClip(titlev, audio_rate=48000,  channels=2) # Stereo deprecated, changed to channels=2
y = AudioDub(titlev, titlea)

# end
endv = AviSource("able-end.avs")
enda = BlankClip(titlev, audio_rate=48000,  channels=2)
x = AudioDub(endv, enda)

y++z++x
EDIT: Ooo, lots of of posts. 16bit is default.
__________________
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; 4th March 2015 at 18:03.
StainlessS is offline   Reply With Quote
Old 4th March 2015, 17:59   #12  |  Link
Kein
Registered User
 
Kein's Avatar
 
Join Date: Mar 2010
Posts: 79
Dammit, I hate inconsistent AviSynth syntax. Thanks, poisondeathray, it works.

Quote:
Originally Posted by Groucho2004 View Post
Also, Avisynth throws an error if something doesn't match when using AlignedSplice. Why can't you post the errors?
No errors were returned in my case. Tested with Vdub.

StainlessS
This looks much cleaner than my monster, cheers. What is additional Trim() for? To get rid of possible overhead?

Last edited by Kein; 4th March 2015 at 18:02.
Kein is offline   Reply With Quote
Old 4th March 2015, 18:06   #13  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Trim(0,0) just ensures audio same length as clip (for aligned splice), chops off excess or pads audio to video length.

EDIT: Note the edit in post #3, ie "# z not cropped nor resized".
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 4th March 2015, 18:11   #14  |  Link
Kein
Registered User
 
Kein's Avatar
 
Join Date: Mar 2010
Posts: 79
Now that you mentioned it I have follow-up question: what if, or example, I don't need full base.avi but rather just specific range, starting from 00:01:00 to 00:15:00, or even few segments joined: xx:xx:xx-yy:yy:yy and aa:aa:aa-bb:bb:bb. is there anything I should keep in mind to avoid overstretched audio, delay/desync in audio?

Quote:
Originally Posted by StainlessS View Post
EDIT: Note the edit in post #3, ie "# z not cropped nor resized".
Yep, BakaProxy mentioned that too, I took it into account later. Original audio never existed in a first place and I used the advice of poisondeathray in post #5 to refer to processed "z" for audiospecs.

Last edited by Kein; 4th March 2015 at 18:14.
Kein is offline   Reply With Quote
Old 4th March 2015, 18:19   #15  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Just trim will do, specifying frame numbers rather than time.
Code:
 T1=Trim(1000,1999)
 T2=Trim(3000,3999)
 TTOT = T1 ++ T2       # or whatever
__________________
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 ???
StainlessS is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:05.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.