#!/bin/bash
### 获取文件下mp4视频的时长并转为毫秒长度
path="/d/datas/videos"
for file in $path/*.mp4
do
echo $file
duration=`ffmpeg -i $file 2>&1 |grep 'Duration'|cut -d ' ' -f 4 |sed s/,//|tr -d ' '`
echo $duration
time=`echo $duration | awk -F ':' '{print ($1*3600+$2*60+$3)*1000}'`
echo $time
done
shell脚本-获取文件下mp4视频的时长并转为毫秒长度
最新推荐文章于 2024-07-25 17:51:53 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)