Generate audio sprite using ffmpeg in php

Generate audio sprite using ffmpeg in php

Closed - This job posting has been filled.

Job Description

Concat:
cat in.mp3 1.mp3 2.mp3 out.mp3 | ffmpeg -i - combo.mp3

Get durations in milliseconds:
http://superuser.com/questions/361329/how-to-get-length-of-video-file-from-console
And generate a Json file with start times, end times and durations for each sound in the sprite, as well as the original file name:

[
{start: 0.00, end: 2.21, duration: 2.21, name: 'sound1.mp3'},
{start: 3.21 end: 5.55, duration: 2.34, name: 'sound2.mp3'}
]

Put a 1 second spacer between sounds, and of course calculate that in the Json.

The php function needs to be passed a directory of mp3s. And will save the sprite audio file and Json file as. .js file in the same directory.

The script needs to execute the conversion/concat by calling ffmpeg in the shell and immediately returning to php, so as not to hold up the php script execution. Getting durations can't operate that way since the php script must generate the Json, and those are probably quick functions anyway.

---
Skills: json