Conversation
FelonEkonom
requested changes
Mar 25, 2025
lib/transcoder/video.ex
Outdated
| else: :erlang.system_info(:logical_processors_available) | ||
|
|
||
| builder |> child(:vp8_encoder, %VP8.Encoder{g_threads: number_of_threads, cpu_used: 15}) | ||
| encoder = Module.concat(vpx, Encoder) |> struct!(g_threads: number_of_threads, cpu_used: 15) |
Member
There was a problem hiding this comment.
I don't like calling struct!/2 as it allows to create a struct that misses some required fields and I am not sure if it supports non-nil default values
Collaborator
Author
There was a problem hiding this comment.
I removed struct!() usage for both H26x and VPx
FelonEkonom
requested changes
Mar 25, 2025
FelonEkonom
requested changes
Mar 27, 2025
lib/transcoder.ex
Outdated
Comment on lines
140
to
132
| Membrane.Logger.warning(""" | ||
| The only input stream format that can be assumed is | ||
| `%Membrane.RemoteStream{content_format: Membrane.MPEGAudio}`, while you wanted to assume: | ||
| #{inspect(stream_format)} | ||
| """) | ||
|
|
||
| builder | ||
| |> child(:stream_format_changer, %Membrane.Transcoder.StreamFormatChanger{ | ||
| stream_format: stream_format | ||
| }) |
Member
There was a problem hiding this comment.
I suggest to raise here, as the code won't act as the user assumed
Comment on lines
122
to
151
| defp maybe_plug_resampler(builder, input_format, %Opus{}) | ||
| when not is_opus_compliant(input_format) do | ||
| builder | ||
| |> child(:resampler, %Membrane.FFmpeg.SWResample.Converter{ | ||
| output_stream_format: %RawAudio{ | ||
| sample_format: :s16le, | ||
| sample_rate: 48_000, | ||
| channels: 1 | ||
| } | ||
| }) | ||
| end | ||
|
|
||
| defp maybe_plug_resampler(builder, input_format, %AAC{}) | ||
| when not is_aac_compliant(input_format) do | ||
| builder | ||
| |> child(:resampler, %Membrane.FFmpeg.SWResample.Converter{ | ||
| output_stream_format: %RawAudio{ | ||
| sample_format: :s16le, | ||
| sample_rate: 44_100, | ||
| channels: 1 | ||
| } | ||
| }) | ||
| end | ||
|
|
||
| defp maybe_plug_resampler(builder, input_format, %MPEGAudio{}) | ||
| when not is_mp3_compliant(input_format) do | ||
| builder | ||
| |> child(:resampler, %Membrane.FFmpeg.SWResample.Converter{ | ||
| output_stream_format: %RawAudio{sample_rate: 44_100, sample_format: :s32le, channels: 2} | ||
| }) |
Member
There was a problem hiding this comment.
Looks very nice, but are you sure we don't want to plug resampler if e.g. input format doesn't have :channels field?
FelonEkonom
approved these changes
Apr 10, 2025
Co-authored-by: Feliks Pobiedziński <38541925+FelonEkonom@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for:
TODO: