gpt4 book ai didi

ffmpeg - Timelimit 播放时长的两倍

转载 作者:行者123 更新时间:2023-12-04 23:32:33 30 4
gpt4 key购买 nike

关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。












我们不允许在 Stack Overflow 上提出有关通用计算硬件和软件的问题。您可以编辑问题,使其成为 on-topic对于堆栈溢出。


2年前关闭。







Improve this question




我正在使用以下命令流式传输到测试端点:

ffmpeg -loglevel debug -f lavfi -re -i testsrc=size=hd720:rate=30 
-f lavfi -re -i anoisesrc
-vf "drawtext=fontfile=\'/Library/Fonts/Arial.ttf\': text=\'Local time %{localtime\: %Y\/%m\/%d %H.%M.%S} (%{n})\': x=50: y=50: fontsize=48: fontcolor=white: box=1: boxcolor=0x00000099"
-pix_fmt yuv420p -c:v libx264 -b:v 1000k -g 30 -profile:v baseline -preset veryfast
-c:a libfdk_aac -b:a 96k -timelimit 60 -f flv $RTMP_OUTPUT/$NAME

因为我将此命令添加到我的自动化中,所以我想保护它免于无限期运行,以防我的脚本出现问题(我在与脚本分离的后台进程中启动 ffmpeg 作业)。因此,我添加了标志 -timelimit 60 ,根据 documentation ,作业应在 duration 秒后退出。

我可以看到命令被正确解析

Reading option '-timelimit' ... matched as option 'timelimit' (set max runtime in seconds) with argument '60'.
...
Finished splitting the commandline.
...
Applying option timelimit (set max runtime in seconds) with argument 60.
...

这是一个示例输出

enter image description here

问题是我注意到流运行的时间超过了指定的时间。经过几次测试后,我注意到它运行了两倍的时间,这让我开始思考它是否占用了帧数(假设为 2 秒帧)。

有人可以澄清 timelimit请选择?以及运行时间超过指定时间的可能原因。

PS:我在 MAC OS Mojave (10.14.6) 上使用 ffmpeg 版本 4.1.4

最佳答案

-timelimit使用用户/utime。不是 real/rtime/wall-clock 时间,也不是与输入文件的帧率或持续时间直接相关。您可以通过添加 -benchmark 来确认这一点将时间信息记录到控制台输出的全局选项:

bench: utime=59.575s stime=1.273s rtime=105.475s

What do 'real', 'user' and 'sys' mean in the output of time(1)?

关于ffmpeg - Timelimit 播放时长的两倍,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58105292/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com