如何使用 ffmpeg 从视频文件中提取高质量的 JPEG 图像? [英] How can I extract a good quality JPEG image from a video file with ffmpeg?

查看:64
本文介绍了如何使用 ffmpeg 从视频文件中提取高质量的 JPEG 图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在使用这个命令来提取图像:

Currently I am using this command to extract the images:

ffmpeg -i input.mp4 output_%03d.jpeg

但是我怎样才能提高 JPEG 图像质量?

But how can I improve the JPEG image quality?

推荐答案

使用-qscale:v控制质量

使用 -qscale:v(或别名 -q:v)作为输出选项.

Use -qscale:v to control quality

Use -qscale:v (or the alias -q:v) as an output option.

  • JPEG 的正常范围是 2-31,其中 31 是最差的质量.
  • 比例是线性的,qscale 的两倍大约是比特率的一半.
  • 建议尝试 2-5 的值.
  • 您可以使用值 1,但必须添加 -qmin 1 输出选项(因为默认值为 -qmin 2).
  • Normal range for JPEG is 2-31 with 31 being the worst quality.
  • The scale is linear with double the qscale being roughly half the bitrate.
  • Recommend trying values of 2-5.
  • You can use a value of 1 but you must add the -qmin 1 output option (because the default is -qmin 2).
ffmpeg -i input.mp4 -qscale:v 2 output_%03d.jpg

查看图像复用器文档,了解更多涉及图像输出的选项.>

以约 60 秒的持续时间输出单个图像:

See the image muxer documentation for more options involving image outputs.

ffmpeg -ss 60 -i input.mp4 -qscale:v 4 -frames:v 1 output.jpg

连续覆盖/更新/保存到单个图像

使用 -update 1 图像复用器 选项.来自实时流媒体输入的每秒一次示例:

To continuously overwrite/update/save to a single image

Use -update 1 image muxer option. Example for once per second from a live streaming input:

ffmpeg -i rtmp://input.foo -q:v 4 -r 1 -update 1 output.jpg

另见

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