[FFmpeg-user] croping a video while keeping the rest of the data in the container

Moritz Barsnick barsnick at gmx.net
Tue Oct 13 23:03:37 CEST 2015


On Tue, Oct 13, 2015 at 13:00:46 -0600, Jim Worrall wrote:
> 
> > On 2015 Oct 13, at 11:20 AM, daggs <daggs at gmx.com> wrote:
> > 
> > I want to the following, take a mkv file (with multiple audio and subtitles included for example) and crop the video so in the end I have same file like the original but with the video stream cropped.
> > 
> > how I can do that?
> 
> https://ffmpeg.org/ffmpeg-filters.html#crop
> http://www.renevolution.com/understanding-ffmpeg-part-iii-cropping/

That explains how to crop.

In order to map *all* inputs streams to the output stream, use "-map
0", otherwise ffmpeg only chooses one of each (i.e. the best video, the
best audio stream, the best/first subtitle stream, and so on.)

In order to keep the original streams, use "-c copy".

Cropping does *not* allow you to use the original video stream
(obviously), so you can specify the (new) codec with "-c:v libx264".

So this part of the command line adds up to:
  -map 0 -c copy -c:v libx264

(Add your filter with "-vf crop=...".)

Cheers,
Moritz


More information about the ffmpeg-user mailing list