I have some 4K 3840x2160 footage in MP4 format that I need to bring down to 1080p. I tried running
ffmpeg -i orig.mp4 -vf scale=1920:1080 smaller.mp4
but the result is very poor quality, with the entire image being composed of square "tiles" as if I was magnifying 4:1.
Here is the output of running this command:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'origs/P1000003.MP4': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: mp42avc1 creation_time : 2015-02-19 17:10:38 Duration: 00:05:14.48, start: 0.000000, bitrate: 95903 kb/s Stream #0.0(und): Video: h264 (High), yuvj420p, 3840x2160 [PAR 1:1 DAR 16:9], 95792 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc Metadata: creation_time : 2015-02-19 17:10:38 Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 125 kb/s Metadata: creation_time : 2015-02-19 17:10:38 Incompatible pixel format 'yuvj420p' for codec 'mpeg4', auto-selecting format 'yuv420p' [buffer @ 0x22a3420] w:3840 h:2160 pixfmt:yuvj420p [scale @ 0x22a3ce0] w:3840 h:2160 fmt:yuvj420p -> w:1920 h:1080 fmt:yuv420p flags:0x4 Output #0, mp4, to '1-short.mp4': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: mp42avc1 creation_time : 2015-02-19 17:10:38 encoder : Lavf53.21.1 Stream #0.0(und): Video: mpeg4, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 tbn, 25 tbc Metadata: creation_time : 2015-02-19 17:10:38 Stream #0.1(und): Audio: libvo_aacenc, 48000 Hz, stereo, s16, 200 kb/s Metadata: creation_time : 2015-02-19 17:10:38 Stream mapping: Stream #0.0 -> #0.0 Stream #0.1 -> #0.1 Press ctrl-c to stop encoding frame= 125 fps= 6 q=31.0 Lsize= 968kB time=5.00 bitrate=1586.7kbits/s video:842kB audio:123kB global headers:0kB muxing overhead 0.421047%
I know from experience that ffmpeg is an excellent tool, so I must be screwing up the options/parameters somehow...
How can I do this?
-t 10to make a 10 second output. Why do you want to downscale? What is the use case for your scaled output? This info will help me provide a more accurate answer.
-c:a copy, since you don't want or need to re-encode the audio stream. Use
-map 0to copy any chapter metadata, or other stuff. (ffmpeg only takes 1 vid + 1 aud by default.)
-sws_flags lanczos+print_infowill use a better scaling algo than the default (bilinear I think). stlb's answer covers the video encoding part of the process.
scale=1920:-2:flags=lanczos. I was also going to mention the
-2for scale in my non-existent answer. For those who don't know you can put
-2in width or height, and it will automatically provide the correct value while preserving aspect ratio and making the value divisible by 2 (required by libx264 for yuv420p outputs).