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

Stabilization

Tags: None
(comma "," separated)
Logarifm
Registered Member
Posts
9
Karma
0

Stabilization

Tue Dec 16, 2014 10:29 am
Hi all!

I have been waiting for bugless video stabilization for ages. Now I am on 0.9.10. We finally have a new vid.stab script and its really good! But there are actually NO possibility to apply it to the video:

1) Clip jobs -> Stabilize. Failed. Each video now should have a motion file (vidstab.trf by default). In previous versions all motions was in .mlt file, but now it in external file (vidstab.trf by default). So now all clips overwrite this file one by one and as a result NO stabilization for > 1 clips.

2) I tried to use /usr/bin/melt -filter vidstab [..] filename=name.trf -consumer xml:FILE0004.MOV.mlt all=1 and type and individual trf file for each clip. When I add this file to project it usually writes "Bad frame sequence". God knows why...

3) Finally, I saw an effect called "vid.stab". There are two effects in "others" group. But the first one could not be applied on video (undefined error). And the second one just... dont work. At all! It produce no effect.

How can I help the project? I can test something or open a bug if someone tell me the right way to do it.
User avatar
ttguy
Moderator
Posts
1152
Karma
6
OS

Re: Stabilization

Tue Dec 16, 2014 10:54 am
Clip jobs -> Stabilize and select add clip to project. A .mlt file will be added to the project for every statilize job you run. The .mlt file will be named after the clip you stabilised. This is all working for me on 0.9.10
Logarifm
Registered Member
Posts
9
Karma
0

Re: Stabilization

Tue Dec 16, 2014 12:32 pm
ttguy wrote:Clip jobs -> Stabilize and select add clip to project. A .mlt file will be added to the project for every statilize job you run. The .mlt file will be named after the clip you stabilised. This is all working for me on 0.9.10


Thank you for your reply! There is one small problem I mentioned above:
Each video now should have a motion file (vidstab.trf by default). In previous versions (<0.9.10) all motions was in .mlt file, but now they are in external file (vidstab.trf by default). So now all clips overwrite this file one by one and as a result NO stabilization for > 1 clips.


This vidstab.trf file is in your home directory. Please, check that is overwrites after every clip job-> stabilize. So its OK only if we have 1 clip.
hcooper
Registered Member
Posts
3
Karma
0

Re: Stabilization

Wed Dec 17, 2014 9:50 pm
I can confirm this problem too - each stabilization overwrites the last, because the stabilization data is written to ~/vidstab.trf (which the mlt file reads from).

I have never touched the kdenlive code before, but I might go searching for the source of this problem shortly.

Ubuntu 14.04, kdenlive 0.9.10 from http://ppa.launchpad.net/sunab/kdenlive-release/ubuntu
hcooper
Registered Member
Posts
3
Karma
0

Re: Stabilization

Thu Dec 18, 2014 1:14 am
I discovered that if no filename is provides to vidstab it defaults to vidstab.trf.

I've made this patch that adds a filename parameter that is passed to vidstab, based upon the `dest_url` of the mlt file.

However it only works for individual clips. If you select multiple clips at once, it will still incorrectly write them to a single file. I don't have an immediate fix for this, but it's caused by the code directly above the patch, which makes `dest_url` a path rather than a path+filename if `m_urls.count` is >1.

I hope this is enough of a pointer for a more robust fix to come shortly :-)

(Also filed a bug https://bugs.kdenlive.org/view.php?id=3418)
Logarifm
Registered Member
Posts
9
Karma
0

Re: Stabilization

Thu Dec 18, 2014 5:07 am
Dear hcooper,

Thank you for your wonderful work!

Finally, now Im using console command "/melt -filter vidstab [..] filename=name.trf -consumer xml:FILE0004.MOV.mlt all=1" to use individual trf file, but still there are two problems:

1) Stabilization doesn't produce any effect on some clips in the output file. So I use .mlt file in a project and its stabilized as I can clearly see from project monitor. I make an output .mp4 file and see that these is no stabilization at all!

2) "Bad frame sequence" for some files. I don't know that is it and I don't know how to fix it.

PS: I also mentioned that during compiling output melt rebuilding all .trf files. And their size is different from the original.

PPS: I also find a one more bug in kdenlive. If I change "root" in .mlt file, kdenlive doesn't recognize it. It will search for .trf file always in ~ directory, it ignores that I write ~/video-edit/ for a root
<?xml version="1.0" encoding="utf-8"?>
<mlt LC_NUMERIC="ru_RU.UTF-8" version="0.9.3" root="/home/senator/Video-Edit/japan" title="FILE0211.MOV">
....
<tractor id="tractor0" title="FILE0211.MOV" global_feed="1" in="0" out="646">
<track producer="playlist0"/>
<filter id="filter0">
<property name="track">0</property>
<property name="filename">211.trf</property>
....

Last edited by Logarifm on Fri Dec 19, 2014 5:35 am, edited 1 time in total.
User avatar
ttguy
Moderator
Posts
1152
Karma
6
OS

