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
6 changes: 4 additions & 2 deletions lib/ffmpeg/command_args.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ def adjusted_audio_bit_rate(target_value)

def min_bit_rate(*values)
bit_rate =
values.compact.map do |value|
next value if value.is_a?(Integer)
values.filter_map do |value|
# Some muxers (webm) might not expose birate under certain conditions
next false if value.nil?
next (value.positive? ? value : false) if value.is_a?(Integer)

unless value.is_a?(String)
raise ArgumentError,
Expand Down
4 changes: 2 additions & 2 deletions lib/ffmpeg/media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ def local?
# @return [Boolean]
autoload def hdr?
default_video_stream&.color_primaries == 'bt2020' &&
default_video_stream&.color_space == 'bt2020nc' &&
%w[smpte2084 arib-std-b67].include?(default_video_stream&.color_transfer)
default_video_stream&.color_space == 'bt2020nc' &&
%w[smpte2084 arib-std-b67].include?(default_video_stream&.color_transfer)
end

# Whether the media is rotated (based on the default video stream).
Expand Down
8 changes: 8 additions & 0 deletions spec/ffmpeg/command_args_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ module FFMPEG
expect(args.to_a).to eq(%w[])
end
end

context 'when the reported media bitrate is 0' do
it 'returns the requested bitrate' do
media = instance_double(Media, video_bit_rate: 0)
args = CommandArgs.compose(media) { min_video_bit_rate '2M' }
expect(args.to_a).to eq(%w[-minrate 2000k])
end
end
end

describe '#max_video_bit_rate' do
Expand Down