Results 1 to 5 of 5

Thread: ffmpeg crop filter

  1. #1
    Join Date
    Jan 2010
    Location
    England
    Beans
    185
    Distro
    Ubuntu

    ffmpeg crop filter

    am i right in saying that if i want to crop 40 pixels fro the top of a video and 60 pixels from the bottom, i would have to do it over two different conversions.

    my understanding is this would crop the top. crop 40 pixels from position y=0

    -vf crop=in_w-0:in_h-40:0:0

    and this would crop the bottom. crop 60 pixels from position y=516

    -vf crop=in_w-0:in_h-60:0:516

    is this correct???

    also is it possible to crop from right to left,bottom to top rather than left to right, top to bottom?
    Last edited by spiritech; June 13th, 2012 at 04:23 AM. Reason: correction
    Keep those cups of Ubuntu comming.
    Ubuntu 12.10

  2. #2
    Join Date
    Sep 2006
    Beans
    3,475

    Re: ffmpeg crop filter

    You should be able to do this in one step with:
    Code:
    -vf crop=iw:ih-100:0:40
    (You should double-check this.)

  3. #3
    Join Date
    Jan 2010
    Location
    England
    Beans
    185
    Distro
    Ubuntu

    Re: ffmpeg crop filter

    Quote Originally Posted by FakeOutdoorsman View Post
    You should be able to do this in one step with:
    Code:
    -vf crop=iw:ih-100:0:40
    (You should double-check this.)
    i have done alot of research on this command and have found that the iw:ih part is not needed.

    -vf crop=value:value:value:value is adequate.

    so would look like this.

    Code:
    -vf crop=640:320:0:40
    as to my original question it seems to use this command you need to know your original resolution and then deduct the amount you want to crop from this.

    maybe the -vf crop filter can crop images regardless of size like the crop filter for convert

    Code:
    -crop -0+60
    Keep those cups of Ubuntu comming.
    Ubuntu 12.10

  4. #4
    Join Date
    Sep 2006
    Beans
    3,475

    Re: ffmpeg crop filter

    Quote Originally Posted by spiritech View Post
    i have done alot of research on this command and have found that the iw:ih part is not needed.
    I find using iw and ih instead of manually declaring values to be more flexible: especially when adding more filters to the filterchain, but the good thing is that either method works.

    Quote Originally Posted by spiritech View Post
    as to my original question it seems to use this command you need to know your original resolution and then deduct the amount you want to crop from this.

    maybe the -vf crop filter can crop images regardless of size like the crop filter for convert
    If you know how much you want to crop, (for example 40 pixels from height) and you want to the crop to be the same for top and bottom (in this example 20 pixels from top and 20 pixels from bottom), you only need:
    Code:
    crop=iw:ih-40
    If you need to offset, then you'll need the additional values for x and/or y. See the crop filter documentation for more info.

  5. #5
    Join Date
    Jan 2010
    Location
    England
    Beans
    185
    Distro
    Ubuntu

    Re: ffmpeg crop filter

    If you know how much you want to crop, (for example 40 pixels from height) and you want to the crop to be the same for top and bottom (in this example 20 pixels from top and 20 pixels from bottom), you only need:
    Code:


    Code:
    crop=iw:ih-40
    If you need to offset, then you'll need the additional values for x and/or y. See the crop filter documentation for more info.
    so does
    Code:
    crop=iw:ih
    tell the crop filter to use original image size? and if so your original answer is correct.


    Code:
    -vf crop=iw:ih-100:0:40
    Last edited by spiritech; March 15th, 2013 at 11:18 AM.
    Keep those cups of Ubuntu comming.
    Ubuntu 12.10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •