Use ffmpeg to modify video resolution and compress video quality

You can adjust the video quality and bit rate using the encoding options in FFmpeg. Here are some commonly used options:

1 Quality options : Use the -q:v parameter to set the quality level of the video. Quality levels range from 0-51, where 0 represents lossless compression and 51 represents the lowest quality. The lower the quality level, the smaller the file size of the video, but the quality of the video will also be reduced.

2 Bit rate option : Use the -b:v parameter to set the average bit rate of the video. The unit of code rate is bit rate (bps), usually expressed in kbps or Mbps. The higher the average bitrate, the larger the file size of the video, but the quality of the video will also increase.

Use Cases

ffmpeg -i input_video.mp4 -vf scale=1920:1080 -q:v 20 -b:v 2M output_video.mp4

This command reduces the input video file input_video.mp4 to 1920x1080, sets the video quality to 20 (quality range is 0-51), and sets the average bitrate to 2 Mbps. The output results are saved in output_video.mp4.

Guess you like

Origin blog.csdn.net/YierAnla/article/details/131005108