CyberLink Community Forum
where the experts meet
| Advanced Search >
Apply stabilization outside the video crop frame
Reply to this topic
AllanSmithee [Avatar]
Member Private Message Joined: Mar 13, 2015 19:16 Messages: 54 Offline
[Post New]
Currently when we crop in PD13 all the applied effects are ignored. As a result, if you stabilize before you crop (or vise versa) you don't know what the final video resolution will be.

Thing is, when you crop the video, you have all this excess, waste footage on the periphery of your video. Hence is there a way to tell PD to apply the stabilization using this excess, rather than cropping even more inside of the already cropped frame?

Ultimately what I'm trying to do is apply image stabilization and crop the video to zoom in thus ending at a video of 720p native resolution.

Thanks
Reply
JL_JL [Avatar]
Senior Contributor Private Message Location: Arizona, USA Joined: Oct 01, 2006 20:01 Messages: 5797 Offline
[Post New]
Quote: Thing is, when you crop the video, you have all this excess, waste footage on the periphery of your video. Hence is there a way to tell PD to apply the stabilization using this excess, rather than cropping even more inside of the already cropped frame?


Only in a two step process.
1) Apply the stabilization to the clips that you desire and then "Produce" a video in the same or higher format specifications as your desired final project output.
2) Bring the stablized footage into your real project and then crop as desired.

Jeff
Reply
AllanSmithee [Avatar]
Member Private Message Joined: Mar 13, 2015 19:16 Messages: 54 Offline
[Post New]
That's what I thought. The problem with that approach is that step 1 will result in a slight amount of upsampling, then with step 2 you still don't end up with the native resolution you desire.

Let's say you start with 1080p video. Applying image stabilization will trim a few pixels off the borders (who knows how many), resulting in slightly lower than 1920x1080 native resolution. You can't simply save the video file(s) as-is (without producing) or produce at whatever the existing resolution actually is, you have to select the output resolution (say 1080p again); hence the result is upsampled to a degree to get back to 1920x1080 when you produce.

Then once you import this slightly upsampled video and apply a crop, there's no way to achieve, say, exactly 1280x720 of the original video pixels. The end result will always result in some amount of up/down sampling to achieve the production resolution (720p in this case).

Why can't we just tell PD what our end-goal is (in terms of pixel dimensions) and let it figure out how to optimally apply the cropping and stabilizing?

Another idea would be to have a stabilizer tool embedded in the crop tool, such that when you crop the video you can select an option to apply stabilization as well, but outside of the cropped frame instead of inside.

A third idea would be an option to set the number of pixels that are removed during stabilizing, so that you know exactly what the resolution is after the stabilization, and you could then adjust for this. I don't like this idea as much however because with PD there's also no way to set the number of pixels that are removed during cropping.

This message was edited 12 times. Last update was at May 26. 2016 11:33

Reply
ynotfish
Senior Contributor Private Message Location: N.S.W. Australia Joined: May 08, 2009 02:06 Messages: 9947 Offline
[Post New]
Hi AllanSmithee -

Without trying to over-complicate your question, I just did a few calculations that might help maintain quality & limit upscaling.

These calculations were made by applying the standard PDR stabiliser at different settings, taking snapshots & measuring the degree of cropping. I don't pretend they are "pure", but they're pretty close!

Original Video Resolution 1920x1080


  • Stabilser set at 20 = 1842 x 1036

  • Stabiliser set at 30 = 1806 x 1016

  • Stabiliser set at 40 = 1760 x 990

  • Stabiliser set at 50 = 1728 x 972


Following your thinking, about avoiding upscaling... after stabilisation you could produce to a custom profile (based on degree applied) - then crop the produced file before final render in 720p.

I may be over-thinking embarassed

