Skip to content

AV1 muxer - #125

Merged
Noarkhh merged 9 commits into
membraneframework:masterfrom
maslowalex:av1-muxer
Sep 30, 2026
Merged

Noarkhh merged 9 commits into
membraneframework:masterfrom
maslowalex:av1-muxer

Conversation

@maslowalex

Copy link
Copy Markdown
Contributor

No description provided.

@maslowalex
maslowalex requested a review from mat-hek as a code owner February 4, 2026 13:29
@mat-hek mat-hek added this to Smackore Feb 5, 2026
@mat-hek mat-hek moved this to In Review in Smackore Feb 5, 2026

@mat-hek mat-hek left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@maslowalex
maslowalex requested a review from mat-hek March 26, 2026 13:20
@Noarkhh Noarkhh assigned Noarkhh and unassigned mat-hek May 7, 2026
@mat-hek
mat-hek requested review from Noarkhh and removed request for mat-hek May 14, 2026 11:00
@maslowalex
maslowalex force-pushed the av1-muxer branch 2 times, most recently from 8ce056a to e02a7c3 Compare June 29, 2026 10:01

@Noarkhh Noarkhh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi, thank you for the contribution! Sorry this took so long, but I was during the development of membrane_av1_plugin and wanted to finish working on the encoder and decoder there, so that the API is somewhat stable.

During said development there were changes to Membrane.AV1 format and I added suggestions conforming to the new version.

Also please add tests in test/membrane_mp4/demuxer/isom/integration_test.exs.

Comment on lines +247 to +249
profile: format.profile || 0,
level_idx: level_string_to_idx(format.level) || 8,
tier: format.tier || 0,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In the last release of membrane_av1_format, these three fields are now all atoms. They can be converted to their respective seq_ values with utility functions from Membrane.AV1 module:
profile_to_seq_profile/1, level_to_seq_level_idx/1 and tier_to_seq_tier/1

Comment on lines +260 to +277
# Convert AV1 level string to level index
defp level_string_to_idx(nil), do: nil
defp level_string_to_idx("2.0"), do: 0
defp level_string_to_idx("2.1"), do: 1
defp level_string_to_idx("3.0"), do: 4
defp level_string_to_idx("3.1"), do: 5
defp level_string_to_idx("4.0"), do: 8
defp level_string_to_idx("4.1"), do: 9
defp level_string_to_idx("5.0"), do: 12
defp level_string_to_idx("5.1"), do: 13
defp level_string_to_idx("5.2"), do: 14
defp level_string_to_idx("5.3"), do: 15
defp level_string_to_idx("6.0"), do: 16
defp level_string_to_idx("6.1"), do: 17
defp level_string_to_idx("6.2"), do: 18
defp level_string_to_idx("6.3"), do: 19
defp level_string_to_idx(_), do: nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These will no longer be necessary

Comment thread lib/membrane_mp4/muxer/isom.ex Outdated
},
%Membrane.Opus{self_delimiting?: false}
%Membrane.Opus{self_delimiting?: false},
%Membrane.AV1{}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
%Membrane.AV1{}
%Membrane.AV1{alignment: :tu}

Comment thread lib/membrane_mp4/track.ex Outdated
Comment on lines +93 to +94
| {:av01,
%{profile: non_neg_integer(), level: String.t() | nil, tier: non_neg_integer()}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The convention is to use raw values from the format, so I propose to do it for level as well

Suggested change
| {:av01,
%{profile: non_neg_integer(), level: String.t() | nil, tier: non_neg_integer()}}
| {:av01,
%{profile: non_neg_integer(), level: non_neg_integer(), tier: non_neg_integer()}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This also needs to be added to Membrane.CMAF.Track.t() in membrane_cmaf_format package, if you could open a PR there that would be great

Comment thread lib/membrane_mp4/track.ex Outdated
Comment on lines +146 to +148
profile: format.profile || 0,
level: format.level,
tier: format.tier || 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as before, use utility functions from Membrane.AV1


# partial segments for the following 8 seconds without a keyframe
for _iteration <- 1..16 do
for _ <- 1..16 do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It was like this previously because we have credo warn when a variable is named _

Suggested change
for _ <- 1..16 do
for _iteration <- 1..16 do

Comment thread mix.exs Outdated
{:membrane_h264_format, "~> 0.6.1"},
{:membrane_h265_format, "~> 0.2.0"},
{:membrane_opus_format, "~> 0.3.0"},
{:membrane_av1_format, "~> 0.1.0"},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
{:membrane_av1_format, "~> 0.1.0"},
{:membrane_av1_format, "~> 0.3.0"},

@maslowalex
maslowalex force-pushed the av1-muxer branch 2 times, most recently from 73b2af4 to 9a96a0d Compare August 11, 2026 11:03

@Noarkhh Noarkhh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good overall, but please address these naming suggestions and add some muxer tests

alias Membrane.MP4.MovieBox.SampleTableBox
alias Membrane.MP4.Track.SampleTable

@temporal_delimiter <<0x12, 0x00>>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
@temporal_delimiter <<0x12, 0x00>>
@av1_temporal_delimiter_obu <<0x12, 0x00>>

Comment thread lib/membrane_mp4/muxer/isom.ex Outdated
Comment on lines +302 to +303
defp strip_temporal_delimiter(<<0x12, 0x00, rest::binary>>), do: strip_temporal_delimiter(rest)
defp strip_temporal_delimiter(payload), do: payload

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
defp strip_temporal_delimiter(<<0x12, 0x00, rest::binary>>), do: strip_temporal_delimiter(rest)
defp strip_temporal_delimiter(payload), do: payload
defp strip_av1_temporal_delimiter_obu(<<0x12, 0x00, rest::binary>>), do: strip_temporal_delimiter(rest)
defp strip_av1_temporal_delimiter_obu(payload), do: payload

@mat-hek
mat-hek removed their request for review August 21, 2026 14:57
@maslowalex
maslowalex requested a review from Noarkhh September 2, 2026 08:08
@maslowalex
maslowalex requested a review from mat-hek September 11, 2026 08:55
@Noarkhh
Noarkhh removed the request for review from mat-hek September 30, 2026 20:24
@Noarkhh
Noarkhh merged commit 0bf4ec8 into membraneframework:master Sep 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants