我想从所有符合下面模式的文件夹中获取mp4文件列表及其相应的持续时间
例如:LO1 / LO1.MP4,LO3 / LO3.MP4
我尝试了以下但是我得到了多个条目以及我无法弄清楚文件名:
$ mediainfo /var/www/videos/L*/L*.mp4 | grep Duration Duration : 25mn 54s Duration : 25mn 54s Material_Duration : 1554665 Duration : 25mn 54s Material_Duration : 1554688 Duration : 37mn 21s Duration : 37mn 21s Material_Duration : 2241664 Duration : 37mn 21s Material_Duration : 2241696 Duration : 26mn 6s Duration : 26mn 6s Duration : 26mn 6s Duration : 30mn 41s Duration : 30mn 41s Duration : 30mn 41s Duration : 39mn 41s Duration : 39mn 41s Duration : 39mn 41s Duration_LastFrame : -7ms Duration : 37mn 2s Duration : 37mn 2s Duration : 37mn 2s Duration_LastFrame : -12ms Duration : 34mn 24s Duration : 34mn 24s Duration : 34mn 24s Duration : 31mn 7s Duration : 31mn 7s Duration : 31mn 7s Duration : 31mn 57s Duration : 31mn 57s Duration : 31mn 57s Duration : 29mn 30s Duration : 29mn 30s Duration : 29mn 30s Duration : 36mn 28s Duration : 36mn 28s Duration : 36mn 27s Material_Duration : 2187988
那么如何获取文件名列表(.mp4)及其相应的持续时间?
-exec
这种类型的任务的查找标志,因为它们可以节省大量的进程分支:find [filter rules] -exec mediainfo \{\} + | grep [filter]
或者如果你没有找到GNUfind [filter rules] -print0 | xargs -0 mediainfo | grep [filter]
。