Image Stabilization

Does anyone have a process for image stablization, I guess there's no Frei0r plugin for this. I'm looking at Deshaker for VirtualDub but really how many times does anyone want to render their footage out through one work around or another. Thanks.

As I have said many time I´m not a coder but kdenlive could get a cool stabilization system out of the motion analysis cinelerra plugin.

In After Effects you have the TACKING MOTION tool which folows a pattern on an area of the image, the motion stabilization is THE SAME process, but it actually multiplies the resulting tracking motion values by (-1), so if som image moves 55 pixel right and 14 pixels down, the software simply moves the image -55 pixels left and 14 pixels up to get that spot motionless while the est of the frame is moving.

Kdenlive should fork the motion analyzer form cinelerra and make this a feature. For long interviews when your cameraman had no tripod, you could record in HD and stabilyze on SD (you won´t see the black borders because HD image is bigger).

Marcos Caballero
http://anubis4d.com.ar/home/videofx.php

PS: I can´t wait to se a node editor in KDENLIVE!

MLT already has a motion estimation plugin, and Kdenlive's Auto Mask filter uses it. The Auto Mask (motion_est -> mask -> obscure filter) is just the only one, usable filter written for it at this time. The motion_est filter simply attaches motion vector data to the frame objects that subsequent effects use. I just need more time to make more effects including image stabilization and general purpose masking for any other image filter. However, this is low priority compared to fixing bugs and more basic, necessary functions like smooth keyframable pan and zoom (Ken Burns for stills). Actually, I will likely attempt the image stabilizer when the improved pan/zoom is ready.

Would have to agree. The smooth pan and zoom 'Ken Burns' is really essential and can't be faked. A stabilization filter would be nice, but then again there's these newfangled high tech contraptions called tripods and dollies and shoulder mounts.

I have a Glidecam Smooth Shooter with 4000pro, but still there are some cool effects which can only be reached with digital camera stabilization. I will check out the feature, wasn´t aware of this you are working on.
There are good stuff in kdenlive.

Marquitux
http://www.anubis4d.com.ar

For newcomers, Deshaker[1] is a powerful plugin for VirtualDub. Unfortunately, they operate only under Windows. The good news is VirtualDub and Deshaker both run fine under Wine (windows emulator).

You might need to install Microsoft Visual C++ 2005 SP1 Redistributable Package, as recommended on Deshaker page. This page[2] instructs to disable DirectX Output under Options -> Preferences -> Display because of freeze or display problems in VirtualDub.

VirtualDub is AVI centric, and you'll most probably want a compressing output MJPEG codec instead of the uncompressed default. This can be found in the ffdshow tryouts package[3] besides many other goodies.

The Deshaker page[1] is worth a read to understand how the deshaking process work.

[1] http://www.guthspot.se/video/deshaker.htm
[2] http://appdb.winehq.org/objectManager.php?sClass=version&iId=16326
[3] http://ffdshow-tryout.sourceforge.net/

We could imagine developing a wrapper in MLT for VirtualDub/AVISynth plugins (ala infamous ndiswraper/w32codecs), but this ugly and unportable proposal would never beat a totally F/OSS and native solution. In the mean time, running with wine still do the job, without having to reboot the machine. If someone knows how to run the 2-pass Deshaker non-interactively for batch mode, please let me know.

As anyone who knows me will testify, I'm pretty pathetic when it comes to MS-Windows. Still, I note John Meyer's script for the VirtualDub/Deshaker combination works pretty good (under MS-Windows) where in the case of Sony Vegas NLE, a script was created which completely automates the stabilization. Its impressive to watch in action and even a Windows incompetent like myself can get it to work in Vegas:
http://www.lawrence-arnold.com/Vegas/DeshakerScript.htm

Of course the advantage being it will make, in many cases, completely unusable video clip, suddenly usable. It does not work in all cases. Scenes from a fast moving car, or from a train if looking at the same scene WILL work most of the time. But if the scene is constantly changing, then there can be wave type effects or jumps, where the scene was changing too much for the stabilization software settings to compensate. I find if one is at maximum zoom on their camcorder, and there is movement because of an inability to stabilize the subject at such a zoom, the Deshaker stabilization works great.

Overall, I find it is indispensable to have a stabilizer in software.

For now I am taking my more interesting (but unfortunately unsteady clips) into a Virtual Box session, stabilizing them in software, and then dragging them back to Linux kdenlive.

It would be nice to see a more friendly packaged application for Linux to take a directory of input videos, launch the stabilization software, and have then all sequentially processed.

I disliked having to boot to MS-Windows to stabilize my videos with Sony Vegas and Deshaker, save them, and then copy them back to Linux. And Sony Vegas/Deshaker ran too slow under a WinXP Virtual Box client session for my liking.

So I eventually managed to run Virtual Dub under wine, and I installed the Deshaker plugin. It runs faster than under winXP/Vegas and it works ok for stabilizing (in software) videos prior to dropping them into kdenlive. However I have not been able to get Virtual Dub under wine to accept the raw AVCHD videos from my Canon HF S10 (but the raw videos will be accepted under winXP with Sony Vegas and the VirtualDub/Deshaker combo) so clearly my wine implementation is missing some raw codecs. I suspect Sony Vegas has the needed codecs.

Still this lack of codecs is not completely blocking on stabilizing, but rather its only time consuming, as instead I batch convert my AVCHD raw videos to an intermediary recognized codec format (by VirtalDub under wine) prior to "deshaking"/"stabilizing". This success with VirtualDub/Deshaker/wine combination was on a 64-bit openSUSE-11.1 running KDE-3.5.10.