Re: Stabilization

Thu Dec 18, 2014 9:25 pm
Hi hcooper,
Good work on that patch as a pointer as to how to fix this.
I think the actual place to fix this is in project/projectlist.cpp
void ProjectList::processClipJob()
with something like this - which does not work yet. Job arguments are not set up right. And I have to go to my real job now. Feel free to fix my fix while I am at work :)

Code: Select all
        if (ids.count() == 1) {
            jobArgs << consumer + ':' + destination;
            if (description=="Stabilize clip")
            {
                QString filename = destination + ".trf";
                kDebug()<<"// job arg: "<< QString("filename=%1").arg(filename);
                jobArgs <<  QString("filename=%1").arg(filename);
            }
        }
        else {
          jobArgs << consumer + ':' + destination + item->clipUrl().fileName() + ".mlt";
          if (description=="Stabilize clip")
          {
              QString filename = QString(destination + item->clipUrl().fileName() + ".mlt").append(".trf");
              kDebug()<<"// job arg: "<< QString("filename=%1").arg(filename);
              jobArgs <<  QString("filename=%1").arg(filename);
          }
        }
hcooper
Registered Member
Posts
3
Karma
0

Re: Stabilization

Fri Dec 19, 2014 4:16 pm
Thanks for the pointer, I think I've made a fully functioning patch.

Here's the debug output after sending three clips at once to be stabilized: http://pastebin.com/ZeP5bKUz
User avatar
ttguy
Moderator
Posts
1152
Karma
6
OS

Re: Stabilization

Fri Dec 19, 2014 8:37 pm
hcooper wrote:I think I've made a fully functioning patch.

I have implemented your patch on my local build and I believe it works.

Do you want to submit it to reviewboard.kde.org or would you like me to ?
Logarifm
Registered Member
Posts
9
Karma
0

Re: Stabilization

Mon Dec 22, 2014 5:15 am
Thank you for your work!

Could you check the bug with root path in mlt file as well? Thank you in advance!

If I change "root" in .mlt file, kdenlive doesn't recognize it. It will search for .trf file always in ~ directory, it ignores that I write ~/video-edit/ for a root. EX:

<?xml version="1.0" encoding="utf-8"?>
<mlt LC_NUMERIC="ru_RU.UTF-8" version="0.9.3" root="/home/senator/Video-Edit/japan" title="FILE0211.MOV">
....
<tractor id="tractor0" title="FILE0211.MOV" global_feed="1" in="0" out="646">
<track producer="playlist0"/>
<filter id="filter0">
<property name="track">0</property>
<property name="filename">211.trf</property>
....

It will search for 211.trf in home directory!
User avatar
ttguy
Moderator
Posts
1152
Karma
6
OS

Re: Stabilization

Mon Dec 22, 2014 9:09 am
Logarifm wrote:Could you check the bug with root path in mlt file as well? Thank you in advance!


I am not sure we suport hand editing of the .mlt files.
I don't actually have any ideas what the root attribute is for. I don't have mlt file specs so I don't know what that attribute is for. So I won't be messing with it.
Logarifm
Registered Member
Posts
9
Karma
0

Re: Stabilization

Mon Dec 22, 2014 11:45 am
Well, this it not "hand editing", that file was produced by command like this: /usr/bin/melt -filter vidstab [..] filename=name.trf -consumer xml:FILE0021.MOV.mlt all=1

OK, anyway, I just want to help the project =)

Well, now I have only one last question: That is "Bad frame sequence"? I could not find any information concerning this error.
User avatar
ttguy
Moderator
Posts
1152
Karma
6
OS

Re: Stabilization

Mon Dec 22, 2014 12:40 pm
Logarifm wrote:/usr/bin/melt -filter vidstab [..] filename=name.trf -consumer xml:FILE0021.MOV.mlt all=1


In that case you could report a bug to the melt project http://sourceforge.net/p/mlt/bugs/?source=navbar
User avatar
ttguy
Moderator
Posts
1152
Karma
6
OS

Re: Stabilization

Mon Dec 22, 2014 12:42 pm
Logarifm wrote:Well, now I have only one last question: That is "Bad frame sequence"? I could not find any information concerning this error.

I dunno what this is - sorry.
User avatar
Steve Guilford
Registered Member
Posts
207
Karma
0

Re: Stabilization

Mon Dec 22, 2014 3:59 pm
ttguy wrote:
Logarifm wrote:Well, now I have only one last question: That is "Bad frame sequence"? I could not find any information concerning this error.

I dunno what this is - sorry.


That emanates from MLT.

Code: Select all
   // If any frames are skipped, analysis data will be incomplete.
   if( data->analyze_data && pos != data->analyze_data->last_position + 1 )
   {
      mlt_log_error( MLT_FILTER_SERVICE(filter), "Bad frame sequence\n" );
      destory_analyze_data( data->analyze_data );
      data->analyze_data = NULL;
   }


Its probably a warning message.


Bookmarks



Who is online

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