Skip to content

Commit

Permalink
Remove scaling for yuv420p pix fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kapoorlakshya committed Jul 21, 2024
1 parent e960020 commit c71e79a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
5 changes: 0 additions & 5 deletions lib/screen-recorder/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,13 @@ class Options
DEFAULT_FPS = 15.0
DEFAULT_MAC_INPUT_PIX_FMT = 'uyvy422'.freeze # For avfoundation
DEFAULT_PIX_FMT = 'yuv420p'.freeze
YUV420P_SCALING = '"scale=trunc(iw/2)*2:trunc(ih/2)*2"'.freeze

def initialize(options)
# @todo Consider using OpenStruct
@all = verify_options options
advanced[:input] = default_advanced_input.merge(advanced_input)
advanced[:output] = default_advanced_output.merge(advanced_output)
advanced[:log] ||= DEFAULT_LOG_FILE

# Fix for using yuv420p pixel format for output
# @see https://www.reck.dk/ffmpeg-libx264-height-not-divisible-by-2/
advanced_output[:vf] = YUV420P_SCALING if advanced_output[:pix_fmt] == 'yuv420p'
end

#
Expand Down
6 changes: 1 addition & 5 deletions spec/screen-recorder/options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@
opts = described_class.new(input: test_input, output: test_output)
expect(opts.framerate).to be(ScreenRecorder::Options::DEFAULT_FPS)
end

it 'uses video scaling fix if output pixel format is yuv420p' do
expect(options.advanced[:output][:vf]).to eql(ScreenRecorder::Options::YUV420P_SCALING)
end
end

describe '#log' do
Expand All @@ -91,4 +87,4 @@
expect(options.parsed).to be_an_instance_of(String)
end
end # #parsed
end # Rspec.describe
end # Rspec.describe

0 comments on commit c71e79a

Please sign in to comment.