R
R
rusrich2018-09-29 01:37:05
Ruby on Rails
rusrich, 2018-09-29 01:37:05

How to call the FFMPEG system command in Ruby on rails?

Good evening.
Tell me how to call the ffmpeg system command?
Found this example but it doesn't work for me

def convert_in_flv
  flv = File.join(File.dirname(source.path), "#{id}.flv")
  system("ffmpeg -i #{source.path} -ar 22050 -ab 32 -s 480x360 -vcodec flv -r 25 -qscale 8 -f flv -y #{flv}")
end

Source

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Mirilaczvili, 2018-09-29
@2ord

Provided that ffmpeg is present and the parameters in the keys are correctly set, the command should be executed. After system, you can check the exit code of the process with $?.exitstatus.
I advise you to debug the code.

R
rusrich, 2018-09-29
@rusrich

Installed the gem https://rubygems.org/gems/ffmpeg
Fixed the line with system("ffmpeg -i #{@file.path} -s 640x360 encode.mp4")
and it worked. The truth puts the file in the root.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question