From 22ba206f089e2381126f3abbb345732a9ce23d92 Mon Sep 17 00:00:00 2001 From: Mishaux Date: Sat, 18 Mar 2017 17:29:56 -0600 Subject: [PATCH 1/4] Add profile:v setting to encoding options. --- lib/ffmpeg/encoding_options.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ffmpeg/encoding_options.rb b/lib/ffmpeg/encoding_options.rb index 4bbf2369..82a05f29 100644 --- a/lib/ffmpeg/encoding_options.rb +++ b/lib/ffmpeg/encoding_options.rb @@ -172,6 +172,10 @@ def convert_watermark(value) ["-i", value] end + def profile(value) + ["-profile:v", value] + end + def convert_watermark_filter(value) position = value[:position] padding_x = value[:padding_x] || 10 From a11197d97c0c315e723f6cfc4ea0fab10828b749 Mon Sep 17 00:00:00 2001 From: Mishaux Date: Sat, 18 Mar 2017 17:48:50 -0600 Subject: [PATCH 2/4] change name of profile option in encoding_options.rb --- lib/ffmpeg/encoding_options.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ffmpeg/encoding_options.rb b/lib/ffmpeg/encoding_options.rb index 82a05f29..cda516a4 100644 --- a/lib/ffmpeg/encoding_options.rb +++ b/lib/ffmpeg/encoding_options.rb @@ -172,10 +172,10 @@ def convert_watermark(value) ["-i", value] end - def profile(value) + def convert_profile(value) ["-profile:v", value] end - + def convert_watermark_filter(value) position = value[:position] padding_x = value[:padding_x] || 10 From acf0c67c448933d2ec10250a321ea669a2cb0ba5 Mon Sep 17 00:00:00 2001 From: Mishaux Date: Sat, 18 Mar 2017 19:20:14 -0600 Subject: [PATCH 3/4] Add pix_fmt option to encoding_options --- lib/ffmpeg/encoding_options.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ffmpeg/encoding_options.rb b/lib/ffmpeg/encoding_options.rb index cda516a4..87ec51c3 100644 --- a/lib/ffmpeg/encoding_options.rb +++ b/lib/ffmpeg/encoding_options.rb @@ -176,6 +176,10 @@ 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 From 932acbe923a4147688843a13eda7c9448b61a235 Mon Sep 17 00:00:00 2001 From: Mishaux Date: Sat, 18 Mar 2017 19:34:29 -0600 Subject: [PATCH 4/4] Add specs --- lib/ffmpeg/encoding_options.rb | 6 +++--- spec/ffmpeg/encoding_options_spec.rb | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/ffmpeg/encoding_options.rb b/lib/ffmpeg/encoding_options.rb index 87ec51c3..247331b9 100644 --- a/lib/ffmpeg/encoding_options.rb +++ b/lib/ffmpeg/encoding_options.rb @@ -176,9 +176,9 @@ def convert_profile(value) ["-profile:v", value] end -# def convert_pix_fmt(value) -# ["-pix_fmt", value] -# end + def convert_pix_fmt(value) + ["-pix_fmt", value] + end def convert_watermark_filter(value) position = value[:position] 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