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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th November 2011, 21:05   #21  |  Link
tin3tin
Registered User
 
tin3tin's Avatar
 
Join Date: Mar 2005
Posts: 365
Quote:
That will come with clip array input to FLuaG soon
That's good news. Thank you for all the time you put into this.
__________________
DVD slideshow GUI(Freeware).
tin3tin is offline   Reply With Quote
Old 27th November 2011, 13:58   #22  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,380
Quote:
Originally Posted by Youka View Post
Making a video 3D transition over a video background won't be a problem but it might be you mean working with more than one video stream. That will come with clip array input to FLuaG soon, but for now you have to use some tricks.
In order to write generic transition functions (for example), the ability to pass parameters from the Avisynth script would also be useful (as I suggested here and explained here).
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 27th November 2011, 14:17   #23  |  Link
Youka
Registered User
 
Youka's Avatar
 
Join Date: Mar 2011
Location: Germany
Posts: 64
Don't worry, i remembered your suggestion.
Next weekend i'm seriously planning version 0.5 and update first post (main item will be multiple input).
Youka is offline   Reply With Quote
Old 28th November 2011, 01:35   #24  |  Link
EmuAGR
Registered User
 
Join Date: Jan 2008
Posts: 17
FLuaG x64 v0.4: http://forum.doom9.org/showthread.ph...64#post1538264
EmuAGR is offline   Reply With Quote
Old 11th December 2011, 20:50   #25  |  Link
Youka
Registered User
 
Youka's Avatar
 
Join Date: Mar 2011
Location: Germany
Posts: 64
FLuaG version 0.5 released.

Main change is the userdata option for access on multiple clips, so it's possible now to use it for professional video editing like some commercial software.
Youka is offline   Reply With Quote
Old 14th December 2011, 01:45   #26  |  Link
Youka
Registered User
 
Youka's Avatar
 
Join Date: Mar 2011
Location: Germany
Posts: 64
Video room
Note: All clip versions were made with FLuaG too.

room.avs
Code:
Import("..\..\Head.avs")

blur = DirectShowSource("blur.mkv")
edgedetect = DirectShowSource("edgedetect.mkv")
numbers = DirectShowSource("numbers.mkv")
soundwave = DirectShowSource("soundwave.mkv").Trim(0,304)

FLuaG(soundwave, video = "room.lua", userdata = "blur edgedetect numbers")
room.lua
Code:
--Init 3D room with perspective view
flInit3D(90, VIDEO_WIDTH/VIDEO_HEIGHT, 0.01, 10)

--Camera
gluLookAt(0, 0, 1, 0, 0, -1, 0, 1, 0)

--Face culling
glEnable(GL_CULL_FACE)
glFrontFace(GL_CW)
glCullFace(GL_BACK)

--Light + material
glLightModel(GL_LIGHT_MODEL_AMBIENT, {0, 0, 0, 1})
glLight(GL_LIGHT0, GL_AMBIENT, {0.1, 0.1, 0.1, 1})
glLight(GL_LIGHT0, GL_DIFFUSE, {1, 1, 1, 1})
glEnable(GL_LIGHT0)
glEnable(GL_COLOR_MATERIAL)
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE)

--Texture
local tex = glGenTextures(1)
glBindTexture(GL_TEXTURE_2D, tex[1])
glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)

--Render objects
local quad = gluNewQuadric()
local wall = glGenLists(1)
do
	local function rect_splitted(x1, y1, x2, y2, parts)
		local x_step = (x2-x1) / parts
		local y_step = (y2-y1) / parts
		for y=1, parts do
			for x=1, parts do
				glTexCoord((x-1) / parts, y - (y-1) / parts)
				glVertex(x1 + (x-1) * x_step, y1 + (y-1) * y_step)
				glTexCoord(x / parts, y - (y-1) / parts)
				glVertex(x1 + x * x_step, y1 + (y-1) * y_step)
				glTexCoord(x / parts, y - y / parts)
				glVertex(x1 + x * x_step, y1 + y * y_step)
				glTexCoord((x-1) / parts, y - y / parts)
				glVertex(x1 + (x-1) * x_step, y1 + y * y_step)
			end
		end
	end
	glNewList(wall, GL_COMPILE)
	glNormal(0, 0, 1)
	glBegin(GL_QUADS)
	rect_splitted(-1, 1, 1, -1, 30)
	glEnd()
	glEndList()
