View Full Version : ImageSource Audio sync never works
jsada
24th January 2006, 21:54
video = AviSource("C:\video\dv_video.avi")
image = ImageSource("C:\MyPics\100405\IMG_%d.JPG",2074,2195,29.97).LanczosResize(720,480)
audio = BlankClip(image, audio_rate=Audiorate(video), stereo=true)
pics = AudioDub(image, audio)
return pics++video
Afer innumerable tries, I am almost ready to give up Images before Video.
Everytime I try the above with many more iterations (trim, length, etc.),
either Audio starts during Images display or there is black screen after
Images.
My goal is Subtitle Screen followed by Images followed by DV video.
TIA,
jsada
jsada
25th January 2006, 03:45
OK here is the code I am trying,
blank = BlankClip(length=220, width=720, height=480, pixel_type="RGB24", fps=29.97, audio_rate=48000, stereo=true, sixteen_bit=true)
Tag = Subtitle(blank, "Railway Museum", 200, 200, 0, 220, "Arial", 50 ,$FF22EE)
railt = Dissolve(blank, Tag, 48)
clip1 = AviSource("E:\AUGSEP05\scene'20050911 09.01.23.avi").AssumeFPS(29.97)
rail = ImageSource("D:\My Pictures\RailMuseum\IMG_1%02d.JPG",731,1760,Framerate(clip1)).LanczosResize(720,480).ConvertToRGB24
audio = BlankClip(rail, audio_rate=Audiorate(clip1), stereo=true)
rail = AudioDub(rail, audio)
rail = rail.trim(0,900)
return railt++rail++clip1
Wilbert
25th January 2006, 10:27
video = AviSource("C:\video\dv_video.avi")
frate = video.framerate
image = ImageSource("C:\MyPics\100405\IMG_%d.JPG",2074,2195,frate).LanczosResize(720,480)
audio = BlankClip(video).Crop(0,image.framecount-1) # get all audio properties from video
pics = AudioDub(image, audio)
return pics++video
What happens with the script above? Is it the sync or black frames problem? I assume you are using avs v2.56?
jsada
25th January 2006, 18:14
Still out of Sync, Audio from AVI starts at last few pictures.
AviSynth - 2.56
I suppose you meant trim not crop at,
audio = BlankClip(video).trim(0,image.framecount-1) # get all audio properties from video
Wilbert
26th January 2006, 11:07
Ok. As a last check, do you have any sync problems when putting black frames before the video:
video = AviSource("C:\video\dv_video.avi")
pics = BlankClip(video).Trim(0, 121) # get all audio properties from video
pics++video
jsada
27th January 2006, 02:25
Nope. No audio during blank clip.
Do I need to add Images? Since when Images appear they are at much
slower rate than 29.97 fps. Its almost like each Image is there for 1 sec.
Is there any compensation routine required to bring it in Sync.
Thanks.
Wilbert
27th January 2006, 10:38
Do I need to add Images? Since when Images appear they are at much slower rate than 29.97 fps.
Sounds like a bug, try
video = AviSource("C:\video\dv_video.avi")
image = ImageSource("C:\MyPics\100405\IMG_%d.JPG",2074,2195).LanczosResize(720,480)
image = image.AssumeFPS(video)
audio = BlankClip(video).Trim(0,image.framecount-1) # get all audio properties from video
pics = AudioDub(image, audio)
return pics++video
Now, pics should have the same framerate as video.
jsada
28th January 2006, 22:54
Same result.
It almost seems like I need to compensate for the slow speed of ImageSource
pictures. Where as FrameRate is near 30 fps, it actually displayed at 1 fps.
If it is bug, is there any way to work on this fix?
sixtydeuce
29th January 2006, 03:02
Hi. I'm trying to basically do the same thing. I can get the blank video before my episode starts. But I can't seem to but an image in front. I get errors like splice video formats don't match. It seems like it would be simple, but... Thanks in advance for helping!
Richard Berg
29th January 2006, 05:35
I still don't understand the problem. Are you trying to play the script in realtime?
Wilbert
29th January 2006, 17:30
Richard, his problem is that the audio (corresponding to video) starts to early (when displaying the last few images in pics). Happens when playing the resulting encoding.
Haven't checked it myself yet.
Wilbert
29th January 2006, 17:31
@sixtydeuce,
You have a different problem. Please post your script and the exact error.
jsada
29th January 2006, 22:17
I am running the script in realtime.
I have tried various players (VirtualDub 1.6.10, Zoom Player) to no avail.
Anytime I put ImageSource ahead of AviSource, the audio goes out of sync.
With just Subtitle(Blankclip) in front of AviSource, the audio is fine.
When you run a clip created with many images from ImageSource, you can
see the images moving slowly (I suppose time taken to render the image).
But since the Audio from corresponding BlankClip is moving at its required
audiorate, subsequent audio (from next clip) starts before all the images are
complete. It almost seems like you have to come up with formula to increase
the length of audio, to compensate for slow images.
AlignedSplice also doesn't seem to help, as it is supposed to keep audio in sync.
Sixtyduece: You need to account for all aspects of Video to match, like,
video = AviSource("C:\video\dv_video.avi")
image = ImageSource("C:\MyPics\IMG_%d.JPG",1,100,video.framerate).LanczosResize(720,480).AssumeFPS(video)
audio = BlankClip(video).Trim(0,image.framecount-1) # get all audio properties from video
pics = AudioDub(image, audio)
return pics++video
Richard Berg
30th January 2006, 05:06
Does the problem still happen if you render out the script instead of playing in realtime? From everything I've read so far, it sounds like a simple problem of cpu/disk being too slow to stream 30 individual JPEG files per second.
sixtydeuce
31st January 2006, 04:41
Hi guys! Thanks for trying to help. I had made an image in photoshop with some notes for the viewer. And what I was trying to do was to put that image in front of the actual episode and let it run for about 10 seconds. Well a guy in another forum helped me and he came up with this and it worked.
avisource("c:\ep18.avi")
LanczosResize(720,480)
AssumeFPS(23.976)
episode = last
ImageSource("C:\splash18.jpg",end=350,fps=23.976).ConvertToYV12()
audiodub(last, blankclip(episode,length=350))
fadein(50)
fadeout(75)
last++episode
Now my next question is can I take that image, put some audio on it, and play it before a clip or an episode? Thanks for your time!
Richard Berg
31st January 2006, 06:45
Sure. Instead of AudioDub(last, blankclip), do AudioDub(last, WavSource("file.wav"))
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.