It does mean there are extra steps though:
* step-1 - change all raw Canon HF S10 videos to intermediary format accepted by VitualDub (under wine) [very easy to do with an ffmpeg script/batch file]
* step-2 - destabilize all videos with Virtual Dub/Deshaker under wine (takes a while to setup a "job" to do this, but once set up VirtualDub can run for hours doing multiple conversions);
* step-3 - take output files from Virtual Dub/Deshaker under wine and drop into KDEnlive for nominal video editing.

I run the KDE4 kdenlive-0.7.6 on KDE3 using the kdenlive packaged by the openSUSE community Packman packagers.

Any tips for getting deshaker to be recognized as a plugin in virtualdub? I get an error saying it cannot load the module. I tried using winetricks to install some libraries as I read elsewhere:
vcrun2005 MS Visual C++ 2005 libraries (mfc80,msvcp80,msvcr80)
vcrun2005sp1 MS Visual C++ 2005 sp1 libraries
ffdshow ffdshow video codecs

So far it works pretty well, except I cannot use deshaker. .
Thanks, Geoff

Got deshaker working. Also had to use winetricks to install MFC42.DLL

This look cool, but maybe too much of a pain for me with the multiple steps of conversion and processing. At least its nice to know I can use it if needed.

The multiple steps required to destabilize a video with win/VirtualDub/deshaker is a bit of a pain to use. I find I need to load the video, then select the 1st pass with the deshaker plugin and then process that. After that processing is complete then the 2nd pass needs to be selected with the deshaker plugin.

If I have multiple videos to stabilize, I've been using the VirtualDub job control, but even that requires a lot of time to setup. On occasion I spent an hour setting up multiple jobs, and then wine/VirtualDub/deshaker spent 5 hours on my Intel Core i7 920 based PC (w/openSUSE-11.1) processing 50+ video clips, applying a stabilizing effect to them.

Still, the 1 hour of setup for the 50+ clips was very repetitive. There must be an easier way.

I notice there are batch/script plugins for VirtualDub, and in the course of the next few weeks I hope to find one of them that will let me deshake (stabilize) an entire directory of files without having to spend 1 hour in setup (albeit all clips will be processed with the same deshaker settings, which may not be optimized).

... anyway ... I'm looking forward to the day when kdenlive will have its own internal destabilizer.

I ran into a problem and I seem not to be able to run deshaker on wine. I get a black/blank output monitor during the first pass that says: No previous frame to match on.
I guess I'll give up on that for now since it works fine on windows XP.

Reads to me like either a codec it does not recognize or possibly a bad setting. You could simply remove virtual dub under wine and re-install it.

However if you boot to windoze regularly then no problem. I rarely boot to WinXP and hence I would find that (having to boot to XP) a major inconvenience. Fortunately virtualdub/deshaker works well under wine for me, and I'm getting more adept at using it all the time, as the days go by.

Refer to oldcpu comment :
> I notice there are batch/script plugins for VirtualDub, and in the course of the next few weeks I hope to find one of them that will let me deshake (stabilize) an entire directory of files without having to spend 1 hour in setup (albeit all clips will be processed with the same deshaker settings, which may not be optimized).

I have the same need, so I created a shell script that deshake videos by:

-conversion of the original video with ffmpeg into mjpeg avi
-use VirtualDub with wine to deshake
-delete temporary files

I'll post the script tomorrow if you want

If you don't mind running Windows/Wine for this... I went through all that myself trying to automate VirtualDub and Deshake to do a load of mts files. In the end I came up with the batch files I posted here :
http://forums.virtualdub.org/index.php?act=ST&f=5&t=17772&st=15&hl=

Sometimes it still fails with a clip here and there, but I do those manually :)

AVCHD goes into VirtualDub OK using AviSynth scripts. Hope that helps

I will look if I can improve my script with yours.
But what I wanted was a script that can be run from Linux without doing anything else.

Now I can do a right-click a (lots of) file(s) and use the Nautilus scripts on any video to deshake it.

I had some trouble trying some windows script for VirtualDub to Deshacker on Linux. Your script can be run on Linux with Wine ?

Re: Jerem's comment:
> conversion of the original video with ffmpeg into mjpeg avi

For this I use the following one line (it may appear wrapped in this forum, but it is just one line):

for i in *.mts; do ffmpeg -y -i "$i" -f avi -vcodec mpeg4 -b 8000000 -acodec ac3 -ab 128000 -s 1280x720 year_month_day_${i/%mts/avi}; done

where I have a directory of ".mts" files, and I have added the Year_month_day_in front of each file, converting it from a .mts to a .avi extension.

I still have not got around to looking for a wine/virtualdub/deshaker script.

MJ Peg:
> In the end I came up with the batch files I posted here :
> http://forums.virtualdub.org/index.php?act=ST&f=5&t=17772&st=15&hl=

Thanks, I think it is possible to move from MJ Peg's example to wine for an entire directory, ... I don't have time this week, but maybe in the next couple of weeks.

I note this works for one file if the terminal session is in the video directory (with deshake01.vcf (pass01) and deshake02.vcf (pass02) in same directory):
wine /path/to/virtualdub/VirtualDub.exe /c /s deshake01.vcf /p initial-video.avi temporary-video.avi /r /x
wine /path/to/virtualdub/VirtualDub.exe /c /s deshake02.vcf /p initial-video.avi final-output-video.avi /r /x

