Aske
Aske
SMSoftware Mansion
Created by harrisi on 8/8/2024 in #membrane-help
Background loop with sound effect playback on event
To "merge" multiple audios you need the Membrane.AudioMixer
13 replies
SMSoftware Mansion
Created by harrisi on 8/8/2024 in #membrane-help
Background loop with sound effect playback on event
One thing that made it a lot easier for me was to not use MP3s as input, but RAW audio instead. When you seek in the MP3 file you risk incomplete data being emitted to your MP3 decoder.
13 replies
SMSoftware Mansion
Created by Aske on 7/4/2024 in #membrane-help
H265 choppy playback in QuickTime on Mac
I'll watch out for the PR in membrane_mp4_plugin
14 replies
SMSoftware Mansion
Created by Aske on 7/4/2024 in #membrane-help
H265 choppy playback in QuickTime on Mac
Ok. Thanks a lot for your replies!
14 replies
SMSoftware Mansion
Created by Aske on 7/4/2024 in #membrane-help
H265 choppy playback in QuickTime on Mac
(sorry if this is a stupid question, I do not totally understand the dataflow in Membrane pipelines + ctts)
14 replies
SMSoftware Mansion
Created by Aske on 7/4/2024 in #membrane-help
H265 choppy playback in QuickTime on Mac
Aka. will it be possible to drop in this as a replacement for Membrane.MP4.Muxer.ISOM at some point?
14 replies
SMSoftware Mansion
Created by Aske on 7/4/2024 in #membrane-help
H265 choppy playback in QuickTime on Mac
Is it possible to integrate into pipelines as well, or is this more a standalone package for other use cases?
14 replies
SMSoftware Mansion
Created by Aske on 7/4/2024 in #membrane-help
H265 choppy playback in QuickTime on Mac
Super cool!
14 replies
SMSoftware Mansion
Created by Aske on 7/4/2024 in #membrane-help
H265 choppy playback in QuickTime on Mac
Is that generated with https://github.com/gBillal/ex_mp4 ?
14 replies
SMSoftware Mansion
Created by Aske on 7/4/2024 in #membrane-help
H265 choppy playback in QuickTime on Mac
Hey Billal! Thanks for your hard work on the h265 plugin! That one plays perfectly!
14 replies
SMSoftware Mansion
Created by Aske on 5/6/2024 in #membrane-help
Loop Audio File
You're amazing! This also works for raw audio! Thank you! 🙏
21 replies
SMSoftware Mansion
Created by Aske on 5/6/2024 in #membrane-help
Loop Audio File
Attempted again using a Filter as you described, but I still cannot get it to work. This time with raw audio to eliminate the mp3 issue: https://gist.github.com/Doerge/77bc2a10e53da07a4124a861fb7526bd On the end_of_stream event in the Filter on the input pad, I send an event:
@impl Membrane.Element.WithInputPads
def handle_end_of_stream(:input, _ctx, state) do
Logger.warning("end of stream in filter.input")

seek_event =
%Membrane.File.SeekSourceEvent{
start: :bof,
size_to_read: :infinity,
last?: true
}

events =
[
{:event, {:input, seek_event}}
]

{events, %{loops: state.loops - 1}}
end
@impl Membrane.Element.WithInputPads
def handle_end_of_stream(:input, _ctx, state) do
Logger.warning("end of stream in filter.input")

seek_event =
%Membrane.File.SeekSourceEvent{
start: :bof,
size_to_read: :infinity,
last?: true
}

events =
[
{:event, {:input, seek_event}}
]