Cheers - Tony
Visit PDtoots. PowerDirector Tutorials, tips, free resources & more. Subscribe!
Full linked Tutorial Catalog
PDtoots happily supports fellow PowerDirector users!
Reply
AllanSmithee [Avatar]
Member Private Message Joined: Mar 13, 2015 19:16 Messages: 54 Offline
[Post New]
Tony,

Awesome thanks. No you're not overthinking and this is what I was going for. It's nice to know the proportion of the video that gets trimmed using the stabilization tool. I wonder if this varies video to video though, and with the rotational tool selected or not.

The problem now is figuring out how to take off exactly, say, another 316 pixels using the crop tool, haha.

Anyway, yes that's what I'm looking for, it would just be nice if we could get PD to "do the math" for us.

This message was edited 1 time. Last update was at May 26. 2016 15:31

Reply
ynotfish
Senior Contributor Private Message Location: N.S.W. Australia Joined: May 08, 2009 02:06 Messages: 9947 Offline
[Post New]
As we say over here in OZ: "It's a bit how-ya-goin", which means a fair way short of being correct!

It certainly would make a difference if you're also applying either rotational camera shake or enhanced stabilizer! e.g. Setting stabiliser at 40 (1760x990) then applying rotational camera shake crops the original 1920x1080 to 1742x780 - using the same bush calculation methods as before laughing

And yes - in Video Crop - calculating the degree of crop has the same level of guess work/estimation.

Using the process I described above, I stabilised & cropped a 1080p video & produced to 720p. The process works well. You'd only need to do the Maths once, if you were applying the same level of stabilisation & crop to all clips.



Cheers - Tony
Visit PDtoots. PowerDirector Tutorials, tips, free resources & more. Subscribe!
Full linked Tutorial Catalog
PDtoots happily supports fellow PowerDirector users!
Reply
CS2014
Senior Contributor Private Message Location: USA-Eastern Time Zone Joined: Sep 16, 2014 16:44 Messages: 629 Offline
[Post New]
Really nice to see this sort of exchange of Q and A.

I've often wondered how much of the source video was taken off of the original clip when stabilization was applied and never really experimented to find out just how much.

But you two have nailed it down quite nicely. Thanks!

CS

This message was edited 1 time. Last update was at May 26. 2016 16:21

PD13 Ultimate - Build 3516, WIN 8.1, 64 Bit, 16G RAM, Intel Core i5 4460, CPU @ 3.2GHz, NVIDIA GeForce GT720, Graphics Memory(total avail.)-4093MB
LG WH14NS40 Blu-Ray Drive
Reply
AllanSmithee [Avatar]
Member Private Message Joined: Mar 13, 2015 19:16 Messages: 54 Offline
[Post New]
Quote: And yes - in Video Crop - calculating the degree of crop has the same level of guess work/estimation.

Using the process I described above, I stabilised & cropped a 1080p video & produced to 720p.


Hmm.. interesting. How did you get the crop to be the exact number of pixels you wanted though? Trial and error? Or is there a way to numerically enter how much to crop?

This message was edited 1 time. Last update was at May 26. 2016 17:07

Reply
AllanSmithee [Avatar]
Member Private Message Joined: Mar 13, 2015 19:16 Messages: 54 Offline
[Post New]
Quote: These calculations were made by applying the standard PDR stabiliser at different settings, taking snapshots & measuring the degree of cropping.


Tony, in PD13 at least, when I apply the stabilization and subsequently take a snapshot, the snapshots have the same 1920x1080 resolution as well :/ although they do appear to be zoomed in to the same degree, which is confusing.

I'm trying to use a stabilization setting of 20 with rotational shake and enhanced stabilizer both check to yes.

This message was edited 3 times. Last update was at May 26. 2016 17:26

Reply
ynotfish
Senior Contributor Private Message Location: N.S.W. Australia Joined: May 08, 2009 02:06 Messages: 9947 Offline
[Post New]
Hi Allan -

