Skip to content

Commit

Permalink
Pass dimensions correctly to ffmpeg
Browse files Browse the repository at this point in the history
ffmpeg man tells that they should be passed as "wxh".
Currently they are passed as "wxhxd" which produces a failure in FFmpeg 1.2
  • Loading branch information
abotalov committed May 27, 2014
1 parent c9c7601 commit e5a05cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/headless/video/video_recorder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize(display, dimensions, options = {})
CliUtil.ensure_application_exists!('ffmpeg', 'Ffmpeg not found on your system. Install it with sudo apt-get install ffmpeg')

@display = display
@dimensions = dimensions
@dimensions = dimensions[/.+(?=x)/]

@pid_file_path = options.fetch(:pid_file_path, "/tmp/.headless_ffmpeg_#{@display}.pid")
@tmp_file_path = options.fetch(:tmp_file_path, "/tmp/.headless_ffmpeg_#{@display}.mov")
Expand Down
4 changes: 2 additions & 2 deletions spec/video_recorder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
describe "#capture" do
it "starts ffmpeg" do
Headless::CliUtil.stub(:path_to).and_return('ffmpeg')
Headless::CliUtil.should_receive(:fork_process).with(/ffmpeg -y -r 30 -g 600 -s 1024x768x32 -f x11grab -i :99 -vcodec qtrle/, "/tmp/.headless_ffmpeg_99.pid", '/dev/null')
Headless::CliUtil.should_receive(:fork_process).with(/ffmpeg -y -r 30 -g 600 -s 1024x768 -f x11grab -i :99 -vcodec qtrle/, "/tmp/.headless_ffmpeg_99.pid", '/dev/null')

recorder = Headless::VideoRecorder.new(99, "1024x768x32")
recorder.start_capture
end

it "starts ffmpeg with specified codec" do
Headless::CliUtil.stub(:path_to).and_return('ffmpeg')
Headless::CliUtil.should_receive(:fork_process).with(/ffmpeg -y -r 30 -g 600 -s 1024x768x32 -f x11grab -i :99 -vcodec libvpx/, "/tmp/.headless_ffmpeg_99.pid", '/dev/null')
Headless::CliUtil.should_receive(:fork_process).with(/ffmpeg -y -r 30 -g 600 -s 1024x768 -f x11grab -i :99 -vcodec libvpx/, "/tmp/.headless_ffmpeg_99.pid", '/dev/null')

recorder = Headless::VideoRecorder.new(99, "1024x768x32", {:codec => 'libvpx'})
recorder.start_capture
Expand Down

0 comments on commit e5a05cb

Please sign in to comment.