how does Youtube's or iMovie's auto stabilization works?

Discussion in 'Digital Video' started by Quotenfrau, May 15, 2012.

  1. Quotenfrau macrumors 6502

    Quotenfrau

    Joined:
    Mar 6, 2011
    #1
    Hi

    I stabilized several videos with Youtube and iMovie. See Apple KB.

    But how does this technically works? The results are pretty good :) Are there other software with better results?
     
  2. kevinfulton.ca macrumors 6502

    Joined:
    Aug 29, 2011
    #2
    It finds an anchor point within the frame and zooms in. It then tracks that point and tries keep it in the center of the frame. The more that point moves around the more iMovie zooms in. It's tough to explain so I hope that makes sense. If you really want a visual I'd suggest filming a hand held shot using your iPhone (since that should give youn some nice shaky video) and fixate on one angle with a pole or something near the edge of the frame for reference. Bring it into iMovie and crank the stabilization zoom and watch it react to the footage. You'll see it zoom in and out and shift like crazy. That's how I figured it out and it pushed me harder to get or make a hand held stabilizer.

    I believe After Effects has a more advanced stabilizing tool, but if I were you I'd sooner invest in a tripod or hand held stabilizer. They're less expensive and your results will be higher quality.
     
  3. LethalWolfe macrumors G3

    LethalWolfe

    Joined:
    Jan 11, 2002
    Location:
    Los Angeles
    #3
    As kevinfulton.ca says it finds a point to use as a reference and then moves the frame (including rotating it) to try and counteract the shakiness in the image. The reason for the zooming in is that as the image is moved around the edges of the image come into frame so you have to zoom in to get the back out of frame.


    Lethal
     
  4. Quotenfrau thread starter macrumors 6502

    Quotenfrau

    Joined:
    Mar 6, 2011
  5. senseless macrumors 68000

    senseless

    Joined:
    Apr 23, 2008
    Location:
    Pennsylvania, USA
    #5
    It would be nice if they used this technology in Hollywood. Most of the hand held camera work looks very amateur.
     
  6. btbrossard macrumors 6502a

    Joined:
    Oct 25, 2008
    Location:
    Chicagoland
    #6
    I think that's part of the effect.
     
  7. senseless macrumors 68000

    senseless

    Joined:
    Apr 23, 2008
    Location:
    Pennsylvania, USA
    #7
    In a couple of years, shaky cam will look like a 1968 movie. How can people not find this distracting?
     
  8. btbrossard macrumors 6502a

    Joined:
    Oct 25, 2008
    Location:
    Chicagoland
    #8
    I find it horribly distracting. I can't remember what movie I watched recently, but the shaky cam started almost right away and it completely pulled me out of the movie.

    Not everything has to look like an episode of cops.
     
  9. senseless macrumors 68000

    senseless

    Joined:
    Apr 23, 2008
    Location:
    Pennsylvania, USA
  10. WhyMack macrumors newbie

    Joined:
    May 28, 2009
    #10
    What did you think of the shaky camera in Hunger Games?

    ...could it have been Hunger Games?

    The shaky hand-held camera style bothered me immediately in Hunger Games as totally unnecessary in telling the story, and only pulled me out thinking it was the 1990s-style all over again! Hated it!
     
  11. btbrossard macrumors 6502a

    Joined:
    Oct 25, 2008
    Location:
    Chicagoland
    #11
    I think it was.
     
  12. LethalWolfe macrumors G3

    LethalWolfe

    Joined:
    Jan 11, 2002
    Location:
    Los Angeles
    #12
    The shakey-cam in Hunger Games has become infamous for being excessive and unmotivated.


    Lethal
     
  13. -hh macrumors 68020

    -hh

    Joined:
    Jul 17, 2001
    Location:
    NJ Highlands, Earth
    #13
    Of course, the devil is in the details as to how one finds an 'anchor point'.

    The way it was explained to me was that each frame undergoes a calculation using Fourier Transforms, and the FT value is basically what's used for this value; the differences in the frame-to-frame value of the FT calculuation is indicative of how much the 2nd frame shifted vs frame #1 (think simple subtraction to get the stabilization offset). Then frame #3 can be done, #4, #5, etc.

    To illustrate by analogy, envison one's frame of view for an image to be one playing card...the King of Clubs.

    Take the King of Clubs (Card #1) and now place the Queen of Diamonds (Card #2 - yes, the next frame of video) on top of #1 ... randomly.

    This randomness is your "shake". Thinking in geometric terms, we can quantify the misallignment of the two cards as an (X, Y) offset & a rotation.

    Now if we visually look at the cards, we can see part of the King sticking out from under the Queen - that's the misalligment, so what we will end up doing to make a stabilized view is that we'll pull out a knife and cut (think of this as a "crop") away any part of card #1 (the King) that you see sticking out from under #2 (Queen) ... but we're only halfway: flip the stack over, and now cut away any part of card #2 (the Queen) that you see sticking out from under the previously-trimmed card #1 (King). Now, you have two pieces of cards that are identically shaped, but neither which is fully whole anymore. Congratulations, you now have a stabilized two frame movie.

    Now toss on the Jack of Spades (Card#3) and cut again, both sides. Then the Ace of Hearts (Card #4), cut both sides again, etc.

    Now take a look at your four card stack ... its probably smaller than the first two cards, isn't it?

    Plus, you've also lost your 4:3 (or 16:9) ratio, so you can recognize that more cropping will be required to get back to your 4:3 (or 16:9) ratio will be an eventuality. That will be done at the end, to minimize data loss.

    This is where the very basics end and the post processing becomes even more interesting - - how does one want to proceed without the field of view becoming increasingly smaller and smaller? One choice is to use a moving average on these stacks of images, which is effectively saying that we permit the center (X,Y) position of the view shift slowly across the video. Unfortunately, the analogy of an exacto knife won't cut it anymore.

    Okay, time to get a fresh deck of playing cards. The deck of 52 playing cards that represents 52 frames of a video. If it is a perfect stack, then the image has no shake - every location on the top card has the other 51 cards underneath it, so any stabilization "crop" would be zero.

    Now manipulate the card deck in a couple of different ways ... but make them smooth, such as the whole deck on a nice even slant at a 45 degree angle: you can envision your knife cut as being vertical slice, which would take a good chunk out of your deck on both ends ... but on the other hand, if you allowed a 1/16" offset between each card, you might not have to cut them down at all ... the knife cut analogy would be a slant. If you go a step further, you can see that this 1/16 " offset could be a mathmatical moving average ... the knife cut could be vertical when it needs to be, and then slant, etc. There's a lot of mathmatical tricks that one can apply.

    But wait, there's more: there's also a pretty common way to cheat outright, which is to "recreate" (or if you prefer, "fake") the missing data in a frame. Basically, if a frame has the missing data that would cause a serious chop, one can look at nearby frames (not too temporally distant - - ie, not too many cards away in our deck), and then copy in that other data to fill in for the missing data (...and miniize the "crop") with the catch being that you will need to hope that nobody notices that the addition is data added from some other time.

    A stand-alone video stabilizer that's I've tried that's probably worth trying out (they have a free demo) is iStabilize. FWIW, I don't know specifically how this stabilizer works or what tricks it may use (more might be in their documentation), but I do recall a pretty interesting UI where it kind of showed you what it was going to return from an analyzed clip, and it offered some different settings to play with.


    -hh
     

Share This Page