S
S
stainer2019-08-15 12:53:31
PHP
stainer, 2019-08-15 12:53:31

How to give a section of a wav file?

Good afternoon, a non-standard task has appeared that needs to be implemented in PHP.
There is an hour-long wav file on the server (site.ru/sound.wav).
It is necessary to implement the return of only part of the entire audio track according to get parameters, for example site.ru/sound.wav?start=0&end=20
I.e. start and end interval in seconds (if start = 0 and end = 20, then the first 20 seconds of the entire sound.wav are given).
PS It is necessary to give a 20-second segment, and not reproduce these seconds.
How can such functionality be implemented?
Thank you very much in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
coderisimo, 2019-08-15
@stainer

take a look at https://github.com/PHP-FFMpeg/PHP-FFMpeg . I have not used it myself, but it looks like what is required))

$audio->filters()->clip(FFMpeg\Coordinate\TimeCode::fromSeconds(30), FFMpeg\Coordinate\TimeCode::fromSeconds(15));

G
Gomonov, 2019-08-15
@Gomonov

Maybe ffmpeg will help you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question