Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3956360
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:21:11+00:00 2026-05-20T02:21:11+00:00

When I do system ffmpeg -i just-do-it.mp4 -ab 96k -ar 22050 -qscale 6 output.flv

  • 0

When I do system "ffmpeg -i just-do-it.mp4 -ab 96k -ar 22050 -qscale 6 output.flv" ffmpeg takes over the ruby process till the job is done, which sometimes take a long time. I’ve tried using threads amd fork in Ruby to no avail, also system equivalent commands like exec %x[] I also tried the latest Fibers in ruby 1.9.2, but I don’t think I’m using it properly.

My question is how to run two ffmpeg processes from ruby concurrently?

EDIT:

fork do
  fork do
    system "ffmpeg -i you-know.mp4 -ab 96k -ar 22050 -qscale 6 #{Time.now.sec}.flv"
  end                            

  fork do
    system "ffmpeg -i bangbang.mp4 -ab 96k -ar 22050 -qscale 6 #{Time.now.sec}.flv"
  end
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T02:21:11+00:00Added an answer on May 20, 2026 at 2:21 am

    fork/exec is the right solution. Since forked processes inherit the parent processes fopen file handles/etc., you’ll have to close (or redirect) the file handles you don’t want children processes to use.

    For example:

    # this will print nothing, but yes is running as a forked process
    # you'll want to `killall yes` after running this script.
    fork do
      [$stdout, $stderr].each { |fh| fh.reopen File.open("/dev/null", "w") }
      exec "yes"
    end
    

    Ok, some comments on the code you posted. The outer fork is pointless. Just fork the two ffmpeg process from the main process. Maybe write a helper function like:

    def ffmpeg(mp4)
      fork do
        [$stdout, $stderr].each { ... }
        exec "ffmpeg -i #{mp4} ..."
      end
    end
    
    ffmpeg("you-know.mp4")
    ffmpeg("bangbang.mp4")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I see that I can start processes with System.Diagnostics.Process. I'm trying with the following
System.Diagnostics.Process p = new System.Diagnostics.Process(); p.EnableRaisingEvents = false; p.StartInfo.FileName = calc; p.Start(); for exp.
I'm writing a python script called flac2m4a which calls ffmpeg to convert a .flac
Decoded audio using FFmpeg (function avcodec_decode_audio3) and try to reproduce it through Audiotrack in
System.out.println(Please enter the required word :); Scanner scan = new Scanner(System.in); String word =
System.out.println(Please enter the required word :); Scanner scan2 = new Scanner(System.in); String word2 =
We're trying to build a php based video sharing site that allows users to
I was search for a video platform which I can use as a web-service
I have simple console application project for live video streaming using cross-platform libs on
I'm currently the lead dev (read only dev!) on a website for our youth

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.