Get the length of an audio file php

前端 未结 8 549
轻奢々
轻奢々 2020-12-11 01:43

How I can get the length of an audio file in php.

If it\'s too hard to do in php then any other way should work alright.

相关标签:
8条回答
  • 2020-12-11 02:37

    PHP has no standard audio support, you'll have to recompile PHP yourself, or you can use a tool to get the information:

    You could use ffmpeg. Running ffmpeg as follows:

    ffmpeg -i someAudio.mp3
    

    will produce this output:

    Input #0, mp3, from 'someAudio.mp3':
      Duration: 00:00:34.03, start: 0.000000, bitrate: 127 kb/s
        Stream #0.0: Audio: mp3, 48000 Hz, mono, s16, 128 kb/s
    

    now you'll only need a regexp to parse the result.

    0 讨论(0)
  • 2020-12-11 02:39

    Lame is a 3rd party application you could consider.

    LAME is a high quality MPEG Audio Layer III (MP3) encoder licensed under the LGPL.

    0 讨论(0)
提交回复
热议问题