Attempting to stream MP3 via HLS

Hey! Trying to set up a basic pipeline that will take an MP3 file and stream it via HLS.

I'm able to execute the pipeline and generate an index.m3u8 file (mainly adapting from the camera to HLS example), but I cannot play the file via ffplay when hosted with the example Python server.

[warning] <0.861.0>/:encoder Processing queue is not empty, but EndOfStream event was received

I'm assuming that error warning is related to why my file is unplayable, but I'm unsure how to proceed.

My pipeline is defined as:

defmodule MyApp.Audio.Pipeline do
  use Membrane.Pipeline

  @impl true
  def handle_init(_ctx, path) do
    spec =
      child(:source, %Membrane.File.Source{location: path})
      |> child(:decoder, Membrane.MP3.MAD.Decoder)
      |> child(:converter, %Membrane.FFmpeg.SWResample.Converter{
        output_stream_format: %Membrane.RawAudio{
          sample_format: :s16le,
          sample_rate: 48000,
          channels: 2
      |> child(:encoder, Membrane.AAC.FDK.Encoder)
      |> child(:parser, %Membrane.AAC.Parser{out_encapsulation: :none})
      |> via_in(:input,
        options: [
          encoding: :AAC,
          segment_duration: Membrane.Time.seconds(5)
      |> child(:sink, %Membrane.HTTPAdaptiveStream.SinkBin{
        manifest_module: Membrane.HTTPAdaptiveStream.HLS,
        storage: %Membrane.HTTPAdaptiveStream.Storages.FileStorage{directory: "output"}

    {[spec: spec], %{}}

Thanks in advance!

3 responses