Add output resolution support via output format struct width/height#23
Add output resolution support via output format struct width/height#23khamilowicz wants to merge 8 commits into
Conversation
9a2754b to
7591111
Compare
|
|
||
| defp resolve_output_stream_format(nil, input_format) do | ||
| case input_format do | ||
| %{width: _width, height: _height} -> %{input_format | width: nil, height: nil} |
There was a problem hiding this comment.
why would we discard width and height from the input_format?
There was a problem hiding this comment.
Well, we either have defined resolution for the output, in which case we only care about it (to pass to the scaler), or we don't, so we skip scaling resolution, so we indicate it by passing nils. I don't think we need input at all.
There was a problem hiding this comment.
let's add a comment saying that, it's not 100% obvious at the first sight that leaving width: nil, height: nil will cause the scaler not to be used if the output_spec doesn't define width and height :D
90789b3 to
b4ea4c0
Compare
|
|
||
| defp resolve_output_stream_format(nil, input_format) do | ||
| case input_format do | ||
| %{width: _width, height: _height} -> %{input_format | width: nil, height: nil} |
There was a problem hiding this comment.
let's add a comment saying that, it's not 100% obvious at the first sight that leaving width: nil, height: nil will cause the scaler not to be used if the output_spec doesn't define width and height :D
|
|
||
| defp apply_resolution(format, nil), do: format | ||
|
|
||
| defp apply_resolution(format, {_width, _height}), do: format |
There was a problem hiding this comment.
Hmm, shouldn't we somehow use that _width and _height? I know that we cannot update these fields in format since they are not there, but I think that a scaler would need to be used
Resolution is specified directly on the output format struct (e.g.
`%H264{width: 160, height: 90}`) rather than as a separate option.
SWScale.Converter handles scaling when non-nil dimensions are present.
Parser-only shortcuts for H264→H264 and H265→H265 are blocked when
output has non-nil dimensions, since scaling requires full decode+encode.
Vulkan path uses the same SWScale-based scaling approach. Converter
no-op detection is consolidated into named defguardp helpers:
is_nv12_native/1, raw_video_passthrough/2, h26x_compatible_input/1.
Scaling integration tests added with reference fixtures (160x90, half
of the 320x180 source) for software path (H264↔H264, H264↔RawVideo).
Fixture filenames include resolution and proper format extension.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Complete the API change to remove output_stream_format and resolution
from %Membrane.Transcoder{} bin options. All output-related
configuration must now go through output_stream_format or output pad
options via via_out.
Changes:
- Updated pad option descriptions to remove bin inheritance references
- Moved output_stream_format and resolution from bin options to pad
options in all integration tests
- Regenerated scaling fixtures to match new behavior
- Fixed typo in transcoding_policy description
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
…ions These options are now strictly bin-level options and cannot be overridden per-output. The pad options for outputs are now limited to: - output_stream_format: the desired output format - resolution: per-output video resolution override Changes: - Removed transcoding_policy and native_acceleration from output pad options in lib/transcoder.ex - Updated documentation examples to not pass these via via_out - Updated handle_pad_added to use bin-level values directly instead of falling back from pad options - Removed test 'multivariant output: per-output transcoding_policy is respected' as this feature is no longer supported Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
bab7c3e to
d568580
Compare
| * VP8/VP9 (libvpx): VBR mode with auto target bitrate | ||
| """ | ||
| ], | ||
| resolution: [ |
There was a problem hiding this comment.
Are we using this option anywhere? 🤔
It looks that in handle_pad_added we just do resolution: pad_opts.resolution (so we don't fallback to this resolution from element options)
Summary
%H264{width: 160, height: 90}) rather than as a separate optionSWScale.Converterhandles scaling when non-nil dimensions are presentTest plan
mix testto verify all integration tests pass🤖 Generated with Claude Code