Pydub - combine split_on_silence with minimum length / file size

后端 未结 2 870
梦如初夏
梦如初夏 2020-12-31 20:30

I have two scripts, one of them splits audio of a certain length, the other one splits audio on every time there is a silent passage. Would it be possible to split the audio

2条回答
  •  伪装坚强ぢ
    2020-12-31 21:09

    The solution is to use mp3splt instead: http://mp3splt.sourceforge.net/mp3splt_page/documentation/man.html

    -t TIME[>MIN_TIME] Time mode. This option will create an indefinite number of smaller files with a fixed time length specified by TIME (which has the same format described above). It is useful to split long files into smaller (for example with the time length of a CD). Adjust option (-a) can be used to adjust splitpoints with silence detection. >MIN_TIME can be used to specify the theoretical minimum track length of the last segment; it allows avoiding to create very small files as the last segment. Make sure to quote the argument when using MIN_TIME - "TIME>MIN_TIME".

    Then, it can be used in python like this:

    import os
    os.system("mp3splt inputfile.mp3")
    

提交回复
热议问题