gaqmouse.blogg.se

Ffmpeg scale to 480p
Ffmpeg scale to 480p










Be aware that changing the resolution always requires reencoding, so all the ins and outs of the other answers apply here as well. In these examples, the size is divided by twice the value and multiplied by two to ensure the pixel size is a multiple of two, which is required for some codecs including H265. One fifth size: ffmpeg -i input.mkv -vf "scale=trunc(iw/10)*2:trunc(ih/10)*2" -c:v libx265 -crf 28 a_fifth_the_frame_size.mkv One quarter size: ffmpeg -i input.mkv -vf "scale=trunc(iw/8)*2:trunc(ih/8)*2" -c:v libx265 -crf 28 a_fourth_the_frame_size.mkv One third size: ffmpeg -i input.mkv -vf "scale=trunc(iw/6)*2:trunc(ih/6)*2" -c:v libx265 -crf 28 a_third_the_frame_size.mkv To scale to half size: ffmpeg -i input.mkv -vf "scale=trunc(iw/4)*2:trunc(ih/4)*2" -c:v libx265 -crf 28 half_the_frame_size.mkv See the ffmpeg docs on scaling for more info. But when converting for a small device this may be acceptable. The downside is you also lose a large amount of quality because less pixels mean less image details.

ffmpeg scale to 480p

Also the file size can be reduced significantly. It's a lot quicker, up to multiple times faster depending on your source and the amount of the resolution decrease, as there are less pixels to be encoded. All the answers here are for reducing the compression quality but nobody has mentioned reducing video frame size.

ffmpeg scale to 480p

You mentioned wanting to reduce filesize to fit more videos on a mobile device, which is my usecase as well. ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4 Vary the CRF between around 18 and 24 - the lower, the higher the bitrate.

ffmpeg scale to 480p

For example for a target size of 1 GB (one giga byte, which is 8 giga bits) and 10 000 seconds of video (2 h 46 min 40 s), use a bitrate of 800 000 bit/s (800 kbit/s): ffmpeg -i input.mp4 -b 800k output.mp4Īdditional options that might be worth considering is setting the Constant Rate Factor, which lowers the average bit rate, but retains better quality. To see this technique applied using the older H.264 format, see this answer, quoted below for convenience:Ĭalculate the bitrate you need by dividing your target size (in bits) by the video length (in seconds). ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4 Note that lower CRF values correspond to higher bitrates, and hence produce higher quality videos. To use it, replace the libx264 codec with libx265, and push the compression lever further by increasing the CRF value - add, say, 4 or 6, since a reasonable range for H.265 may be 24 to 30. Since 2013 a video format much better than H.264 is widely available, namely H.265 (better in that it compresses more for the same quality, or gives higher quality for the same size). Update 2020: This answer was written in 2009.












Ffmpeg scale to 480p