check duration of audio files on the command-line

后端 未结 14 911
没有蜡笔的小新
没有蜡笔的小新 2021-02-05 00:13

I need to check the duration of a group of audio files. Is there a simple way to do this on the unix command-line?

> duration *

I have the a

14条回答
  •  别跟我提以往
    2021-02-05 00:58

    mediainfo can do this, but mediainfo is one of those useful tools that's so badly documented that you almost need to know how to use it in order to learn how to use it (happens a lot in the linux world).

    After hours of trials and reading high and low, I finally got it to generate a recursive comma-separated list of file names and their duration in milliseconds.

    cd to the starting directory and issue the following command:

    find "$(pwd)" -type f -print0 | xargs -0 -I {} mediainfo --Inform="General;%CompleteName%,%Duration%" {} > list.txt
    

    The results will be output to list.txt.

提交回复
热议问题