libavcodec and php
I see here an c example of libavcodec ht开发者_Go百科tp://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/api-example_8c-source.html This is encoding/decoding audio and video (frame by frame). I intend to something like this but in php.
I want to convert a video in same time of uploading. Ex: User upload a 100mb video. When server receive first data, it convert and then wait for upload to go on, and so on.
Can someone help me ? Thank you
You can use php to send the data to stdin of ffmpeg. http://www.ffmpeg.org/faq.html#SEC17
However, your bigger issue is that php won't start executing until the upload is done (at least in typical setups). What you can do is basically implement a web server in php, using the socket functions you can listen on port 80.
Then you can read from the socket and write to the ffmpeg process.
These sections of the php manual may be helpful.
http://us.php.net/manual/en/function.proc-open.php
.../en/ref.sockets.php
Hope that helps.
精彩评论