end

--Display
function GetFrame(frame_index, frame_time)
	--Clear room
	glClear(GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT)

	--Moving view
	glPushMatrix()
	glRotate(frame_index, 0, 1, 0)

	--Set light
	glPushMatrix()
	glTranslate(0, 0.8, -0.2)
	glColor(1, 1, 0)
	gluSphere(quad, 0.03, 20, 20)
	glLight(GL_LIGHT0, GL_POSITION, {0, 0, 0, 1})
	glPopMatrix()
	glEnable(GL_LIGHTING)

	--Walls
	glColor(1, 1, 1)
	glEnable(GL_TEXTURE_2D)
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, VIDEO_WIDTH, VIDEO_HEIGHT, 0, GL_RGBA, LoadFrame())	--Back
	glPushMatrix()
	glTranslate(0, 0, -1)
	glCallList(wall)
	glPopMatrix()
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, USERDATA[1]:Info().width, USERDATA[1]:Info().height, 0, GL_RGBA, USERDATA[1]:LoadFrame(frame_index))	--Front
	glPushMatrix()
	glTranslate(0, 0, 1)
	glRotate(180, 0, 1, 0)
	glCallList(wall)
	glPopMatrix()
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, USERDATA[2]:Info().width, USERDATA[2]:Info().height, 0, GL_RGBA, USERDATA[2]:LoadFrame(frame_index))	--Left
	glPushMatrix()
	glTranslate(-1, 0, 0)
	glRotate(90, 0, 1, 0)
	glCallList(wall)
	glPopMatrix()
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, USERDATA[3]:Info().width, USERDATA[3]:Info().height, 0, GL_RGBA, USERDATA[3]:LoadFrame(frame_index))	--Right
	glPushMatrix()
	glTranslate(1, 0, 0)
	glRotate(-90, 0, 1, 0)
	glCallList(wall)
	glPopMatrix()
	glDisable(GL_TEXTURE_2D)
	glPushMatrix()	--Floor
	glTranslate(0, -1, 0)
	glRotate(-90, 1, 0, 0)
	glCallList(wall)
	glPopMatrix()
	glPushMatrix()	--Ceiling
	glTranslate(0, 1, 0)
	glRotate(90, 1, 0, 0)
	glCallList(wall)
	glPopMatrix()

	--Draw to frame
	glDisable(GL_LIGHTING)
	glPopMatrix()
	SaveFrameFromContext()
end

Last edited by Youka; 18th December 2011 at 21:12.
Youka is offline   Reply With Quote
Old 14th December 2011, 21:55   #27  |  Link
EmuAGR
Registered User
 
Join Date: Jan 2008
Posts: 17
FLuaG x64 v0.5: http://forum.doom9.org/showthread.ph...64#post1538264

I'm getting used to compile this filter, maybe I'll be faster next time.
EmuAGR is offline   Reply With Quote
Old 1st January 2012, 16:10   #28  |  Link
Youka
Registered User
 
Youka's Avatar
 
Join Date: Mar 2011
Location: Germany
Posts: 64
See first post:
Quote:
Todo:
  • Lua functions
    • FFT
    • TGA loading & saving
    • Outline path utilities
  • Others
    • Examples: advanced karaoke and drawing
    • Documentation: extended + german version
Youka is offline   Reply With Quote
Old 2nd January 2012, 21:13   #29  |  Link
tin3tin
Registered User
 
tin3tin's Avatar
 
Join Date: Mar 2005
Posts: 365
Wow. It must have been quite an amount of time you have spend on this. Thank you.

I hope that I some day will figure out how to do video transitions with it. I did it once in this OpenGL AutoIt plugin. There are some nice examples and a manual. Maybe the commands aren't that different and those examples could be usefull in FLuaG too?

Btw. maybe you could change the path in 'Head.avs' to: LoadPlugin("..\..\Data\FLuaG.dll")?
__________________
DVD slideshow GUI(Freeware).

Last edited by tin3tin; 2nd January 2012 at 22:00.
tin3tin is offline   Reply With Quote
Old 3rd January 2012, 01:20   #30  |  Link
Youka
Registered User
 
