Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLS output #18

Merged
merged 23 commits into from
Aug 19, 2024
Merged

HLS output #18

merged 23 commits into from
Aug 19, 2024

Conversation

Noarkhh
Copy link
Contributor

@Noarkhh Noarkhh commented Aug 5, 2024

closes #4

@Noarkhh Noarkhh requested a review from mat-hek August 5, 2024 10:32
@Noarkhh Noarkhh force-pushed the hls-output branch 2 times, most recently from 8097ee2 to 3b4d7e4 Compare August 6, 2024 15:59
Enum.map(track_builders, fn
{:audio, builder} ->
builder
|> child(Membrane.AAC.FDK.Encoder)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's name the children like here

lib/boombox.ex Outdated
@@ -20,6 +20,7 @@ defmodule Boombox do
| Path.t()
| {:file, file_extension(), Path.t()}
| {:webrtc, webrtc_opts()}
| {:hls | Path.t()}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also trigger HLS when the path ends with .m3u8?

@@ -137,6 +137,21 @@ defmodule BoomboxTest do
Compare.compare(output, "test/fixtures/ref_bun10s_opus_aac.mp4")
end

@tag :file_hls
async_test "mp4 file -> hls output", %{tmp_dir: tmp} do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add more tests and examples in examples.livemd

Comment on lines 66 to 70
@impl true
def handle_pad_added(:input, _ctx, state) do
{[], state}
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@impl true
def handle_pad_added(:input, _ctx, state) do
{[], state}
end


def get_next_sample_actions(pad, [first_sample | rest_samples], segment_filenames) do
{
[buffer: {pad, %Buffer{payload: first_sample}}, redemand: pad],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we send a list of buffers and a single redemand instead?

spec_builder,
child(
:hls_sink_bin,
%Membrane.HTTPAdaptiveStream.SinkBin{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use hls_mode: :muxed_av, it generally works better and that's what fishjam uses

@Noarkhh Noarkhh linked an issue Aug 7, 2024 that may be closed by this pull request
@mat-hek
Copy link
Member

mat-hek commented Aug 7, 2024

@Noarkhh another thing - it would be nice to support serving the HLS via HTTP if someone calls Boombox.run(input: ..., output: "http://localhost:1234/index.m3u8")

@Noarkhh Noarkhh force-pushed the hls-output branch 3 times, most recently from 627b59c to 307fcc7 Compare August 8, 2024 14:19
@Noarkhh
Copy link
Contributor Author

Noarkhh commented Aug 8, 2024

@Noarkhh another thing - it would be nice to support serving the HLS via HTTP if someone calls Boombox.run(input: ..., output: "http://localhost:1234/index.m3u8")

That would require us to write a new Storage implementation, correct?

@Noarkhh Noarkhh requested a review from mat-hek August 8, 2024 18:47
@mat-hek
Copy link
Member

mat-hek commented Aug 19, 2024

@Noarkhh not necessarily, we could either

Anyway, maybe let's do that in another PR 🤔

Base automatically changed from http-streaming to master August 19, 2024 08:41
@spec compare(Path.t(), Path.t(), [:audio | :video]) :: :ok
def compare(subject, reference, kinds \\ [:audio, :video]) do
@spec compare(Path.t(), Path.t(), [:audio | :video], :mp4 | :hls) :: :ok
def compare(subject, reference, kinds \\ [:audio, :video], format \\ :mp4) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's merge kinds and format into a keyword list

@Noarkhh Noarkhh merged commit 717a81f into master Aug 19, 2024
3 checks passed
@Noarkhh Noarkhh deleted the hls-output branch August 19, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add HLS output
2 participants