0

If I loop through a mysql query and run a popen on each row, it appears that the commands are only running 1 at a time. Is there some sort of "queue" i can access and force to process 3 or 4 at a time, or do i just have to wait? this is for ffmpeg and at this rate it will take days to complete all these commands one by one...

    foreach($videos as $video){
            popen('ffmpeg -i ........','r');
    }
b747fp
  • 175
  • 3
  • 12
  • Dunno if it's so, but my intuition says that if you run 4 processing-heavy commands at the same time it'll just take each 4 times as long to complete, unless the OS somehow throttles a single task to not use 100% of the processor. – JJJ Nov 30 '13 at 09:53
  • this server has plenty of more processing power/threads to run additional commands simultaneously – b747fp Nov 30 '13 at 09:55
  • You might want to take a look here: http://stackoverflow.com/questions/209774/does-php-have-threading Scroll through the answers, I see a few of them that could help you (third or fourth answer). – cen Nov 30 '13 at 09:56
  • my issue is, ive already run popen for the 12,000 videos and they are all queued up and 1500 of them have processed 1 at a time already (5 hours later)... i was wondering if i could just somehow get what's left in the queue to run quicker... i guess i'll just wait it out. – b747fp Nov 30 '13 at 10:01

0 Answers0