android.weasel
android.weasel

Reputation: 3391

How do I crop a rectangle from a video, from the command-line?

I'm capturing a video of a test-run on an iOS simulator, and I have an automated script to tell QuickTime to record only a rectangle of video.

This works well on the desktop displaying to the physically connected screen, but for remote desktop users, the resulting video is a garbled version of bits of the primary screen instead of the rectangle of the secondary user's view.

It's even worse for a Mac Pro running VMs: ALL users get a blank, black rectangle. This obtained for Yosemite and still obtains for ElCap.

Oddly, capturing a full screen works properly for all sessions, so I could record the whole thing, and then crop out the window I want - it doesn't move.

Is there a good command-line tool that can crop a rectangle from a (full screen) video stream? I looked at ffmpeg, but couldn't see it listed.

Thanks

Upvotes: 2

Views: 762

Answers (2)

Dylan
Dylan

Reputation: 55

You can use ffmpeg to do this as well,

ffmpeg -i in.mp4 -filter:v "crop=out_w:out_h:x:y" out.mp4

source: https://video.stackexchange.com/questions/4563/how-can-i-crop-a-video-with-ffmpeg

Upvotes: 3

agc
agc

Reputation: 8416

To view a 100 pixel square crop at position {x=100,y=100} :

mplayer -vf "crop=100:100:100:100" foo.avi

Upvotes: 1

Related Questions