check duration of audio files on the command-line

后端 未结 14 870
攒了一身酷
攒了一身酷 2021-02-05 00:00

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:42

    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.

提交回复
热议问题