如何在给定的时间提取ffmpeg的视频的1个屏幕截图? [英] How to extract 1 screenshot for a video with ffmpeg at a given time?

查看:762
本文介绍了如何在给定的时间提取ffmpeg的视频的1个屏幕截图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有许多教程和东西显示如何使用ffmpeg从视频中提取多个屏幕截图。你设置了-r,甚至可以启动一定的金额。

There are many tutorials and stuff showing how to extract multiple screenshots from a video using ffmpeg. You set -r and you can even start a certain amount in.

但是我只想要1个屏幕截图,比如说01:23:45,或者在屏幕截图为86 %in。

But I just want 1 screenshot at, say 01:23:45 in. Or 1 screenshot at 86% in.

这可以通过 ffmpegthumbnailer ,但这是我不想依赖的另一个依赖。我想用ffmpeg来做到这一点。

This is all possible with ffmpegthumbnailer but it's another dependency I don't want to depend on. I want to be able to do it with ffmpeg.

推荐答案

使用 -ss 选项:

ffmpeg -ss 01:23:45 -i input -vframes 1 -q:v 2 output.jpg




  • 对于JPEG输出,使用 -q:v 以控制输出质量。全范围是1-31的线性尺度,其中较低的值导致更高的质量。

    • For JPEG output use -q:v to control output quality. Full range is a linear scale of 1-31 where a lower value results in a higher quality. 2-5 is a good range to try.

      选择过滤器为更复杂的需求提供了一种替代方法,例如仅选择某些帧类型,或每100个等待1个。

      The select filter provides an alternative method for more complex needs such as selecting only certain frame types, or 1 per 100, etc.

      在输入更快之前放置 -ss 。请参阅 FFmpeg Wiki:寻求,并从 ffmpeg cli工具文档

      Placing -ss before the input will be faster. See FFmpeg Wiki: Seeking and this excerpt from the ffmpeg cli tool documentation:


      -ss position(input / output)

      -ss position (input/output)

      当用作输入选项( -i 之前)时,请在此输入文件中查找。请注意,在大多数格式中,不可能完全找到
      ,所以 ffmpeg 将寻求
      位置之前的最接近的查找点。当转码和 -accurate_seek 启用(
      默认值)时,搜索点和位置之间的这个额外的段将
      解码并丢弃。当进行流拷贝时,或者当
      -noaccurate_seek 被使用时,它将被保留。

      When used as an input option (before -i), seeks in this input file to position. Note the in most formats it is not possible to seek exactly, so ffmpeg will seek to the closest seek point before position. When transcoding and -accurate_seek is enabled (the default), this extra segment between the seek point and position will be decoded and discarded. When doing stream copy or when -noaccurate_seek is used, it will be preserved.

      当使用作为输出选项(在输出文件名之前),解码,但丢弃输入,直到时间戳达到位置。

      When used as an output option (before an output filename), decodes but discards input until the timestamps reach position.

      位置可能在几秒钟内或在 hh:mm:ss [.xxx] form。

      position may be either in seconds or in hh:mm:ss[.xxx] form.

      这篇关于如何在给定的时间提取ffmpeg的视频的1个屏幕截图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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