As you've discovered, you can't be guided by the snapshot resolution, unless it's a snap of a produced video (after stabilising or cropping). As far as the "snapshot machine" knows, it's 1920x1080... until you render it. It's the same in PDR14.

Here - a snap from the 1760x990 produced video is 1760x990.

I did say there's a bit of guesstimation involved... For this example, forget about stabilising for a moment. If your video is 1920x1080 & you go to Video Crop & turn on the 10x10 grid lines. Each horizontal grid line is (in theory) 108px apart. That's where the guess work comes in.

Do you see where I'm going? Like I said, "a bit how-ya-goin".

Sometimes I use a grid overlay (like the one attached) to help with calculating crops etc. The grid is 1920x1080. The thicker lines are 100px spaced. The finer lines are 50px. There's still a bit of guess work involved, of course.

There is no way to do any of this automatically or enter a numerical value in PDR.

To your previous question, though I haven't tested thoroughly, if you set the stabiliser to (say) 30 on a number of different clips they'd all be cropped by the same amount.

Cheers - Tony
[Thumb - 1920x1080 Grid.png]
 Filename
1920x1080 Grid.png
[Disk]
 Description
 Filesize
45 Kbytes
 Downloaded:
85 time(s)

Visit PDtoots. PowerDirector Tutorials, tips, free resources & more. Subscribe!
Full linked Tutorial Catalog
PDtoots happily supports fellow PowerDirector users!
Reply
AllanSmithee [Avatar]
Member Private Message Joined: Mar 13, 2015 19:16 Messages: 54 Offline
[Post New]
Quote: As you've discovered, you can't be guided by the snapshot resolution, unless it's a snap of a produced video (after stabilising or cropping). As far as the "snapshot machine" knows, it's 1920x1080... until you render it. It's the same in PDR14.Tony


Hi Tony, Sorry but I'm still a bit confused. If you produce the cropped video, the output resolution BECOMES 1920x1080 because it gets upsampled to whatever you set the output to be (no way to set the output to the current native res). How do you take a snapshot of a produced video then, and determine the cropped resolution?

I guess what I'm saying is, are the resolutions below the actual resolutions of the snapshots, or were they based on estimated custom resolutions which were based on estimations from using the grid?

Quote:
  • Stabilser set at 20 = 1842 x 1036
  • Stabiliser set at 30 = 1806 x 1016
  • Stabiliser set at 40 = 1760 x 990
  • Stabiliser set at 50 = 1728 x 972
Cheers - Tony


Thanks, the grid could help.

This message was edited 1 time. Last update was at May 26. 2016 18:45

Reply
ynotfish
Senior Contributor Private Message Location: N.S.W. Australia Joined: May 08, 2009 02:06 Messages: 9947 Offline
[Post New]
If I tried to explain how I arrived at those calculations, it'd possibly cause more confusion - not my intent.

Maybe the attached image will help to explain...

To clarify about the snapshots. Yes - when you apply the stabiliser or crop to the video, the snaps come out at 1920x1080... BUT then (in graphics software) I overlaid each snapshot over the original (same frame) & resized it to match visually. From that I could calculate the approximate resolution of the cropped/stabilised video.

Hopefully that hasn't made it less clear than before.

Anyway - where's Jeff? Beside him, I'm not a mathematician's bootlace! If any mathematically inclined observer can point to a more effective way to do this, I'd welcome the advice.

Cheers - Tony
[Thumb - Stabiliser Calc.png]
 Filename
Stabiliser Calc.png
[Disk]
 Description
 Filesize
2443 Kbytes
 Downloaded:
81 time(s)

Visit PDtoots. PowerDirector Tutorials, tips, free resources & more. Subscribe!
Full linked Tutorial Catalog
PDtoots happily supports fellow PowerDirector users!
Reply
CS2014
Senior Contributor Private Message Location: USA-Eastern Time Zone Joined: Sep 16, 2014 16:44 Messages: 629 Offline
[Post New]
Besides dividing the original clip number of pixels by the resulting clip number of pixels - in either direction - vertical or horizontal - this would give you the fraction - decimal fraction of what the relationship would be.

