[FFmpeg-user] Crop and transpose filters combined produces large output
barsnick at gmx.net
Thu Jun 29 19:12:08 EEST 2017
On Thu, Jun 29, 2017 at 10:49:23 -0500, Clay D. Montgomery wrote:
> should be. But, when I split the same operation into 2 passes, I get an
> output (File3.mp4) that seems to be the correct size. The details are:
Define "correct". The file size (or bitrate) is defined by various
factors: Mainly by the quality (the more quality, the more bits you
need), and by the amount of effort you put into the encoding, i.e. how
much CPU (to encode more bit-efficiently) and which encoding methods
(which may require more calculation power.
Since you haven't provided ffmpeg console output (full, uncut), I can
only assume that you're encoding to H.264 using libx264. In ffmpeg,
this codec defaults to CRF=23, with a preset of "medium", i.e. medium
effort in terms of CPU, and of H.264 profile/version. You can do two
things to reduce the size of the output:
- put more CPU effort in, e.g. by adding "-preset veryslow";
- reduce the quality, e.g with "-crf 26";
- you can also just provide the target video bitrate, with "-b:v 1M".
> File4.mp4 25,918,758 (Excessive Size)
Why is this considered excessive?
> File3.mp4 5,777,801 (Correct Size)
There's probably nothing "correct" or "incorrect" about that size. It's
just "more like what you desire".
> Crop and transpose in 2 passes:
> ffmpeg -i File1.mp4 -vf crop=1080:1920:0:0 File2.mp4
> ffmpeg -i File2.mp4 -vf transpose=2 File3.mp4
I can tell you why this gives a smaller size: Each encoding implies a
loss in quality. In the second case, the encoder already gets less
input detail, and that results in requiring less bits for the output.
So the smaller size is a horrible side effect of your double lossy
encoding. You get a better encoding result (i.e. quality for size) by
tuning the parameters I mentioned above.
And now to a different issue:
> All of these files can be played with ffplay, but I use other video
> players and they have trouble playing File4.mp4.
Is that ffmpeg's problem? ;-) No, honestly:
- Please define "trouble" more precisely.
- Please provide your ffmpeg command line, along with the complete,
uncut console output.
(The usual guess is: Your player doesn't support the pixel format ffmpeg
encodes to. But I hate guessing, do give us some info.)
More information about the ffmpeg-user