which is in essence what MJ Peg created. One next needs to sort the paths, and then set up a simple bash loop to do this for an entire directory. I've done that for ffmpeg, so the same should be true/doable with wine/VirtualDub. As noted, I don't have time to sort this now, but it should be viable.

OK, further to my post above, ... I'm not very good at this, but I think something like this might work:

for i in *.avi; do wine /path/to/virtualdub/VirtualDub.exe /c /s deshake01.vcf /p $i temp.mp4 /r /x; wine /path/to/virtualdub/VirtualDub.exe /c /s deshake02.vcf /p $i deshaken_${i/%avi/mp4} /r /x; rm temp.mp4; done

In the above example one has a directory of video files with the .avi extension that one wishes to deshake. One also has the files deshake01.vcf and deshake02.vcf in the same directory as the .avi files (I have not sorted paths under wine). deshake01.vcf is pass01 of deshaker. deshake02.vcf is pass02 of deshaker.

After deshaking them with VirtualDub and deshaker, the final files ending up with a .mp4 extension and the words "dehaken_" in front of the file. ie if original file was "original.avi" the output file would be "deshaken_original.mp4".

my scripts is like tour last post :

I have a file "Deshake" in ~/.gnome2/nautilus-scripts directory, with KDE, there must be something similar.

-------------------------------------------
#!/bin/sh
for arg
do
rm "/media/data/Logiciels/Scripts/deshaker/output.avi"
ffmpeg -i "$arg" -acodec libmp3lame -ab 128 -vcodec mjpeg -qmin 3 -qmax 3 "/media/data/Logiciels/Scripts/deshaker/input.avi"
wine "C:\\Program Files\\virtualdub\\VirtualDub.exe" /x /min /priority low /s "Z:\\media\\data\\Logiciels\\Scripts\\deshaker\\Deshaker.syl"
rm "/media/data/Logiciels/Scripts/deshaker/input.avi"
mv -f "/media/data/Logiciels/Scripts/deshaker/output.avi" "$arg"-stab.avi
done
notify-send -t 2000 -i /usr/share/icons/gartoon/scalable/apps/xfce-multimedia.svg "Deshake done" ""
-------------------------------------------

For each file passed in parameter, the script doing :
-delete the file previously created
-convert the file with ffmpeg to be recognized by VirtualDub
-deshake tempory file "input.avi" (the file converted by ffmpeg) to a file "output.avi"
-delete tempory file
-rename output file to original name + "-stab.avi"

Deshaker.syl :
-------------------------------------------

VirtualDub.Open("Z:/media/data/Logiciels/Scripts/deshaker/input.avi","",0);
VirtualDub.subset.AddFrame(0,30);
VirtualDub.video.SetInputFormat(0);
VirtualDub.video.SetOutputFormat(7);
VirtualDub.video.SetMode(3);
VirtualDub.video.SetSmartRendering(0);
VirtualDub.video.SetPreserveEmptyFrames(0);
VirtualDub.video.SetFrameRate2(0,0,1);
VirtualDub.video.SetIVTC(0, 0, 0, 0);
VirtualDub.video.SetCompression();
VirtualDub.video.filters.Clear();
VirtualDub.video.filters.Add("Deshaker v2.4");
VirtualDub.video.filters.instance[0].Config("12|1|30|4|1|0|1|0|640|480|1|2|1|400|400|400|1500|4|0|1|2|5|40|300|4|Z:\\media\\data\\Logiciels\\Scripts\\deshaker\\Deshaker.log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|15|15|5|15|0|0|30|30|0|0|1|0|1|0|0|10|1|15|1000|1|48");
VirtualDub.audio.filters.Clear();
VirtualDub.SaveAVI("Z:/media/data/Logiciels/Scripts/deshaker/tmp.avi");
VirtualDub.Close();
VirtualDub.Open("/media/data/Logiciels/Scripts/deshaker/input.avi","",0);
VirtualDub.subset.AddFrame(0,30);
VirtualDub.video.SetRange(500, 0);
VirtualDub.audio.SetSource(1);
VirtualDub.audio.SetMode(0);
VirtualDub.audio.SetInterleave(1,500,1,0,0);
VirtualDub.audio.SetClipMode(1,1);
VirtualDub.audio.SetConversion(0,0,0,0,0);
VirtualDub.audio.SetVolume();
VirtualDub.audio.SetCompression();
VirtualDub.audio.EnableFilterGraph(0);
VirtualDub.video.SetInputFormat(0);
VirtualDub.video.SetOutputFormat(7);
VirtualDub.video.SetMode(3);
VirtualDub.video.SetSmartRendering(0);
VirtualDub.video.SetPreserveEmptyFrames(0);
VirtualDub.video.SetFrameRate2(0,0,1);
VirtualDub.video.SetIVTC(0, 0, 0, 0);
VirtualDub.video.SetCompression(0x44495658,0,10000,0);
VirtualDub.video.SetCompData(3532,"AAAAALwCAACQsggALlx2aWRlby5wYXNzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAAAAFh2aWQgSERUVgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGgAAAEdlbmVyYWwgcHVycG9zZQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAABkAAAAZAAAAAEAAAAKAAAAAQAAABQAAAAAAAAAAAAAAAUAAAAFAAAABQAAAAAoCgAAAAAAAQAAAAEAAAAeAAAAAAAAAAIAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAYAAAABAAAAAAAAAAEAAAAAAAAALAEAAAAAAAABAAAAHwAAAAEAAAAfAAAAAQAAAB8AAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAA==");
VirtualDub.video.filters.Clear();
VirtualDub.video.filters.Add("Deshaker v2.4");
VirtualDub.video.filters.instance[0].Config("11|2|30|4|1|0|1|0|640|480|1|2|1|4000|4000|4000|1500|4|1|0|2|5|40|300|4|Z:\\media\\data\\Logiciels\\Scripts\\deshaker\\Deshaker.log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|15|15|5|15|1|1|30|30|0|0|0|0|1|0|1|10|1|15|1000|1|88");
VirtualDub.SaveAVI("Z:/media/data/Logiciels/Scripts/deshaker/output.avi");
VirtualDub.Close();
-------------------------------------------

