如何使ffmpeg在文件名中插入时间戳

时间:2016-01-19 18:38:55

标签: ffmpeg

我试图制作一个bash脚本,从ip摄像头抓取静止图像而不是通过电子邮件发送它。

使用ffmpeg -i http://admin:Stupidpassword1@10.12.10.40/Streaming/channels/1/picture -f image2 -updatefirst 1来自我读过的门铃。这应该可以,但输出文件名仍然是doorbell.jpg如何创建文件名TIMESTAMPdoorbell.jpg?< / p>

1 个答案:

答案 0 :(得分:9)

使用“strftime”功能:

ffmpeg -i http://admin:Stupidpassword1@10.12.10.40/Streaming/channels/1/picture -vframes 1 -f image2 -strftime 1 "%Y-%m-%d_%H-%M-%S_doorbell.jpg"

“ - vframes 1”将使其仅处理它收到的第一帧。

您可以使用strftime兼容字符串更改日期/时间格式: http://man7.org/linux/man-pages/man3/strftime.3.html

进一步的文档/示例: https://www.ffmpeg.org/ffmpeg-formats.html#image2-2

相关问题