5

I have a file of resolution 3840x1632, but my TV stretches the picture vertically to fill up all 2160 pixels of height. Is it possible to use ffmpeg to add blank / black height, while preserving the video and audio quality?

Tried doing this, which seemed to work (took about 2 hours, the same length of the video), but greatly reduced the file size/video quality):

ffmpeg -i input.mkv -filter:v "pad=3840:2160:0:280" -c:a copy my_output_video.mkv

Is there a switch to say "keep everything else the same"?

Thank you!

1

You'll have to manually set encoding parameters.

ffmpeg -i input.mkv -filter:v "pad=3840:2160:0:280,setsar=1" -crf 18 -preset faster -c:a copy my_output_video.mkv

The CRF option sets the tradeoff for size/quality. Lower values produce better quality but larger files. The preset will increase speed, but for same quality, the file size will be larger.

The setsar filter has been added as a precaution in case your player reads the SAR stored in the file and stretches the video based on that value.

| improve this answer | |
0

You can do transformations with -c:v libx264 -crf 0 X264 has lossless mode, which it enters with -crf 0. They implemented real lossless video encoding, this is not widely known - but it works perfectly.

I use it all the time.

Be ready - it takes GBs - especially for videos of real-life (not graphics etc...)

Doing screen recording for programs and graphis in -crf 0 - is perfect - it compresses them really great and uses relatively small CPU power.

You also can control compression complexity it uses, with the presets (fast, veryslow ... etc). And you also can recomress lossles into more compressed lossless.

Everything for lossless is the same as for all x264's, except that it is the real lossless.

| improve this answer | |
  • The OP intends to play the files on a TV, and most h/w or s/w decoders don't support Hi444 profile which is what crf/qp 0 requires. – Gyan Oct 12 '19 at 19:39
  • @Gyan Yep, what you say is true. Except I said "transformations". The idea I represent - person does not know how to play with lossless processing. He can develop workflow in lossless form in stages, and then all that can be moved into on-the-fly bulk processing into lossy. Also lossless can be directly compared. Like I had two days before. If input file has 11.8 GB, letterboxed file also would be 11.8 GB - you see right away that all information is preserved. & Lossless can always be encoded into lossy. – Anton Latukha Oct 13 '19 at 23:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.