You need to change one time all names ("Z:\\media\\data*" and "/media/data*")

It's not optimized, it's not the best way and the names are hard coded, but it works very well and it's simple.
However, it lacks the offset of the audio and I will add several sets of parameters for the second pass (to make differents outputs for each files)

========
>> Any tips for getting deshaker to be recognized as a plugin in
>> virtualdub? I get an error saying it cannot load the module.
> Got deshaker working. Also had to use winetricks to install MFC42.DLL
========

I decided to put VirtualDub with the deshaker plugin on my 64-bit openSUSE-11.2 running on my Dell Studio 1537 laptop.

I encountered the same "can not load the module" error, and I found just using winetricks to install MFC42.DLL was insufficient. I also had to use a hint from the deshaker web site: http://www.guthspot.se/video/deshaker.htm which states: Important: If VirtualDub reports an error or if it can't load Deshaker correctly, you're most likely missing some required files. In that case, simply install the Microsoft Visual C++ 2005 SP1 Redistributable Package http://www.microsoft.com/downloads/details.aspx?familyid=200B2FD9-AE1A-4...

After installing that, VirtualDub running under wine was able to use the deshaker plugin.

I'm testing it now. Its interesting to note that the VirtualDub/deshaker performance under my DualCore P8400 Dell Studio 1537 laptop is significantly slower than under my Intel Core i7 920 desktop (as would be expected given the Intel Core i7 have 4 cores (eight virtual)).

There is a mjpegtools component called "y4mstabilizer" that will do image stabilization.

It is less sophisticated than the "Deshaker", and to get optimum results from it, you must deinterlace and resample to 444 (which can be done in the same mjpegtools command line pipeline, you need to separately install y4mscaler however).
When I will be big, and have a lot of time, I will try to contribute code to it...

There was another project, or at least an attempt, called something like "yuvstabilizer", but somehow I can't google it out now... I think it was by a guy from Sweden... it used some advanced computer vision library...

Using some tools in Cinelera, a kind of image stabilzation can be obtained, too. But this is based on the tracking of a single object, which is less efficient, and will not give you full info about the camera motion.

I took notes during my last two VirtualDub installations under wine (with the deshaker plugin) and wrote them in in a brief How To Guide here: http://forums.opensuse.org/new-user-how-faq-read-only/unreviewed-how-faq...

While that is an openSUSE Linux forum, I think most of what I did is applicable to all Linux versions.

> There is a mjpegtools component called "y4mstabilizer" that will do image stabilization.

> It is less sophisticated than the "Deshaker", and to get optimum results from it,
> you must deinterlace and resample to 444 (which can be done in the same mjpegtools
> command line pipeline, you need to separately install y4mscaler however).

That is interesting to know. After reading your post I checked my openSUSE Packman packaged version of mjpegtools rpm and sure enough, included was /usr/bin/y4mstabilizer. With mjpegtools installed, by typing: "y4mstabilizer -h" one can learn a bit more about this mjpegtools stabilization package.

Edit: further to this, I note the mjpegtools mailing list has examples of the use of y4mstabilizer
http://sourceforge.net/mailarchive/forum.php?thread_name=1244141157.9699...

There are examples in that thread of useage attempts ... I have not tried this so I can not comment on its use. The syntax from my copy and paste may not be good.

Finally I found the other thing, it is called "yuv motion tools", and is from Denmark, not Sweden :-)

It is called YUV motion tools, for download see here:

http://vaults.atomicmonstergirls.net/useful/techworks/utilities/yuvmotio...

http://atomicmonstergirls.net/blog/2008/09/

and the project site is at

http://savannah.gnu.org/

but does not seem to be very active.

I remember that once it was accompanied with a rather long webpage containing an exhaustive descriprion and examples, but that I still cannot find.

I have downloaded it a few minutes ago, it compiled without problems, but will not work.
I fed it a DV clip through the suggested pipeline, but it just throws out an error and dies...
I'll try to contact the author...

I have contacted the author. He is a very nice guy, and has fixed the bug in no time.

Now this works, so we have another image stabilizing tool under Linux! It is based on the "openCV" computer vision libary.

He also pointed out that the english description page somehow got lost, only the danish version remains:

http://www.modspil.dk/itogtech/fri_software_og_multimedier__videostabili...

> He also pointed out that the english description page
> somehow got lost, only the danish version remains:

Too bad about no English version (for us who do not speak Danish). I note here a translator for Danish to English:
* http://www.translation-guide.com/free_online_translators.php?from=Danish...
where one just copies the Danish web page URL into that translation tool.

Of course one has to then go and change the code that was inappropriately translated. And as in all such electronic/computer translations, the translation often does not make sense.

