user17340: So I recorded nintendo ds gameplay with my phone and I masked out what I need. I made a pask using the pentool but of course this is not a nice rectangle. So what I want is to warp the video so the masked part fits in a rectangle, but i have no idea how. This is what I mean but in another editing software: 

 watch 2:30-2:50

But I want to do this in AE

user1950: There is an effect called Corner Pin that does exactly this. Apply it to the video and drag the corners so that the video is the shape you want. You may need to mask the layer as well - it's usually easiest to precompose the layer with the effect on it as the effect is applied after masking, making it a bit tricky to position your mask.
For more bells and whistles, recent versions have included the CC Power Pin effect. I'm not 100% sure what the advantages of this plugin are, but you might want to look at the menual here.

17340: <p>So I recorded nintendo ds gameplay with my phone and I masked out what I need. I made a pask using the pentool but of course this is not a nice rectangle. So what I want is to warp the video so the masked part fits in a rectangle, but i have no idea how. This is what I mean but in another editing software: <div class="youtube-embed"><div>
                <iframe width="640px" height="395px" src="https://www.youtube.com/embed/ShYX1S5s-H8?start=0"></iframe>
            </div></div> watch 2:30-2:50</p>

<p>But I want to do this in AE</p>
 1950: <p>There is an effect called <a href="https://helpx.adobe.com/after-effects/using/distort-effects.html#corner_pin_effect" rel="nofollow noreferrer">Corner Pin</a> that does exactly this. Apply it to the video and drag the corners so that the video is the shape you want. You may need to mask the layer as well - it's usually easiest to precompose the layer with the effect on it as the effect is applied after masking, making it a bit tricky to position your mask.</p>

<p>For more bells and whistles, recent versions have included the CC Power Pin effect. I'm not 100% sure what the advantages of this plugin are, but you might want to look at the menual <a href="http://cycorefx.com/downloads/cfx_hd_std/CycoreFX%201.7%20Manual.pdf#CCfx%20Std%20Manual.indd%3A.27664" rel="nofollow noreferrer">here.</a></p>
