Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract audio from video with Ruby

Is there a way to extract audio from a video file with Ruby? I'm looking to get audio from our sermon videos when posting them online.

like image 268
jmcharnes Avatar asked Sep 05 '25 03:09

jmcharnes


1 Answers

There isn't anything built into Ruby, but you can use ffmpeg to strip the audio from the video. Check out the gem https://github.com/streamio/streamio-ffmpeg. This will also require you to have ffmpeg and any dependencies installed on your production machine. You may want to consider moving this into a background process (delayed_job) or putting a progressbar so the user doesn't wonder why it is just churning but not displaying results immediately. You can use something like polling or some type of notification to let the user know once the audio file is ready for streaming/downloading.

like image 182
kobaltz Avatar answered Sep 07 '25 21:09

kobaltz