If the motion stabilization effect is based on OpenCV you should be able to contact Frei0r developers and ask them to include the effect in Frei0r. They are very nice guys probably interested in this kind of tool. Or maybe the effect developer in Danemark would be interested to add the effect to Frei0r. You can create a ticket on Frei0r here: http://www.piksel.no/projects/frei0r/report and register the mailing list there: https://piksel.no/mailman/listinfo/frei0r-devel

When it is included in Frei0r, you can use it in Kdenlive. It is just a question of passing the information to the right persons.

Hi! Yuv motion tools coder here. Marko found me and directed my attention to the forum. He suggested to co-work on further development in whatever ways he can, which is great to hear.

Coding issues first: In hindsight mjpegtools was probably not the best choice to use, but 1) it was simple to code, and 2) I was using it at the time.
I'd be happy to port the stabilizer to frei0r. If it can function as a mjpegtool program, then surely also as a frei0r plugin.

Formalities last: I'm a bit humbled that Kdenlive has gotten so far in the years since last I saw it. And the same thing to frei0r. I must shamefully admit that I could not give much credence to any processing system which was not based on OpenGL so I abandoned any hope that FOSS video editing would ever go far. I tried Kdenlive with Frei0r plugins this evening and for the first time in years I felt fun with video stuff again.

Hi again.
I'm looking into frei0r right now.

There's another thing which could be fun to integrate - a tool I also did (once again using OpenCV) which helps place a matte painting on a background. It can't be done as a plugin since it requires user interaction, so I am only suggesting it since I can imagine the Kdenlive devs being busy on more pressing matters.

See the description here: http://vaults.atomicmonstergirls.net/useful/techworks/utilities/mattepla...
.. And see the videos in the danish blog entry here: http://www.modspil.dk/itogtech/fri_software_og_multimedier__matte_painti...

The user is required to follow a procedure:

1) Paint on the background area (thus revealing where in the image the background is), and then step forward a number of frames until the tracking points of those area are all gone (e.g. if the camera as panning to the left, the tracking points dissappear to the right). Then the user masks out more background area and so on.

2) Once a complete track is made, the tool attempt to make a "panorama shot": http://www.modspil.dk/images/matteplacer-2.png

3) The backdrop is taken to GIMP and a matte painting overlay is made which is then composited over the old background: http://www.modspil.dk/images/matteplacer-3.png. Then a frame sequence is saved and converted to video.

It is by no means perfect, e.g. the picture tends to "jump" at those frames where new tracking points are added. And the process is slow for the user given that the tool is standalone rather than integrated into a video editor. Besides (Py)GTK is rather slow to do compositing (I'm a Qt programmer now, but not then), and the tool should use multithreading.

Once again, it is only a suggestion. I would need much help from someone who knows Kdenlive well.

Regards,
Rene

Hi again.

Okay, here's my shot at it, albeit a bit hackish: Stabiliz0r (when you're in Rome...)
Tested in Arch linux and Ubuntu 9.10 (updated today). The ubuntu version uses the precompiled packages just as described in the download section of Kdenlive.
You will also need to install frei0r-plugins-dev.

You will find both the source code (untar, cd worksite/build-lingcc, make -f Makefile.frei0r) and the Ubuntu 9.10 frei0r compiled plugin here:
- Source: http://vaults.atomicmonstergirls.net/public/techworks/utilities/yuvmotio...
- Ubuntu: http://vaults.atomicmonstergirls.net/public/techworks/utilities/ubuntu-9...

I had success using stabiliz0r in Kdenlive by simply putting the plugin into ~/frei0r-1/lib. But you people are the experts on the matter.

Should show up in the effects list as Misc/Stabiliz0r.
EDIT1: I should add that performance is not the most incredible.
EDIT2: Kdenlive crashed at least on one occasion using the stabilizer. May have to do with the fact that it is slow.

Happy new year...
Centipede (Rene Jensen)

It seems the following stabilization program has not been mentioned yet

vid.stab plugin:
http://public.hronopik.de/vid.stab/

for transcode:
http://www.transcoding.org/transcode

There are two quite nice example videos on the plugin site.

this really came as a surprise to me - some time ago I have installed "trasncode" on my suse 11.1 from the rpm repositories, but never knew it included a stabilizer...

Just typed

tcmodinfo -i stabilize

and

tcmodinfo -i transform

and saw that really it was here all the time!

Ha, me too. If I've only known about that a year ago.

The more I think about it, the more I feel that stabilization belongs in a preprocessing step (along with deinterlace and denoise). It needs to be done on all clips and there is no reason why the video editor should spend precious cpu cycles on that job. EDIT: Seems there's plenty of opportunity to batch process in Kdenlive. I meant using transcode and yuvdeinterlace|yuvdenoise|yuvstabilize.

@Marko: I seem to be at odds with transcode. I can survive controlling ffmpeg and mencoder, but I can't seem to construct a command line which will play my clips properly. I'd like to see the result and speed of the transcode stabilizer. It is quite a bit more mature (although thinking along the terms of OpenCV might in the long run yield some added benefits). What command line do you use to play PAL-DV videos to the screen?

Cheers

Answering my own question, here's what I use (mostly just for future google searches). It looks nice I think. The good thing about a two-phase process is that it allows the stabilizer to react prior to an event.

transcode -H0 -i INFILE -x mplayer,mplayer -J smartyuv=highq=1:diffmode=2:cubic=1:Blend=1:chromathres=4:threshold=8:doChroma=1 -J stabilize -y null,null -o dummy
transcode -H0 -i INFILE -x mplayer,mplayer -J smartyuv=highq=1:diffmode=2:cubic=1:Blend=1:chromathres=4:threshold=8:doChroma=1 -J transform -o OUTFILE -y ffmpeg,ffmpeg -F huffyuv