Youka's Avatar
 
Join Date: Mar 2011
Location: Germany
Posts: 64
Quote:
Originally Posted by tin3tin View Post
Btw. maybe you could change the path in 'Head.avs' to: LoadPlugin("..\..\Data\FLuaG.dll")?
You mean LoadPlugin("..\data\FLuaG.dll"). Doesn't work (for me), because LoadPlugin just accepts the complete file path.

Quote:
Originally Posted by tin3tin View Post
I did it once in this OpenGL AutoIt plugin. There are some nice examples and a manual. Maybe the commands aren't that different and those examples could be usefull in FLuaG too?
For FLuaG everyone can look for the mass of OpenGL tutorials on the web (excluding window initialization, isn't needed in FLuaG) and just write it in Lua, so there are tutorials.
Seems it's needed to include OpenGL & Lua teaching into FLuaG. When i have more time, i will create a video tutorial step-by-step.
Youka is offline   Reply With Quote
Old 1st February 2012, 01:09   #31  |  Link
Vol666
Registered User
 
Join Date: Jun 2010
Posts: 14
HI Youka

I want to set png logo on the video with Fade IO effect and the opportunity to set start time(frame) , duration and end frame.

Can you tell how should be look like the script with the FluaG?
Vol666 is offline   Reply With Quote
Old 1st February 2012, 06:16   #32  |  Link
Youka
Registered User
 
Youka's Avatar
 
Join Date: Mar 2011
Location: Germany
Posts: 64
logo.png

logo.avs
Code:
#LoadPlugin("...\FLuaG.dll")
#LOAD YOUR VIDEO
FLuaG(video = "logo.lua")
logo.lua
Code:
--Load logo into texture memory
local image = flLoadPNG("logo.png")
glBindTexture(GL_TEXTURE_2D, glGenTextures(1)[1])
glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width, image.height, 0, GL_RGBA, image)

--Set OpenGL matrices for 2D rendering
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluOrtho2D(0, VIDEO_WIDTH, VIDEO_HEIGHT, 0)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()

--Enable overlays with transparency
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

--Define fade times
local start = 0
local ends = 100
local infade = 30
local outfade = 30

--Set position
glTranslate(100, 100, 0)

--Rendering
function GetFrame(frame_index, frame_time)
	--Limit rendering to wished frame range
	if frame_index >= start and frame_index <= ends then
		--Transfer clip frame to OpenGL framebuffer
		LoadFrameToContext()

		--Infade transparency
		if frame_index <= start + infade then
			local pct = 1 - ((start + infade - frame_index) / infade)
			glColor(1, 1, 1, pct)
		--Outfade transparency
		elseif frame_index >= ends - outfade then
			local pct = (ends - frame_index) / outfade
			glColor(1, 1, 1, pct)
		--Opaque
		else
			glColor(1, 1, 1, 1)
		end
		--Draw texture
		glEnable(GL_TEXTURE_2D)
		glBegin(GL_QUADS)
			glTexCoord(0, 0); glVertex(0, 0)
			glTexCoord(1, 0); glVertex(image.width, 0)
			glTexCoord(1, 1); glVertex(image.width, image.height)
			glTexCoord(0, 1); glVertex(0, image.height)
		glEnd()
		glDisable(GL_TEXTURE_2D)

		--Transfer OpenGL framebuffer back to clip frame
		SaveFrameFromContext()
	end
end

Last edited by Youka; 1st February 2012 at 06:59.
Youka is offline   Reply With Quote
Old 1st February 2012, 13:41   #33  |  Link
Nevilne
Registered User
 
Join Date: Aug 2010
Posts: 134
Is it possible to call nvidia fxaa with fluag?
Nevilne is offline   Reply With Quote
Old 1st February 2012, 14:45   #34  |  Link
Youka
Registered User
 
Youka's Avatar
 
Join Date: Mar 2011
Location: Germany
Posts: 64
FLuaG supports OpenGL 2.1 + framebuffer + imaging, but FXAA is new, so the answer is no.
You can write the algorithm by your own as pixel shader. Read the whitepaper of nvidia?
Youka is offline   Reply With Quote
Old 18th May 2012, 00:34   #35  |  Link
Youka
Registered User
 