In the picture Tony supplied(Stabiliser Calc.png) either
A: 1823 or 1824 divided by 1920 horizontal
B: 1024 or 1026 divided by 1080

A: 0.949479166666(repeating 6) for 1823
0.95 for 1824

B: 0.948148148(repeating one forty eight)for 1024
0.95 for 1026

close enough for some/most engineering accounts.

So Stabilizer set to 20 provides the resulting clip at about about 95% of original clip?!

I know you can divide too Tony - I'm not a math wiz either but these are the numbers I get.

CS

This message was edited 2 times. Last update was at May 27. 2016 09:28

PD13 Ultimate - Build 3516, WIN 8.1, 64 Bit, 16G RAM, Intel Core i5 4460, CPU @ 3.2GHz, NVIDIA GeForce GT720, Graphics Memory(total avail.)-4093MB
LG WH14NS40 Blu-Ray Drive
Reply
ynotfish
Senior Contributor Private Message Location: N.S.W. Australia Joined: May 08, 2009 02:06 Messages: 9947 Offline
[Post New]
You're not just a pretty face CS! laughing

Over here, I refined the technique for calculating the cropped resolution by using a video with a grid overlay embedded. That made visual alignment easier & more accurate.

Following CS's lead of calculating the "cropping factor", it came down to a simple (and predictable) table. Please note that these are estimations only and cropping factors have been rounded to 2 decimal places.



During the process, it appeared that when "Enhance Stabiliser" is applied, "Rotational Camera Shake" is applied by default. Didn't know that surprised

Cheers - Tony

Table also attached as PDF for reference.
 Filename
PDR_Estimated Stabiliser Cropping.pdf
[Disk]
 Description
 Filesize
188 Kbytes
 Downloaded:
309 time(s)

Visit PDtoots. PowerDirector Tutorials, tips, free resources & more. Subscribe!
Full linked Tutorial Catalog
PDtoots happily supports fellow PowerDirector users!
Reply
CS2014
Senior Contributor Private Message Location: USA-Eastern Time Zone Joined: Sep 16, 2014 16:44 Messages: 629 Offline
[Post New]
Now THOSE are a nice set of....errrm... tables!

(hehehee)

In all seriousness though - those are some nice tables to have to understand the approximate result from the stabilization process - on it's affect on the clip size. Thanks for doing all that work and sharing it!

CS
 Filename
Nice Set of Tables.png
[Disk]
 Description
 Filesize
297 Kbytes
 Downloaded:
82 time(s)

This message was edited 1 time. Last update was at May 27. 2016 23:52

PD13 Ultimate - Build 3516, WIN 8.1, 64 Bit, 16G RAM, Intel Core i5 4460, CPU @ 3.2GHz, NVIDIA GeForce GT720, Graphics Memory(total avail.)-4093MB
LG WH14NS40 Blu-Ray Drive
Reply
tomasc [Avatar]
Senior Contributor Private Message Joined: Aug 25, 2011 12:33 Messages: 6366 Offline
[Post New]
Yes. That is one way to keep those tables in mind. LOL
Reply
CS2014
Senior Contributor Private Message Location: USA-Eastern Time Zone Joined: Sep 16, 2014 16:44 Messages: 629 Offline
[Post New]
I was waiting to see what Tony would say but....tomasc... you've provided the anticipated response that I expected. lol....

CS PD13 Ultimate - Build 3516, WIN 8.1, 64 Bit, 16G RAM, Intel Core i5 4460, CPU @ 3.2GHz, NVIDIA GeForce GT720, Graphics Memory(total avail.)-4093MB
LG WH14NS40 Blu-Ray Drive
Reply
Reply to this topic
Powered by JForum 2.1.8 © JForum Team