The deinterlace filter doesn't give me the best results. I'm fouling up the parameters..

Hi everyone!
I'm interested in an easy way to stabilize my videos and this thread is very interesting.

@centipede: You said that you have only placed stabiliz0r.so into ~/frei0r-1/lib and that you were able to see the plugin?
Because I did that, after installing frei0r-dev, and it did nothing.

Using transcode, do I have to add a profile in Settings/Configure Kdenlive/Transcode? If yes, could you tell me exactly what I need to do.
I don't use kdenlive for a long time so I don't really know how it works under.

Thanks for you help
nanolight

I've tried the two stabilization commands as follows:

transcode -H0 -i INFILE -x mplayer,mplayer -J smartyuv=highq=1:diffmode=2:cubic=1:Blend=1:chromathres=4:threshold=8:doChroma=1 -J stabilize -y null,null -o dummy
transcode -H0 -i INFILE -x mplayer,mplayer -J smartyuv=highq=1:diffmode=2:cubic=1:Blend=1:chromathres=4:threshold=8:doChroma=1 -J transform -o OUTFILE -y ffmpeg,ffmpeg -F huffyuv

And my resulting file is just coloured snow. Here are my outputs from the two commands:

For the first statement: transcode -H0 -i INFILE -x mplayer,mplayer -J smartyuv=highq=1:diffmode=2:cubic=1:Blend=1:chromathres=4:threshold=8:doChroma=1 -J stabilize -y null,null -o dummy

I get:

keithclark@HP1211N:~/Videos/Home Video/22 January 2010$ transcode -H0 -i VID00003.MP4 -x mplayer,mplayer -J smartyuv=highq=1:diffmode=2:cubic=1:Blend=1:chromathres=4:threshold=8:doChroma=1 -J stabilize -y null,null -o dummy
transcode v1.1.4 (C) 2001-2003 Thomas Oestreich, 2003-2009 Transcode Team
[transcode] V: AV demux/sync | (1) sync AV at initial MPEG sequence
[transcode] V: import frame | 720x576 1.25:1 encoded @ UNKNOWN
[transcode] V: bits/pixel | 0.174
[transcode] V: decoding fps,frc | 25.000,0
[transcode] V: video format | YUV420 (4:2:0) aka I420
[transcode] A: import format | 0x2000 AC3 [48000,16,2]
[transcode] A: export | disabled
[transcode] V: encoding fps,frc | 25.000,3
[transcode] A: bytes per frame | 7680 (7680.000000)
[transcode] A: adjustment | 0@1000
[transcode] V: IA32/AMD64 accel | sse3 sse2 sse 3dnowext 3dnow mmxext mmx cmove asm
[transcode] V: video buffer | 10 @ 720x576 [0x2]
[transcode] A: audio buffer | 10 @ 48000x2x16
[import_mplayer.so] v0.1.2 (2007-11-01) (video) rendered by mplayer | (audio) rendered by mplayer
[filter_smartyuv.so] options=highq=1:diffmode=2:cubic=1:Blend=1:chromathres=4:threshold=8:doChroma=1
[filter_smartyuv.so] (MMX) 0.1.6 (2007-05-31) Motion-adaptive deinterlacing
[filter_stabilize.so] v0.4.3 (2008-11-30) extracts relative transformations of
subsequent frames (used for stabilization together with the
transform filter in a second pass)
[filter_stabilize.so] Image Stabilization Settings:
[filter_stabilize.so] maxshift = 48
[filter_stabilize.so] stepsize = 2
[filter_stabilize.so] allowmax = 1
[filter_stabilize.so] algo = 1
[filter_stabilize.so] fieldsetup = 3
[filter_stabilize.so] fieldsize = 57
[filter_stabilize.so] result = VID00003.MP4.trf
[export_null.so] v0.1.2 (2001-08-17) (video) null | (audio) null
[import_mplayer.so] mplayer -slave -hardframedrop -vo null -ao pcm:nowaveheader:file="/tmp/mplayer2transcode-audio.4HYsNd" "VID00003.MP4" > /dev/null 2>&1
[import_mplayer.so] tcextract -i /tmp/mplayer2transcode-audio.4HYsNd -x pcm -t raw
[import_mplayer.so] mplayer -slave -benchmark -noframedrop -nosound -vo yuv4mpeg:file=/tmp/mplayer2transcode-video.Kyaf3X "VID00003.MP4" -osdlevel 0 > /dev/null 2>&1
[import_mplayer.so] tcextract -i /tmp/mplayer2transcode-video.Kyaf3X -x yuv420p -t yuv4mpeg
[decoder.c] cancelling the import threads 0:00:32, (17| 0| 3)

[transcode] encoded 822 frames (0 dropped, 0 cloned), clip length 32.88 s

*************************************************************************

For the second statement: transcode -H0 -i INFILE -x mplayer,mplayer -J smartyuv=highq=1:diffmode=2:cubic=1:Blend=1:chromathres=4:threshold=8:doChroma=1 -J transform -o OUTFILE -y ffmpeg,ffmpeg -F huffyuv

I get:

