Search code examples
phpffmpeguploadreal-timevideo-encoding

ffmpeg real-time encoding while file uploading by chunks


Now the process is:

  1. File upload
  2. Encode file with ffmpeg when file has been uploaded

Can be done at the same time?, obviusly yes, but I don't know how.

The file upload process is by 8MB chunks stored in server, then, temporary I have videofile.ext.tmp that is growing up to final uploaded file.

I read about ffmpeg -stream_loop or -loop parameters, but I don't know if the upload process is good for real-time encoding or how to manage it.

Any help will be appreciated.

EDITED: I tried this feature and works good when: Internet connection is faster than ffmpeg encode speed. When uploaded file is big enough.

I personally ruled out this procedure because the internet speed may change or cut out.


Solution

  • It depends on the file format. Some formats like ts,mkv,flv will work this way. Mp4 may or may not work depending on how the file was created.