Youka's Avatar
 
Join Date: Mar 2011
Location: Germany
Posts: 64
Currently i'm writing on a scenegraph-like engine for easier usage of FLuaG. It's just a test for me, but maybe it'll help less experienced, lazy programmers to create nice animations in Avisynth.

Code:
--Include engine
dofile("Scenegraph.lua")

--Create scene structure
local scene = GLScene(0, 0, VIDEO_WIDTH, VIDEO_HEIGHT)
local light_node = GLNode()
local text_node = GLNode()
local cube_node = GLNode()
local image_node = GLNode()

--Create scene objects
local cam = GLCamera("3D", 1000, 1)

local light = GLLight({0,100,300, 1})

local text_position = GLTransformation():translate(500,100,0)
local text_color = GLColor(1, 0.5, 0)
local text = GLText("Hello World!", "Arial", 80, true, true, 20)

local cube_rotation = GLTransformation()
local cube_position = GLTransformation():translate(300,200,0)
local cube_part1 = GLObject("Triangle fan", {
							vertices = {
								{-100,100,-100}, --Left-bottom-back
								{-100,-100,-100}, --Left-top-back
								{-100,-100,100}, --Left-top-front
								{-100,100,100}, --Left-bottom-front
								{100,100,100}, --Right-bottom-front
								{100,100,-100}, --Right-bottom-back
								{100,-100,-100}, --Right-top-back
								{-100,-100,-100} --Left-top-back
							},
							colors = {
								{0,0,1}, --Left-bottom-back: blue
								{0,1,0} --Rest: green
							}
						})
local cube_part2 = GLObject("Triangle fan", {
							vertices = {
								{100,-100,100}, --Right-top-front
								{-100,-100,100}, --Left-top-front
								{-100,100,100}, --Left-bottom-front
								{100,100,100}, --Right-bottom-front
								{100,100,-100}, --Right-bottom-back
								{100,-100,-100}, --Right-top-back
								{-100,-100,-100}, --Left-top-back
								{-100,-100,100} --Left-top-front
							},
							colors = {
								{1,0,0}, --Right-top-front: red
								{0,1,0} --Rest: green
							}
						})

local panel_texture = GLTexture("firefox.png")
local panel_position = GLTransformation()
local panel = GLObject("Quads", {
						vertices = {
							{0,0},
							{panel_texture:getwidth(),0},
							{panel_texture:getwidth(), panel_texture:getheight()},
							{0, panel_texture:getheight()}
						},
						tex_coords = {
							{0,0},
							{1,0},
							{1,1},
							{0,1}
						}
					})

--Build scene
scene:setcamera(cam)
scene:attach(image_node, "image")
scene:attach(cube_node, "cube")
scene:attach(light_node, "light")

image_node:attach(panel_position, "position")
image_node:attach(panel, "image")
panel:bindtexture(panel_texture)

cube_node:attach(cube_rotation, "transform_level2")
cube_node:attach(cube_position, "transform_level1")
cube_node:attach(cube_part1, "part1")
cube_node:attach(cube_part2, "part2")

light_node:attach(light, "light")
light_node:attach(text_node, "text")

text_node:attach(text_color, "color")
text_node:attach(text_position, "position")
text_node:attach(text, "text")

--Into render loop
VideoFilter(
	function(frame_index, frame_time)
			--Update scene objects
			cube_rotation:reset():rotate(frame_index, frame_index, 0)

			local pos = light:setposition({0,0,0,0})
			pos[1] = frame_index * 5
			light:setposition(pos)

			panel_position:reset():translate(frame_index * 4,300,0)

			--Render whole scene
			scene:render()
	end
)
Youka is offline   Reply With Quote
Old 21st May 2012, 12:19   #36  |  Link
Youka
Registered User
 
Youka's Avatar
 
Join Date: Mar 2011
Location: Germany
Posts: 64
FLuaG on Github now.
Youka is offline   Reply With Quote
Old 23rd May 2012, 06:01   #37  |  Link
tin3tin
Registered User
 
tin3tin's Avatar
 
Join Date: Mar 2005
Posts: 365
Good to hear that you're making progress.
__________________
DVD slideshow GUI(Freeware).
tin3tin is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 01:58.


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