keithclark@HP1211N:~/Videos/Home Video/22 January 2010$ transcode -H0 -i VID00003.MP4 -x mplayer,mplayer -J smartyuv=highq=1:diffmode=2:cubic=1:Blend=1:chromathres=4:threshold=8:doChroma=1 -J transform -o VID00003_STAB.MP4 -y ffmpeg,ffmpeg -F huffyuv
transcode v1.1.4 (C) 2001-2003 Thomas Oestreich, 2003-2009 Transcode Team
[transcode] V: AV demux/sync | (1) sync AV at initial MPEG sequence
[transcode] V: import frame | 720x576 1.25:1 encoded @ UNKNOWN
[transcode] V: bits/pixel | 0.174
[transcode] V: decoding fps,frc | 25.000,0
[transcode] V: video format | YUV420 (4:2:0) aka I420
[transcode] A: import format | 0x2000 AC3 [48000,16,2]
[transcode] A: export format | 0x55 MPEG ES Layer 3 [48000,16,2] 128 kbps
[transcode] V: export format | unknown (module dependant)
[transcode] V: encoding fps,frc | 25.000,3
[transcode] A: bytes per frame | 7680 (7680.000000)
[transcode] A: adjustment | 0@1000
[transcode] V: IA32/AMD64 accel | sse3 sse2 sse 3dnowext 3dnow mmxext mmx cmove asm
[transcode] V: video buffer | 10 @ 720x576 [0x2]
[transcode] A: audio buffer | 10 @ 48000x2x16
[import_mplayer.so] v0.1.2 (2007-11-01) (video) rendered by mplayer | (audio) rendered by mplayer
[filter_smartyuv.so] options=highq=1:diffmode=2:cubic=1:Blend=1:chromathres=4:threshold=8:doChroma=1
[filter_smartyuv.so] (MMX) 0.1.6 (2007-05-31) Motion-adaptive deinterlacing
[filter_transform.so] v0.4.4 (2008-12-06) transforms each frame according to transformations
given in an input file (e.g. translation, rotate) see also filter stabilize
[filter_transform.so] Image Transformation/Stabilization Settings:
[filter_transform.so] maxshift = -1
[filter_transform.so] maxangle = -1.000000
[filter_transform.so] smoothing = 10
[filter_transform.so] crop = Keep
[filter_transform.so] relative = True
[filter_transform.so] invert = False
[filter_transform.so] input = VID00003.MP4.trf
[export_ffmpeg.so] v0.3.18 (2008-11-29) (video) Lavc52.20.0 | (audio) MPEG/AC3/PCM
[import_mplayer.so] mplayer -slave -hardframedrop -vo null -ao pcm:nowaveheader:file="/tmp/mplayer2transcode-audio.LIQeMN" "VID00003.MP4" > /dev/null 2>&1
[import_mplayer.so] tcextract -i /tmp/mplayer2transcode-audio.LIQeMN -x pcm -t raw
[import_mplayer.so] mplayer -slave -benchmark -noframedrop -nosound -vo yuv4mpeg:file=/tmp/mplayer2transcode-video.1ZLzyO "VID00003.MP4" -osdlevel 0 > /dev/null 2>&1
[import_mplayer.so] tcextract -i /tmp/mplayer2transcode-video.1ZLzyO -x yuv420p -t yuv4mpeg
[export_ffmpeg.so] Using FFMPEG codec 'huffyuv' (FourCC 'HFYU', Lossless HUFFYUV codec).
[export_ffmpeg.so] No profile selected
[export_ffmpeg.so] warning: Error opening configuration file ./ffmpeg.cfg: No such file or directory
[export_ffmpeg.so] Starting 1 thread(s)
[export_ffmpeg.so] Set display aspect ratio to input
[huffyuv @ 0x20e5470]using huffyuv 2.2.0 or newer interlacing flag
[export_ffmpeg.so] warning: Usage of this module for audio encoding is deprecated.
[export_ffmpeg.so] warning: Consider switch to export_tcaud module.
[transcode] Audio: using lame-3.98.2
[decoder.c] cancelling the import threads 0:00:32, (17| 0| 3)

[transcode] encoded 822 frames (0 dropped, 0 cloned), clip length 32.88 s

I also tried the transcode and vid.stab commands above but all I get is these messages:

[filter_stabilize.so] warning: too low contrast! No field remains. Use larger fild size.

and a noise like output file. This was with transcode version 1.1.5 with vid.stab 0.75 patch.

Does anyone know a working transcode version with or without patches?

I use the same version Transcode under suse 11.1 64 bit, and it works quite well.
Example of commandline (INFILE is an already deinterlaced DV input file):

transcode -H0 -i INFILE.avi -x mplayer,mplayer -J stabilize -y null,null -o dummy

then

transcode -H0 -i INFILE.avi -x mplayer,mplayer -J transform -o OUTFILE -y ffmpeg,ffmpeg -F huffyuv

Did you try another input file? The "too low contrast" message sounds as if it did't like the video you gave it?

Ok, the commands do work for me but only on one type of input files:

mpeg2video, yuv420p, 720x576

On input files like these it fails and shows only bad looking colored stripes in output files:

Video: h264, yuv420p, 1280x720
Video: mjpeg, yuvj420p, 1280x720
Video: dnxhd, yuv422p, 1920x1080
Video: h264, yuv420p, 1920x1080

And complaints like:

[filter_stabilize.so] warning: too low contrast! No field remains.
(no translations are detected in frame 9)
[filter_stabilize.so] warning: too low contrast! No field remains.
(no translations are detected in frame 11)
[filter_stabilize.so] warning: too low contrast! No field remains.
(no translations are detected in frame 13)
[filter_stabilize.so] warning: too low contrast! No field remains.
(no translations are detected in frame 15)
[filter_stabilize.so] warning: too low contrast! No field remains

