This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Image Stabilization

Tags: None
(comma "," separated)
markoc
Registered Member
Posts
342
Karma
1

Re: Image Stabilization

Wed Jun 16, 2010 7:20 pm
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?



mcfrisk
Registered Member
Posts
40
Karma
0

Re: Image Stabilization

Thu Jun 17, 2010 10:21 pm
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?


markoc
Registered Member
Posts
342
Karma
1

Re: Image Stabilization

Sat Jun 19, 2010 7:52 am
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...


geoffrey
Registered Member
Posts
100
Karma
0

Re: Image Stabilization

Sat Jun 19, 2010 1:48 pm
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


markoc
Registered Member
Posts
342
Karma
1

Re: Image Stabilization

Sat Jun 19, 2010 4:07 pm
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...

geoffrey
Registered Member
Posts
100
Karma
0

Re: Image Stabilization

Sat Jun 19, 2010 5:03 pm
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


markoc
Registered Member
Posts
342
Karma
1

Re: Image Stabilization

Sat Jun 19, 2010 5:15 pm
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)
hellocatfood
Registered Member
Posts
24
Karma
0

Re: Image Stabilization

Mon Sep 13, 2010 1:02 pm
Is your plugin still up anywhere? I tried clicking on your links and got a 404
markoc
Registered Member
Posts
342
Karma
1

Re: Image Stabilization

Mon Sep 13, 2010 2:32 pm
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...
hellocatfood
Registered Member
Posts
24
Karma
0

Re: Image Stabilization

Tue Sep 14, 2010 8:17 pm
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
oldcpu_drupal
Registered Member
Posts
87
Karma
0

Re: Image Stabilization

Thu Sep 16, 2010 1:23 am
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-faq/429428-howto-install-virtualdub-under-wine-deshaker-plugin.html ... 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.


hellocatfood
Registered Member
Posts
24
Karma
0

Re: Image Stabilization

Sat Sep 18, 2010 11:48 pm
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?
markoc
Registered Member
Posts
342
Karma
1

Re: Image Stabilization

Sun Sep 19, 2010 9:38 am
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...
hellocatfood
Registered Member
Posts
24
Karma
0

Re: Image Stabilization

Sun Sep 19, 2010 10:23 am
I just tried those exact two codes and still got a brightly coloured glitchy video. Gonna investigate ffmpeg problems.

I'm not a linux nut, but I just prefer to use native applications, but in this situation looks like virtualdub is the only good option!

Would you be able to send me your output video so I can compare?
yellow_drupal
Registered Member
Posts
748
Karma
0

Re: Image Stabilization

Sun Sep 19, 2010 10:57 am
I've used the Deshaker plugin, but there are a few caveats unless things have changed in recent times. Those are:

Deshaker plugin works in RGB colourspace only, no YCbCr, YV12 or YUY2.

VirtualDub will scale the levels when it converts video colour spaces to RGB which is far from desirable, so best to use AVISynth to do a full range conversion, preferably via 3D LUT.

It is also (for me anyway) not desirable to do multiple transcoding and poor colour space conversions through the tool chain just to try and deshake a video that I really should have used either in built camera IS or tripod or rig. :-)

Finally Deshaker works best with video shot at high shutter speeds at and above 1/200th/sec which is total nonsense with regard to sticking to 180deg shutter rule, ie if your shooting 25fps then the shutter speed would be 1/50th/sec, if shooting at 60fps (for smooth slow motion as example) the shutter speed would be 125th/sec. I never get anywhere near 1/200th, thats nuts.

Most important though to me anyway is to first convert to uncompressed image sequences and a proxy at the same time, using AVISynth to do the colour space conversion to RGB, full range levels, then deshake in VDub, then continue with image sequences right through to final encode back to delivery codec like h264, whatever.

I've had mixed success, minor stabilisation is ok, rolling shutter jelly cam stays just that. :-(


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], kde-naveen, Sogou [Bot]