Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
== 7.0.0-beta.10 2025-04-08

Fixes:
* Properly handle uncommon input pixel formats in the built-in presets.

== 7.0.0-beta.9 2025-04-07

Improvements:
Expand Down
17 changes: 8 additions & 9 deletions lib/ffmpeg/presets/dash/h264.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,23 +291,22 @@ def initialize(
# We also apply the desired pixel format to the video stream,
# as well as set the display aspect ratio to the calculated aspect ratio
# to resolve potential issues with different aspect ratios.
stream_filters =
stream_filter_graphs =
h264_presets.each_with_index.map do |h264_preset, index|
fps_filter = Filters.fps(adjusted_frame_rate(h264_preset.frame_rate))
format_filter = h264_preset.format_filter
scale_filter = h264_preset.scale_filter(media)
dar_filter = Filters.set_dar(media.calculated_aspect_ratio) if media.calculated_aspect_ratio
format_filter = Filters.format(pixel_formats: [h264_preset.pixel_format])

Filter.join(*[
fps_filter.with_input_link!("v#{index}"),
scale_filter,
dar_filter,
format_filter.with_output_link!("v#{index}out")
].compact)
stream_filters = [fps_filter, format_filter, scale_filter, dar_filter].compact
stream_filters.first.with_input_link!("v#{index}")
stream_filters.last.with_output_link!("v#{index}out")

Filter.join(*stream_filters)
end

# Apply the generated filter complex to the output.
filter_complex split_filter, *stream_filters
filter_complex split_filter, *stream_filter_graphs

# Force keyframes at the specified interval.
force_key_frames "expr:gte(t,n_forced*#{preset.keyframe_interval})"
Expand Down
7 changes: 5 additions & 2 deletions lib/ffmpeg/presets/h264.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,7 @@ def initialize(
video_profile preset.video_profile
frame_rate preset.frame_rate
constant_rate_factor preset.constant_rate_factor
pixel_format preset.pixel_format
filter preset.scale_filter(media)
filters preset.format_filter, preset.scale_filter(media)
end

map media.audio_mapping_id do
Expand All @@ -344,6 +343,10 @@ def fits?(media)
end
end

def format_filter
Filters.format(pixel_formats: @pixel_format)
end

def scale_filter(media)
return unless @max_width || @max_height

Expand Down
2 changes: 1 addition & 1 deletion lib/ffmpeg/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module FFMPEG
VERSION = '7.0.0-beta.9'
VERSION = '7.0.0-beta.10'
end