diff --git a/lib/ffmpeg/encoding_options.rb b/lib/ffmpeg/encoding_options.rb index 4bbf2369..247331b9 100644 --- a/lib/ffmpeg/encoding_options.rb +++ b/lib/ffmpeg/encoding_options.rb @@ -172,6 +172,14 @@ def convert_watermark(value) ["-i", value] end + def convert_profile(value) + ["-profile:v", value] + end + + def convert_pix_fmt(value) + ["-pix_fmt", value] + end + def convert_watermark_filter(value) position = value[:position] padding_x = value[:padding_x] || 10 diff --git a/spec/ffmpeg/encoding_options_spec.rb b/spec/ffmpeg/encoding_options_spec.rb index a9676687..98809d1a 100644 --- a/spec/ffmpeg/encoding_options_spec.rb +++ b/spec/ffmpeg/encoding_options_spec.rb @@ -124,6 +124,14 @@ module FFMPEG expect(EncodingOptions.new(screenshot: true, vframes: 123, quality: 3).to_a).to eq(%w(-f image2 -vframes 123 -q:v 3)) end + it "should accept and set profile:v" do + expect(EncodingOptions.new(profile: "baseline").to_a).to eq(%w(-profile:v baseline)) + end + + it "should accept and set pix_fmt" do + expect(EncodingOptions.new(pix_fmt: "yuv420p").to_a).to eq(%w(-pix_fmt yuv420p)) + end + it 'should put the parameters in order of codecs, presets, others' do opts = Hash.new opts[:frame_rate] = 25