如何在bash脚本或python中将时间码(hh:mm:ss:frame)计算为毫秒或秒

2024-10-01 19:32:51 发布

您现在位置:Python中文网/ 问答频道 /正文

这个计算我试过很多次了。但不知道有什么区别。。 例如,1000ms/29.97=1frame around 33ms(更准确地说:0.03336s),根据这个规则,如果计算09:30:58;11帧到秒,我可以得到34256.363s,但是其他计算工具给出了34256.388s

#!/bin/bash
hours=9
min=30
sec=56
frame=11
totalseconds=$(echo "scale=1; ($hours*60*60)+($min*60)+($sec)+($frame*0.033)" | bc -l)
echo $totalseconds

我不知道有什么区别??在


Tags: 工具echobashbin规则secminframe

热门问题