User Tools

Site Tools


docu:csheet:sysadm:files:compress_vids

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
docu:csheet:sysadm:files:compress_vids [2020/04/17 20:10]
admin created
docu:csheet:sysadm:files:compress_vids [2020/04/17 22:21] (current)
admin
Line 4: Line 4:
 Source: https://unix.stackexchange.com/questions/28803/how-can-i-reduce-a-videos-size-with-ffmpeg Source: https://unix.stackexchange.com/questions/28803/how-can-i-reduce-a-videos-size-with-ffmpeg
  
-That answer was written in 2009. Nowadays (2020) 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)+That answer was written in 2009. Nowadays (2020) 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). 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.
  
 <code bash> <code bash>
Line 12: Line 12:
 # even better compression with H.265 # even better compression with H.265
 ffmpeg -i input.avi -vcodec libx265 -crf 20 output.avi ffmpeg -i input.avi -vcodec libx265 -crf 20 output.avi
 +
 +
 +# faster, and more lossy compression
 +# depending on your needs, it could fit
 +ffprobe input.mp4
 +
 +# search for "bitrate:"
 +# example: 920 kb/s
 +# 50% of quality loss == 450 kb/s aprox
 +
 +# If you dont see any difference on lower bitrate, set it lower
 +# it will compress even more
 +ffmpeg -i input.mp4 -b:v 450k output.mp4
  
 # faster, but less compression # faster, but less compression
 ffmpeg -i input.mkv -vcodec copy -crf 20 output.mkv ffmpeg -i input.mkv -vcodec copy -crf 20 output.mkv
 </code> </code>
docu/csheet/sysadm/files/compress_vids.1587154217.txt.gz · Last modified: 2020/04/17 20:10 by admin