开发者

Using ffmpeg server side to convert multiple files on the fly

开发者 https://www.devze.com 2023-02-22 17:23 出处:网络
I am in开发者_如何学运维 the process of creating a site which enables users to upload audio. I just figured our how to use ffmpeg with PHP to convert audio files (from WAV to MP3) on the fly.

I am in开发者_如何学运维 the process of creating a site which enables users to upload audio. I just figured our how to use ffmpeg with PHP to convert audio files (from WAV to MP3) on the fly.

I don't have any real experience with ffmpeg and I wanted to know what's the best way to convert the files. I'm not going to convert them upon page load, I will put the conversions in a queue and process them separately.

I have queries about how best to process the queue. What is a suitable interval to convert these files without overloading the server? Should I process files simultaneously or one by one? How many files should I convert at each interval to allow the server to function efficiently?

Server specs

  • Core i3 2.93GHz
  • 4GB RAM
  • CentOS 64-bit

I know these questions are very vague but if anyone has any experience with a similar concept, I would really love to hear what works for them and what common problems I could face in the road ahead.

Really appreciate all the help!


I suggest you use a work queue like beanstalkd. When there is a new file to convert simply place a message into the queue (the filename maybe). A daemon that works as beanstalkd client fetches the message and converts the audio file properly (the daemon can be written in any language that has a beanstalkd library).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号