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

Add :force_transcoding option #65

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

FelonEkonom
Copy link
Member

@FelonEkonom FelonEkonom commented Feb 21, 2025

@FelonEkonom FelonEkonom requested a review from mat-hek February 21, 2025 11:36
@FelonEkonom FelonEkonom self-assigned this Feb 21, 2025
lib/boombox.ex Outdated
@spec run(Enumerable.t() | nil,
input: input(),
output: output(),
enforce_transcoding?: boolean()
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 make it possible to enforce transcoding of only audio or video and also specify the desired output codec

Copy link
Member Author

Choose a reason for hiding this comment

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

I will make it possible to enforce transcoding of only video or audio, but IMO specifying the desired output codec should be done in a completely separate option, because

  1. For now it makes sense only for WebRTC output (so maybe it should be a webrtc output option?)
  2. Sbd could want to specify the output codec without enforcing transcoding or vice versa, so what is the point of merging these 2 things into one?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not saying that it should be one option, but they are somehow related, so we should make sure that they make sense together. For example, having the codec as an output option and enforce_transcoding as a top-level option would be confusing to me.

@FelonEkonom FelonEkonom requested a review from mat-hek February 25, 2025 10:49
@FelonEkonom FelonEkonom changed the title Add :enforce_transcoding? option Add :force_transcoding? option Mar 14, 2025
@FelonEkonom FelonEkonom changed the title Add :force_transcoding? option Add :force_transcoding option Mar 14, 2025
lib/boombox.ex Outdated
@@ -9,6 +9,8 @@ defmodule Boombox do

alias Membrane.RTP

@type force_transcoding_value() :: boolean() | :audio | :video
Copy link
Member

Choose a reason for hiding this comment

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

I'd make it full tuple

Suggested change
@type force_transcoding_value() :: boolean() | :audio | :video
@type force_transcoding() :: {:force_transcoding, boolean() | :audio | :video}

lib/boombox.ex Outdated
Comment on lines 118 to 127
If `:enforce_audio_transcoding?` or `:enforce_video_transcoding?` option is set to `true`,
boombox will perform audio and/or video transcoding, even if it is not necessary. By default
both options are set to `false`.

```
Boombox.run(input: "path/to/file.mp4", output: {:webrtc, "ws://0.0.0.0:1234"}, enforce_transcoding?: true)
Boombox.run(
input: "path/to/file.mp4",
output: {:webrtc, "ws://0.0.0.0:1234"},
enforce_video_transcoding?: true,
enforce_audio_transcoding?: true
Copy link
Member

Choose a reason for hiding this comment

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

seems outdated

lib/boombox.ex Outdated
Comment on lines 431 to 447
defp resolve_force_transcoding(opts) do
maybe_keyword =
opts.output
|> Tuple.to_list()
|> List.last()

force_transcoding =
Keyword.keyword?(maybe_keyword) && Keyword.get(maybe_keyword, :force_transcoding, false)

opts
|> Map.put(:force_transcoding, force_transcoding)
|> Map.update!(:output, fn
{:webrtc, signaling, _opts} -> {:webrtc, signaling}
{:hls, location, _opts} -> {:hls, location}
{:mp4, location, _opts} -> {:mp4, location}
other -> other
end)
Copy link
Member

Choose a reason for hiding this comment

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

This looks bad. Why not keep enforce_transcoding like all other options?

@FelonEkonom FelonEkonom requested a review from mat-hek March 18, 2025 11:10
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 option in Boombox to enforce transcoding
3 participants