ai didi

php - 如何使用 ffmpeg 跳过起始帧

转载 作者:行者123 更新时间:2023-12-04 22:45:07 24 4
gpt4 key购买 nike

我使用 ffmpeg 创建视频的简短预览...

$length = $length_video/5;

$ffmpeg_path." -i ".$content." -vf select='lt(mod(t\,".$length.")\,1)',setpts=N/FRAME_RATE/TB -af aselect='lt(mod(t\,".$length.")\,1)',asetpts=N/SR/TB -an ".$content_new.";

实际上这将创建 5 秒。视频。问题是因为第一帧是从 0-1 秒提取的。

有没有机会跳过第一帧并提取接下来的 5 帧?

问题是因为视频介绍的第一帧实际上是无用的

最佳答案

此选择过滤器应跳过前 5 帧:

$ ffmpeg -i input_file -vf select="gte(n\, 5)"   ...
对于时间跨度,它更容易 - 这会跳过第一秒:
$ ffmpeg -i input_file -ss 1   ...
-ss需要一段时间:

The following examples are all valid time duration:

5555 seconds

12:03:4512 hours, 03 minutes and 45 seconds

23.18923.189 seconds


由于视频压缩的工作机制(P 和 B 帧不能独立存在),这些方法都不会完全准确。 ffmpeg 将尝试进行相应调整:

Note that 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.


引用 ffmpeg documentation更多。

关于php - 如何使用 ffmpeg 跳过起始帧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49846095/

24 4 0
文章推荐: ffmpeg - ffmpeg中来自一个来源的多个音轨
文章推荐: ffmpeg - 无法写入时间戳未知的数据包 av_interleaved_write_frame() : Invalid argument
文章推荐: ffmpeg - 为什么获取以及如何修复 ffmpeg : not enough frames to estimate rate; consider increasing probesize? 上的警告/错误
文章推荐: r - 导入 png 文件并在 R 中转换为动画(.mp4)
行者123
个人简介

我是一名优秀的程序员,十分优秀!

滴滴打车优惠券免费领取
滴滴打车优惠券
全站热门文章
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com