Log in

View Full Version : Video Desync


kastro68
14th May 2003, 16:32
[sh0dan: Thread continued from here (http://forum.doom9.org/showthread.php?s=&threadid=26855)]

I just realised that the video and images have to be in the same format, either rgb or yv12 by using the convertto* function

However, another problem did arise for me. I'm not sure if it is ok to talk about this because of m$ patents, but I got lots of "video desync" being displayed when trying to add trimmed videos that include a mixture of mpg, a$f, and divx3. I opened all of them with the directshowsource function.

I'm a little embarassed to show the avs script because it is really long and there is lots of redundant lines in there that I use for checking purposes along the way, and there must be a more efficient way to do it, but here goes:



#---------------------------------

LoadPlugin("C:\PROGRA~1\GORDIA~1.27\MPEG2dec3.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ImageSequence.dll")


Clip1=directshowsource("D:\1 Music Videos\Korean\Fin.K.L\Music Videos\Feelkmtv1209.mpg").ConvertToRGB32.lanczosresize(320,240)

Clip2=directshowsource("D:\1 Music Videos\Korean\Fin.K.L\Music Videos\alwaysmp0609.mpg").ConvertToRGB32.lanczosresize(320,240)

Clip3=directshowsource("D:\1 Music Videos\Korean\Fin.K.L\Music Videos\alwayssbs0610.mpg").ConvertToRGB32.lanczosresize(320,240)

#Clip4=mpegsource("D:\1 Music Videos\Korean\Fin.K.L\Music Videos\alwayssbs0701.mpg").ConvertToRGB32.lanczosresize(320,240)

clip5=directshowsource("D:\1 Music Videos\Korean\Fin.K.L\Tv Shows\hyoleekbs030409.wmv", fps=25).ConvertToRGB32.lanczosresize(320,240)

clip6=directshowsource("D:\1 Music Videos\Korean\Fin.K.L\Tv Shows\4color_hyolee.avi", fps=30.1).ConvertToRGB32.lanczosresize(320,240)

#clip7=avisource("D:\1 Music Videos\Korean\Fin.K.L\Tv Shows\2002.03.14_talk_kmtv.avi").ConvertToRGB32.lanczosresize(320,240)

clip8=directshowsource("D:\1 Music Videos\Korean\Fin.K.L\Tv Shows\Yuri20thBirthday.asf", fps=25).ConvertToRGB32.lanczosresize(320,240)
#line20
clip9=directshowsource("D:\1 Music Videos\Korean\Fin.K.L\Tv Shows\timemachine030406.avi", fps=29.97).ConvertToRGB32.lanczosresize(320,240)

clip10=directshowsource("D:\1 Music Videos\Korean\Fin.K.L\Tv Shows\MBCsectiontv04162003_JIN.avi", fps=29.97).ConvertToRGB32.lanczosresize(320,240)

clip1s1=clip1.trim(1071,1128)
clip1s2=clip1.trim(1248,1380)
clip1s3=clip1.trim(2215,2352)
clip1s4=clip1.trim(2484,3034)
clip1s5=clip1.trim(4660,4945)
clip1s6=clip1.trim(5285,5411)
clip1s7=clip1.trim(5539,5683)
clip1s8=clip1.trim(5792,5951).Subtitle("Watch where you are going JIN!", text_color=$00FF00, x=50, y=210)
clip1s9=clip1.trim(5978,6129)




totalclip1=clip1s1+clip1s2+clip1s3+clip1s4+clip1s5+clip1s6+clip1s7+clip1s8+clip1s9

clip2s1=clip2.trim(2261,2346)
clip2s2=clip2.trim(2501,2729)
clip2s3=clip2.trim(2818,2933)
clip2s4=clip2.trim(3292,3352)
clip2s5=clip2.trim(4265,4421)
clip2s6=clip2.trim(5909,6062)


totalclip2=clip2s1+clip2s2+clip2s6+clip2s3+clip2s5+clip2s4
#return clip1s1+clip2s1


clip3s1=clip3.trim(4786,4895)


clip5s1=clip5.trim(0,130)
clip5s2=clip5.trim(670,780).Subtitle("VERY SEXY", text_color=$00FF00, x=50, y=210)
clip5s3=clip5.trim(3145,3255).Subtitle("Not too tight!", text_color=$00FF00, x=50, y=210)
clip5s4=clip5.trim(4345,4700)
clip5s5=clip5.trim(4975,5050).Subtitle("Shake that arse!", text_color=$00FF00, x=50, y=210)
clip5s6=clip5.trim(5075,5145)

totalclip5=clip5s1+clip5s2+clip5s3+clip5s4+clip5s6
#return totalclip5


clip6s1=clip6.trim(4214,4425).Subtitle("Yum!", text_color=$00FF00, x=50, y=210)
clip6s2=clip6.trim(13394,13484).Subtitle("That has got to hurt!", text_color=$00FF00, x=50, y=210)
clip6s3=clip6.trim(14448,14839)

#return clip6s2+clip6s3
#return clip6

#return totalclip1+totalclip2+totalclip5

clip8s1=clip8.trim(1975,2100)
clip8s2=clip8.trim(1975,2100).Subtitle("Muah!", text_color=$00FF00, x=50, y=210)

clip9s1=clip9.trim(16183,16264).Subtitle("Cover your breasts", text_color=$00FF00, x=50, y=210)

clip10s1=clip10.trim(5013,5200).Subtitle("Ha ha ha ha ha", text_color=$00FF00, x=50, y=210) #Yuri laughing*************9,24
clip10s2=clip10.trim(5806,5998).Subtitle("Muhahahahahahaha", text_color=$00FF00, x=50, y=210) #Yuri laughing harder****11,20
clip10s3=clip10.trim(6775,6901) #Yuri laughing her hardest ************************************************************15,29



OpenCredits1=ImageSequence("F:\AviSynth work Dir\HyoriVsYuri.bmp",0,50).ConvertToRGB32.lanczosresize(320,240)
OpenCredits2=ImageSequence("F:\AviSynth work Dir\tributesii.bmp",0,30).ConvertToRGB32.lanczosresize(320,240)
opencredits3=ImageSequence("F:\AviSynth work Dir\tributesii2.bmp",0,20).ConvertToRGB32.lanczosresize(320,240)

#ImageSequence("D:\primer.%.4d.tif",1,155,30)
#info

Opencredits=opencredits1+opencredits2+opencredits3




FinalCompilation=opencredits+clip2s1+clip1s1+clip2s3+clip1s2+clip2s6+clip1s3+clip5s1+clip1s8+clip10s1+clip5s2+clip10s2+clip5s3+clip2s4+clip5s4+clip10s3+clip3s1+clip9s1+clip8s2+clip5s5+clip10s2+clip1s4+clip2s5+clip6s2+clip10s1+clip1s5+clip5s6+clip6s1+clip1s7+clip6s3+clip10s3+clip1s9+clip2s2+clip1s6+clip1s5+clip1s5+clip8s1+OpenCredits2
return finalcompilation


#end-----------------------------------

WarpEnterprises
15th May 2003, 16:48
don't know if it solves all problems but using "+" seems not good here.
Try using "++" instead (for adding clips from different sources)

sh0dan
15th May 2003, 17:50
DirectShowSource unfortunately doesn't support seeking, so you have to access the frames from the beginning to the end.

The easiest way for this is probably to use VDub to convert the MPG to HuffYUV AVI files, and open them using AviSource (which supports seeking). That way you only have to open the WMV using DirectShowSource.


PS. I don't wanna know what those subs are for! :sly:

kastro68
15th May 2003, 19:13
Try using "++" instead (for adding clips from different sources)

Ok. I'll try this. I was using directshowsource, so I assumed that it wouldn't matter whether or not it is aligned.

----------------------------------
The easiest way for this is probably to use VDub to convert the MPG to HuffYUV AVI files, and open them using AviSource (which supports seeking).

I tried opening it with mpegsource but it didn't work. It just created a *.d2v file. In retrospect I think it is because I didn't load the plugin for mpeg1 files. Am I supposed to load the mpegdecoder.dll plugin for mpeg1 files??? Or does the mpeg2dec3.dll plugin also work for mpeg1???

-----------------------------------

PS. I don't wanna know what those subs are for!

IT IS NOT FOR PORN!!!!

Shame on you for thinking such a thing!

I'll probably upload the finished product to http://finkl.k-pops.jp/cgi/upboard/upboard.cgi server next month, once my internet speed is no longer capped at 28.8. I'll keep you informed.

------------------------------------

This clip was pretty much just an educational exercise on my part...and I am glad to say that I learnt a lot about using Avisynth. I still have much to learn, so expect lots of questions in the near future.

Thanks again.

sh0dan
15th May 2003, 20:30
In general - avoid using directshowsource as much as possible - it should be considered a "last way out".

AviSource() for AVI files.
MPEGDecoder() for MPG (MPEG 1)
Mpeg2dec3() for Mpeg 2
VFAPI (doom9's download section) for Most other sources (WMV, MOV, etc). You need to be able to load the files in TMPGEnc.

kastro68
22nd May 2003, 10:18
http://finkl.k-pops.jp/cgi/new/sr_data/sr_data/18_78_1.avi

The size is 20 megs. This server has really really really fat pipes, so if you have broadband, it won't take long to download.

You can see that it does not have any hardcore nudity as the subtitles above may suggest.

Sorry for being off topic, but I don't want to be perceived as a pervert...so i had to redeem myself.

Cheers.