开发者

Merge two flv files (contain audio) in PHP without external program

开发者 https://www.devze.com 2023-01-22 15:54 出处:网络
I need to merge two flv files, using PHP. I can\'t use exec method. I am wondering if is possible to cut some part of one flv file (audio tag) and paste to another and overwrite d开发者_Python百科urat

I need to merge two flv files, using PHP. I can't use exec method. I am wondering if is possible to cut some part of one flv file (audio tag) and paste to another and overwrite d开发者_Python百科uration for output file. I have found interesting solution here: calculate flv video file length ? using pure php but I do not know how can I get an audio tag from a flv file? How many audio tags a flv file has? Which tags should I overwrite in output file to be able to play audio from two merged files? I will be very gratefull for advices.

Many thanks, Piotr


I strongly recommend you to go to http://www.adobe.com/devnet/f4v.html and download the FLV/F4V specification made freely available by Adobe.

Using the techniques I described in my answer you linked at, you should be able to achieve your goal.

Be careful however when trying to join files with different codecs, since the resulting file has good chances to confuse the flash player, or even not playing at all past the junction point.

Otherwise, I don't really understand your goal.

If you plan to put a file's audio track into another file, I would really discourage you from doing it in PHP, but instead using video tools such as ffmpeg.

If you're stuck with PHP, you should probably read both files concurrently, synchronizing via each tag's timestamp, reading the first file's video, and the second file's audio, combining tags by temporal order into a third new file.

0

精彩评论

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