It is currently Thu Nov 26, 2026 8:59 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: merging multiple video as layers for burn, grain extract, grain merge
PostPosted: Wed Jan 25, 2012 4:08 am  (#1) 
Offline
GimpChat Member

Joined: Jan 25, 2012
Posts: 6
GIMP Version: 2.6.11
Operating System: Windows
OS Version: Vista 64
GIMP Experience: Intermediate Level



I want to take 4 avi videos and merge them and use the burn, grain extract and grain merge on the top three layers of video.
I don't know if a script or GAP is the best way to approach this.
Could anyone point me to a thread/script where someone has done anything similar.
I've seen script that process a single video file sequenced as a series of images.
Can that be done with more than one video images sequence?

The task is to create a mandelbrot zoom video similar to http://www.youtube.com/watch?v=_Mobf8sg47g.
In this video I've rendered 3 different videos with different palletes and mappings from fractal extreme.
For that mergeI used an AVIsynth script.
I'd like to do a video based on this mandelbot http://www.flickr.com/photos/panzerboy/6233908023/
With this static picture I've used 4 layers and the burn and grain extract and grain merge.
I won't be able to duplicate this with just the merge, mergechroma and mergeluma features of Avisynth.


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: merging multiple video as layers for burn, grain extract, grain me
PostPosted: Wed Jan 25, 2012 5:40 am  (#2) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Using GAP would seem the best approach. First you will need to convert each of your videos into a frame sequence. GAP supports this with the "Video->Split Video into Frames->Extract Videorange" command, though I do not know how well this works on Windows.

Once you have your videos -- let's call them A, B, C, and D -- converted, go to the window containing the first frame of A and run the "Video->Move Path" command. In the dialog that appears, select B as your Source Image and set the Mode to "Burn". All other settings should probably work with their default values. Press OK.

Repeat the above, running the "Video->Move Path" command in the A window; but this time select C as your Source Image and set the Mode to "Grain Extract".

Finally, do the same for D, setting the Mode to "Grain Merge".

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Last edited by saulgoode on Wed Jan 25, 2012 8:46 am, edited 1 time in total.

Top
 Post subject: Re: merging multiple video as layers for burn, grain extract, grain me
PostPosted: Wed Jan 25, 2012 6:43 am  (#3) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2630
Saulgoode has the info there for GAP otherwise

Quote:
I want to take 4 avi videos and merge them and use
the burn, grain extract and grain merge on the top three layers of video.


Just to clarify your process, do you want to take corresponding frames from each video and combine them to make a frame for the final video? as
Image
AFAIK avisynth will merge 2 videos one on top of the other, I use this for picture-in-picture but merge 4 ?

No real solution but as a starter (apologies if you know this already) For any windows users, a good way of getting ffmpeg is to install imagemagick. An added advantage is it is then included in your path. For the OP - dont know about Win 64bit.

using ffmpeg to decompose a video - %07d (image-0000001..)should give enough scope for a reasonable length video.
ffmpeg -i infile.avi -f image2 image-%07d.png

This will get you the frames to work on but then I am stumped for combining them with a bash/batch file. Imagemagick will take 2 images and apply 'burn' as
convert v1frame1.png -negate v2frame1.png -compose ColorBurn -composite -negate combinedframe1.png
but multiple frames and grain-merge/extract, don't know.

Just for info it is possible then using ffmpeg to recompose the video (framerate r should match original video)
ffmpeg -f image2 -r 25 -qscale 4 -i image-%07d.png outfile.avi


Top
 Post subject: Re: merging multiple video as layers for burn, grain extract, grain me
PostPosted: Wed Jan 25, 2012 7:41 am  (#4) 
Offline
GimpChat Member

Joined: Jan 25, 2012
Posts: 6
:tyspin Saulgoode, the GAP method worked after a couple of oops.
A couple of caveats for anyone trying the same thing.
Have the frames you want to copy into selected when you video->move path.
Then drop down the step mode to loop frames otherwise you'll get the same frame repeated.
Make sure the from frame and to frames are set.

If it goes wrong video->frames layer delete will delete the top layer.

Rich2005, :yesnod 4 videos merged!
Its my way of achieving gradual change in colours and show the iteration bands of the mandelbrot.
Most other mandelbrot zooms map the colours slowly so there's large areas of the same colour when in fact there's considerable complexity in the iteration bands that you cant see.
Using a single palette to make the iterations visible often makes the finer structure of the mandelbrot look like concentric bands of the same colour sequence over and over.
Merging different palettes and mapping I get the best of both worlds.
Its a technique I've used in my static pictures, there I've used up to 20 layers (extreme case).
I've got to render each video so I'm not going to go that far, but by using Gimp I think I'll be able to merge the videos and avoid them looking washed out.


Top
 Post subject: Re: merging multiple video as layers for burn, grain extract, grain me
PostPosted: Wed Jan 25, 2012 8:37 am  (#5) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
panzerboy wrote:
Then drop down the step mode to loop frames otherwise you'll get the same frame repeated.

Oops, I forgot about that. I've actually edited and recompiled my GAP to make "Frames Once" the default Step mode (it is the one I most often use).

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: merging multiple video as layers for burn, grain extract, grain me
PostPosted: Sat Jan 28, 2012 7:39 am  (#6) 
Offline
GimpChat Member

Joined: Jan 25, 2012
Posts: 6
It looks like its going to take a looooong time to extract 4300 frames x4 videos, do 3 move paths and final flatten.
So I'm looking at writing an avisynth plugin. That will avoid the file i/o.
Gimp's source code is available and the layer mode logic seems to be in the app/composite directory.
I presume its cool to use Gimp code as long as I include the GNU license.


Top
 Post subject: Re: merging multiple video as layers for burn, grain extract, grain me
PostPosted: Sat Jan 28, 2012 8:50 am  (#7) 
Offline
Global Moderator
User avatar

Joined: May 16, 2010
Posts: 16317
panzerboy wrote:
It looks like its going to take a looooong time to extract 4300 frames x4 videos, do 3 move paths and final flatten.
So I'm looking at writing an avisynth plugin. That will avoid the file i/o.
Gimp's source code is available and the layer mode logic seems to be in the app/composite directory.
I presume its cool to use Gimp code as long as I include the GNU license.


Yes it is. :)

_________________
Image


Top
 Post subject: Re: merging multiple video as layers for burn, grain extract, grain me
PostPosted: Mon Jan 30, 2012 7:50 am  (#8) 
Offline
GimpChat Member

Joined: Jan 25, 2012
Posts: 6
I written the avisynth plugin to do the 3 layer merges I needed - burn, grain merge and grain extract. Seems to be working though its a little slow. I'm using the generic c code, the SSE2 code would need to be converted to Intel assembler to compile in MSVC++. Its not too bad, perhaps doubling the video encode time.
One thing I did for myself was the opacity, the code for that must be somewhere else than app/composite?
For that I'm doing two floating point multiplications, one for the base layer and one for the merged layer.
ie newlayer = base * (100-opacity) + mergelayer * opacity
I suspect Gimp probably uses integer math. Ever noticed how if you set a layer to 50% opacity when you re-load the .xcf that parameter changes to 49.8. That will be because that opacity percentage will be saved as 1 byte value from 0-255 with 255 being 100%.
100 / 255 * 127 is 49.8.
I guess I better change my math to integer multiplies.


Top
 Post subject: Re: merging multiple video as layers for burn, grain extract, grain me
PostPosted: Tue Jan 31, 2012 4:20 am  (#9) 
Offline
GimpChat Member

Joined: Jan 25, 2012
Posts: 6
I've finished the AVIsynth plugin.
If you want to do GIMP style layer merges of RGB video in AVIsynth, then this will do it.

http://sourceforge.net/projects/avisynthgmplyr/files/?

Was quite interesting looking at the GIMP source code, my hats off to whoever dreamed up INT_MULT() :ninja


Top
 Post subject: Re: merging multiple video as layers for burn, grain extract, grain me
PostPosted: Tue Jan 31, 2012 8:15 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: Apr 07, 2010
Posts: 14182
Does this plug-in also work in Fedora?

_________________
Image


Top
 Post subject: Re: merging multiple video as layers for burn, grain extract, grain me
PostPosted: Tue Jan 31, 2012 8:47 am  (#11) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
panzerboy wrote:
It looks like its going to take a looooong time to extract 4300 frames x4 videos, do 3 move paths and final flatten.
So I'm looking at writing an avisynth plugin. That will avoid the file i/o.
Gimp's source code is available and the layer mode logic seems to be in the app/composite directory.
I presume its cool to use Gimp code as long as I include the GNU license.


Maybe look at this python this new python plugin of mine first...

_________________
Image


Top
 Post subject: Re: merging multiple video as layers for burn, grain extract, grain me
PostPosted: Tue Jan 31, 2012 3:49 pm  (#12) 
Offline
GimpChat Member

Joined: Jan 25, 2012
Posts: 6
molly wrote:
Does this plug-in also work in Fedora?

I didin't know that AVIsynth was available for Linux, running under WINE perhaps?
I don't have a Linux machine to test out the code, its compiled for windows using MSVC++ 2008.
The code is all standard c/c++ so should recompile under Linux.


Top
 Post subject: Re: merging multiple video as layers for burn, grain extract, grain me
PostPosted: Wed Feb 01, 2012 5:34 am  (#13) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2630
The avisynth linux project stalled sometime ago, but you can use the windows binaries.

You do indeed need Wine and avisynth and a suitable windows compiled codec such as xvid.

One way to get it running is using Avidemux, and sad to say both are now screwed on my PCLOS2011 installation.

1. The traditional way is to use avsproxy.exe/avsproxy_gui.exe from the windows Avidemux.
This creates a pipe to Avidemux which will render the video.
An example here, http://www.youtube.com/watch?v=okKCufHsxF0
sorry if the subject matter (GUG) offends any of you forum members.
This stopped working here when I upgraded from PCLOS2010.
I am fairly sure this is still working in LinuxMint so there is a good chance the fault is PCLOS and it works in RedHat/Fedora

2. Avidemux now comes with an installed plugin avsfilter see http://avsfilter.berlios.de/
This still needs Wine + avisynth + codec and is a little strange to use since you need some video open just to enable the filters in AviDemux.
This also has stopped working and I don't know why, the filter is up a version to 8a so that might be the cause or it might just be the Avidemux compile.

So, I am stuck on all linux fronts at the moment, back to windows if I need to use avisynth.

For anyone interested in video here is a demo in windows,
http://www.youtube.com/watch?v=H8l7yw-XtNY
It was for a someone in a UK newsgroup and it is to create a picture-in-a-picture just using mjpeg video from your point-and-shoot digital camera.


Top
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group