{events, %{loops: state.loops - 1}}
end
which looks like it is being received, because I see other elements (:mixer) receiving it in the logs:
[debug] <0.4856.0>/:loop_filter Received end of stream on pad :input
[debug] <0.4856.0>/:mixer Received event %Membrane.File.NewSeekEvent{} on pad {Membrane.Pad, :input, #Reference<0.448509681.3489398788.16262>}
[warning] end of stream in filter.input
[warning] got end of stream for loop_filter on pad input
[debug] <0.4856.0>/:mixer Received event %Membrane.File.NewSeekEvent{} on pad {Membrane.Pad, :input, #Reference<0.448509681.3489398788.16262>}
[debug] <0.4856.0>/:loop_filter Received end of stream on pad :input
[debug] <0.4856.0>/:mixer Received event %Membrane.File.NewSeekEvent{} on pad {Membrane.Pad, :input, #Reference<0.448509681.3489398788.16262>}
[warning] end of stream in filter.input
[warning] got end of stream for loop_filter on pad input
[debug] <0.4856.0>/:mixer Received event %Membrane.File.NewSeekEvent{} on pad {Membrane.Pad, :input, #Reference<0.448509681.3489398788.16262>}
But it's only received once, so I assume it didn't work out.. I think I'm unfortunately still misunderstanding something conceptually here, but what? I've dug through documentation, and examples, but can't find anything similar to what I want to do here. Any help would be appreciated.
21 replies
SMSoftware Mansion
Created by Aske on 5/6/2024 in #membrane-help
Loop Audio File
Yes, will do. Shaving it down to the minimums now.
21 replies
SMSoftware Mansion
Created by Aske on 5/6/2024 in #membrane-help
Loop Audio File
I tried to comment out the remove_children, to rule out that cleanup being the source of the error. The only time I remove anything is with {[terminate: :normal], state}
21 replies
SMSoftware Mansion
Created by Aske on 5/6/2024 in #membrane-help
Loop Audio File
Hmm.. I never got this to work. I keep running into this unlink error. It looks like it's running correctly at least once, but perhaps the last run isn't cleaned up correctly (playback: :stopped in the logs below):
[error] GenServer #PID<0.8714.0> terminating
** (Membrane.PadError) Tried to unlink a static pad :output, before it was linked. Static pads cannot be unlinked unless element is terminating
(membrane_core 1.0.1) lib/membrane/core/element/pad_controller.ex:253: Membrane.Core.Element.PadController.handle_unlink/2
(membrane_core 1.0.1) lib/membrane/core/element.ex:254: Membrane.Core.Element.handle_info/2
(stdlib 4.3.1.3) gen_server.erl:1123: :gen_server.try_dispatch/4
(stdlib 4.3.1.3) gen_server.erl:1200: :gen_server.handle_msg/6
(stdlib 4.3.1.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: {Membrane.Core.Message, :handle_unlink, :output, []}
State: %Membrane.Core.Element.State{module: Membrane.FFmpeg.SWResample.Converter, name: {:converter_bg, #Reference<0.1532085730.115867653.111238>}, parent_pid: #PID<0.8559.0>, playback: :stopped, type: :filter, internal_state: %{input_stream_format: nil, input_stream_format_provided?: false, native: nil, output_stream_format: %Membrane.RawAudio{channels: 2, sample_rate: 48000, sample_format: :s16le}, pts_queue: [], queue: ""}, pad_refs: [:input], pads_info: %{input: %{accepted_formats_str:...
[error] GenServer #PID<0.8714.0> terminating
** (Membrane.PadError) Tried to unlink a static pad :output, before it was linked. Static pads cannot be unlinked unless element is terminating
(membrane_core 1.0.1) lib/membrane/core/element/pad_controller.ex:253: Membrane.Core.Element.PadController.handle_unlink/2
(membrane_core 1.0.1) lib/membrane/core/element.ex:254: Membrane.Core.Element.handle_info/2
(stdlib 4.3.1.3) gen_server.erl:1123: :gen_server.try_dispatch/4
(stdlib 4.3.1.3) gen_server.erl:1200: :gen_server.handle_msg/6
(stdlib 4.3.1.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: {Membrane.Core.Message, :handle_unlink, :output, []}
State: %Membrane.Core.Element.State{module: Membrane.FFmpeg.SWResample.Converter, name: {:converter_bg, #Reference<0.1532085730.115867653.111238>}, parent_pid: #PID<0.8559.0>, playback: :stopped, type: :filter, internal_state: %{input_stream_format: nil, input_stream_format_provided?: false, native: nil, output_stream_format: %Membrane.RawAudio{channels: 2, sample_rate: 48000, sample_format: :s16le}, pts_queue: [], queue: ""}, pad_refs: [:input], pads_info: %{input: %{accepted_formats_str:...
I don't even kill the group right now, just add it:
@impl true
def handle_element_end_of_stream({:decoder_mp3_bg, ref}, :input, ctx, state) do
if ctx.playback == :playing do
children = [make_bg_audio_group(state)]

{[spec: children], state}
else
{[], state}
end
end
@impl true
def handle_element_end_of_stream({:decoder_mp3_bg, ref}, :input, ctx, state) do
if ctx.playback == :playing do
children = [make_bg_audio_group(state)]

{[spec: children], state}
else
{[], state}
end
end
I don't think I really understand what's happening here 😬
21 replies
SMSoftware Mansion
Created by Aske on 5/6/2024 in #membrane-help
Loop Audio File
Thanks for the help!
21 replies
SMSoftware Mansion
Created by Aske on 5/6/2024 in #membrane-help
Loop Audio File
Ah, did not know that was possible!
21 replies
SMSoftware Mansion
Created by Aske on 5/6/2024 in #membrane-help
Loop Audio File
Duplicated names in children specification: [:mp3_source_bg, :decoder_mp3_bg, :converter_bg]
Duplicated names in children specification: [:mp3_source_bg, :decoder_mp3_bg, :converter_bg]
21 replies
SMSoftware Mansion
Created by Aske on 5/6/2024 in #membrane-help
Loop Audio File
Can I remove and add named elements in one go? Or how would I go about doing that? It complains over this:
children = [...from above]
{[remove_children: [:mp3_source_bg, :decoder_mp3_bg, :converter_bg], spec: children], state}
children = [...from above]
{[remove_children: [:mp3_source_bg, :decoder_mp3_bg, :converter_bg], spec: children], state}
21 replies
SMSoftware Mansion
Created by Aske on 5/6/2024 in #membrane-help
Loop Audio File
Ah.. yeah, I see. It would still be an issue for the MAD.Decoder
21 replies