Welcome Guest! You need to login or register to make posts.



Go to last post Go to first unread
#1 Posted : Friday, April 9, 2004 2:34:00 AM(UTC)

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Here are some sample for using AVI Processor in ASP.

1. This sample code enumerates all installed compressors on computer using Next method and IsValid & Current properties:

Dim compressors, c 
Set compressors = Server.CreateObject("AviProcessor.AviCompressors")
	Set c = compressors.Current
	If c.IsValid Then
		Response.Write c.Name & ": " & c.Description & "
" End If Loop While compressors.Next() %>

2. This sample code creates new empty AVI, selects DivX Mpeg-4 as video compressor, adds all JPG files from some folder, and finally adds sound track from WAV file.

Dim writer
Set writer = Server.CreateObject("AviProcessor.AviWriter")
writer.CompressorHandler = 1482049860 'DivXPro5Compressor
writer.Quality = 8000
writer.CreateNew "c:\Images\MyVideo.avi", 300, 300, hWnd
writer.AddImages "c:\Images\*.jpg", True
'writer.AddWav "c:\Images\Sounds.wav"

3. This sample code reads existing AVI and saves frame sequence to separated JPG files:

Dim reader 
Set reader = Server.CreateObject("AviProcessor.AviReader")
reader.Open "c:\windows\clock.avi"
reader.Frames.SaveSeq 0, 10, "C:\temp\clip_frame_", ".jpg"

4. This sample code extracts frames from existing AVI by one to separated JPG files

Set reader = Server.CreateObject("AviProcessor.AviReader")
reader.Open "c:\windows\clock.avi"
For i = 0 To reader.Frames.Count - 1
	reader.Frames(i).SaveFile "C:\temp\clip_frame_" & CStr(i) & ".jpg"

5. This sample code opens existing AVI and creates new AVI with almost the same content but with additional watermark image and timer:

Set writer = Server.CreateObject("AviProcessor.AviWriter")
Set reader = Server.CreateObject("AviProcessor.AviReader")
' Making new AVI file with the same sizes and compressor
reader.Open "c:\windows\clock.avi"
writer.CompressorHandler = 1129730893 'reader.CompressorHandler
writer.CreateNew "c:\temp\NewVideo.avi", reader.Width, reader.Height
' Prepare watermark content
writer.Watermark.AddImage "c:\Images\Watermark.gif", 5, 5
writer.Watermark.AddTimer 5, reader.Height-20, , , , , , &h0000FF
' Closes reader for releasing source AVI file
Set reader = Nothing
' Copying all frames from old AVI to new one
writer.AddAvi "c:\windows\clock.avi"

Best regards,

Fedor Skvortsov

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.