I was hoping that any input which I can view with mplayer and ffmpeg would work with transcode, but I guess I was wrong.
Looking at the transcode manual page, maybe I need to tell all the codec and frame size details to it, and it defaults to PAL.

Has anyone been lucky with HD file formats as input?

You have to tell Transcode the size of your video. For stuff from my Canon HV30 (HDV format) I use:

transcode -H0 -g 1440x1080 -i dvgrab-020.m2t -x mplayer,mplayer -J stabilize -y null,null -o dummy

then

transcode -H0 -g 1440x1080 -i dvgrab-020.m2t -x mplayer,mplayer -J transform -o OUTFILE -y ffmpeg,ffmpeg -F huffyuv

and get a beer from the fridge, since it isn't supersonic! On my machine (AMD athlon 64 X2 4400+) the first pass runs at 0.8 fps and the second at 2 fps.

The aspect ratio gets lost somewhere in the process, I did try to run the second pass with --export_asr 3, but it did not help.

To get the correct apect ratio in Kdenlive, I have to right click on the clip in the project tree window, go to "Clip Properties", then "Advanced" and set "Force pixel aspect ratio" to 1.33.

Maybe specifying a different output format in the second pass of stabilization would fix this... (you might want to do this anyway for the sake of file size, I just want to avoid another re-coding loss...)
For square pixel formats (AVHCD?) this should not be a problem anyway...

Marko, Thanks for the info, I'm going to try this tonight. I've got the same camera and have been wanting to stabilize stuff. Geoff

BTW, I use my HV30 in progressive mode, if you shoot interlaced, you might want to deinterlace first. (for SD I used avidemux yadif, don't know about HD...)

Transcode does have its own deinterlacer, which you can put into the pipeline before stabilization, but I never used it, so can't give any hints on that...

I tried transcode using the commands Marco supplied and it does render and work, but the output does not look good as if it has had too much correction applied and is blurry. Do you know how to add options to the command to try and tweak the stabilizatio?. Something like -J stabilize OPTION OPTIONARG ? I've tried several combinations and it doesn't seem to like them. I can see options here: tcmodinfo -i stabilize

Any help appreciated. Thanks, Geoff

Maybe you shot your video in lower light, and the exposure time was longer, causing motion blur on the shake? Stabilization can not remove that...
Can you put (a single frame of) the stabilized video somewhere to see?

Here is an example (before and after) of how it works here:

http://lea.hamradio.si/~s57uuu/video/unstab.png
http://lea.hamradio.si/~s57uuu/video/stab.png

This was a rather shaky handheld shot at the long end of the zoom.
(the additional zoom is done by the stabilizer to hide the empty borders, it can be switched off)

Is your plugin still up anywhere? I tried clicking on your links and got a 404

The only thing that could be used as a plugin in Kdenlive, is centipede's code (message #30 above) - it is not included in the official Frei0r set.

Otherwise, we were mostly discussing the stabilzer function of "transcode", this is also what the above command lines and examples refer to.

P.S if you meant the above links to .png images, they seem to be Ok here...

The code in message #30 isn't loading. It seems like that site is down and I was wondering if anyone had grabbed the code before it went.

I'll try the plugin too

Until you get the more direct method of stabilization working, you can use VirtualDub running under wine with the Deshakerplugin (which is what I use). I wrote a guide for it here: http://forums.opensuse.org/english/information-new-users/unreviewed-how-... ... and while I did this on openSUSE I am fairly confident the same method should work on all Linux distributions.

Note there is now version 2.5 of deshaker plugin for VirtualDub (which runs under wine) available and I note a change for the C++ and MCF libraries for the version-2.5 change history, and that may make unnecessazry a couple of the steps [ie step-3 and step-4] that I have in my guide above (ie maybe they are not needed for VirtualDub version-2.5).

There have been so many advances in kdenlive over the years, that it is approaching the time where the addition of stabilization (as opposed to using a work around method such as wine) may indeed be one of the more helpful updates it could incorporate (if it becomes feasible).

Good luck.

So, I'm trying to figure out how to use the transcode command line program but I'm getting nowhere. I'm working with this video http://www.hellocatfood.com/misc/untitled.avi

First I run transcode -H0 -g 640x480 -i untitled.avi -x mplayer,mplayer -J stabilize -y null,null -o dummy and get flooded with this warning: [filter_stabilize.so] warning: unsupported Codec: 2

I then run transcode -H0 -g 640x480 -i untitled.avi -x mplayer,mplayer -J transform -o output.avi -y ffmpeg,ffmpeg -F huffyuv and get flooded with this warning [filter_transform.so] critical: not enough transforms found!6)

The output file plays fine but hasn't been stabilized. Can anyone help me figure out why I'm getting all of these error messages?

As far as Mplayer says, your video is 720x576, not 640x480.
Transcode can work on this size by default, so you can eliminate the -g alltogether.
(but this does not seem probable to cause a "missing codec" error... maybe your ffmpeg is faulty?)

I tried:

transcode -H0 -i untitled.avi -x mplayer,mplayer -J stabilize -y null,null -o dummy

and

transcode -H0 -i untitled.avi -x mplayer,mplayer -J transform -o OUTFILE -y ffmpeg,ffmpeg -F huffyuv

and it worked well.
Of course, with such extremely shaky video, the results aren't perfect, especially the rolling shutter "squishing" is quite prominent.

The virtual dub's deshaker does have a rolling shutter compensation option, will try that when I'll have time, just to compare the results...

Pages