2

I want to take a screenshot/thumbnail from a clip whose size is 1024×780, but I don't want the entire height. I just want the screenshot to take 768 × 80% of the height.

This is because I don't want any subtitles to be included in the thumbnails.

I'm currently using the following command to get screenshots:

ffmpeg -i <input> -f image2 -ss <position> -s 768x432 \
-vf fps=fps=1/10 -vframes 20 <output>

The goal is to end up with a thumbnail sized 768×432, but the height 432 is only 80% of the height of the original video file.

1 Answer 1

3

You can use the scale and crop filters:

ffmpeg -i input -filter:v scale=768:-1,crop=iw:ih*0.8,fps=1/10 output

This will scale to your desired width (768) and the height will be automatically scaled to the appropriate value to preserve aspect. Then it will crop taking the scaled height and multiplying it by 0.8. Note that the crop will be divided among the top and bottom. For example, using crop=iw:ih-100 will remove 50 pixels from the top and 50 pixels from the bottom. If you want to it to just remove pixels from the bottom:

ffmpeg -i input -filter:v scale=768:-1,crop=iw:ih*0.8:0:0,fps=1/10 output

You can preview with ffplay:

ffplay input -vf scale=768:-1,crop=iw:ih*0.8

See the FFmpeg filter documentation for more examples and information.

2
  • well, I actually wanted the height to come out to be 432 not 346.... Is it possible to make it come out 432 while doing the cropping?
    – thevoipman
    Commented Mar 30, 2013 at 22:00
  • @thevoipman Your question was ambiguous, so I wasn't totally clear as to what you wanted. Try scale=768:-1,crop=iw:432.
    – llogan
    Commented Mar 31, 2013 at 1:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .