PDA

View Full Version : Combining Video w/o audio with Vidoe w/ audio.


Zer0Her0
20th September 2007, 17:37
Hey everyone,

I am trying to combine 3 videos clips, the leader and trailer lack audio, the content has audio and I'm getting a variety of errors, I pretty much not sure how to proceed. Here is my butchered script(hey I'm a media artist not a programmer):


# Created by AVSEdit

src = DirectShowSource("c:\lgmp\capture\test2.avi")

logo = ImageReader("c:\lgmp\cent_logo.png" , 0, 1, 120, use_DevIL=true, pixel_type="RGB32")
logo = logo.AssumeFPS(src.Framerate()).Loop(20).FadeIn(15)

# punch out logo and prepare it for overlay
maskit = logo.ColorKeyMask($000000,60)

# overlay the logo onto the video
content = Overlay(src, logo, mask=ShowAlpha(maskit))

leader = DirectShowSource("c:\lgmp\leader_noaudio.avi")
#leaderaudio = tone(720, 1, 44100, "silence", 0.0)
trailer = DirectShowSource("c:\lgmp\trailer_noaudio.avi")
#traileraudio = tone(1200, 1, 44100, "silence", 0.0)

#leadertotal = AudioDub(leader, leaderaudio)
#trailertotal = AudioDub(trailer, traileraudio)

leader + content + trailer

# resize the dimensions of the video frame to 320x180
LanczosResize(320, 180)


Obviously right now it gives the obvious "one clip has audio the other doesn't, this is not allowed" error. But if i uncomment the AudioDub sections, I then get "video formats don't match" error

Any insight from people with more knowledge would be great.

foxyshadis
20th September 2007, 18:11
Most likely they have slightly different framerates. (It's also possible that they're entirely different colorspaces.) You can be sure by running Info() on each, outputting one at a time, and checking for differences.

IanB
21st September 2007, 00:05
To add a matching format silent audio track to a clip:-leader = AudioDub(leader, BlankClip(src)).Trim(0,0,True)Blankclip(src) will clone the format of src and provide blank video and silent audio. Trim(0,0,True) will trim/pad the audio stream to match the length of the video stream.

To clone the framerate use the src clip format. This avoids arithmetic inaccuracy problems with floating point numbers.logo = logo.AssumeFPS(src)....

Use the Info() filter to check the pixel type and size of each clip. Use the appropriate ConvertTo... filter to force each other clip to match the type of your main clip. Also you may need to resize each clip individually if they are different sizes. You can only join like things.

Zer0Her0
21st September 2007, 04:23
Hey guys(or girls),

Thanks, it was in fact colorspace issue for the video not combining and the audio code snippet is JUST what I needed thank you so much.

--zer0her0