ffmpeg HLS stream processing script (bash)

Job ID: 30942331

Budget: €250 – €750 EUR

Hello,

I need a feature extension of my bash script which I use to create HLS (http-live-stream) streams using ffmpeg. At the current state the script is only able to output a single subtitle and single audio track beside the video even if the source has multiple audio/subtitle languages or channels. So far so good ...

What I need is a script that simply processes all subtitle and all audio track from my mp4 input, creating a playlist m3u8+snippets for each stream. In the end all generated m3u8 files (one for each stream) must be referenced in a master m3u8 playlist file so that the user can simply select a track to play using hls.js or shaka-player. From my understanding the workflow is straight forward and all can be done using ffmepg/ffprobe:

1. Create a HLS stream only for the video inside the mp4.
2. For each audio track within the mp4 container found create a HLS stream accordingly.
3. For each subtitle track within the mp4 container found create a HLS stream accordingly.

Each of the steps (1-3) will output many snippets in .m4s format and each step will generate a single m3u8 file that references these generated m4s and webvtt snippets.

If all that is done, the generated m3u8 playlists (one for each stream as explained above) need to be referenced in a master m3u8 file.

Please see my current work attached.
Related categories: Bash Scripting