Created
August 2, 2011 23:35
-
-
Save dannykopping/1121508 to your computer and use it in GitHub Desktop.
Merge audio and video FLV scripts with PHP and FFMPEG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $streamsPath = realpath("/usr/share/red5/webapps/vod/streams"); | |
| $videoFile = "$streamsPath/356a192b7913b04c54574d18c28d46e6395428ab-1312327917237_Video.flv"; | |
| $audioFile = "$streamsPath/356a192b7913b04c54574d18c28d46e6395428ab-1312327917237_Audio.flv"; | |
| // convert audio FLV to mp3 | |
| $targetAudio = dirname(realpath($audioFile))."/audio.mp3"; | |
| system("ffmpeg -y -i $audioFile -ac 2 -ab 128kb $targetAudio"); | |
| if(!realpath($targetAudio)) | |
| throw new Exception("Audio conversion failed"); | |
| $basename = basename($videoFile); | |
| $filename = substr($basename, 0, strrpos($basename, "_Video.")); | |
| $targetVideo = dirname(realpath($videoFile))."/$filename.flv"; | |
| system("ffmpeg -itsoffset 00:00:0.75 -i $videoFile -itsoffset 00:00:0 -i $targetAudio -acodec copy -vcodec copy $targetVideo"); | |
| if(!realpath($targetVideo)) | |
| throw new Exception("Merge process failed"); | |
| ?> |
I used same code in localhost, It is done well. But i upload on my shared server it is not working.....
You have asked this question everywhere, here's your answer.
You do not have it installed on your shared server, you need to contact the support for your shared server or upgrade to a virtual server. You cannot execute FFMPEG if it isn't installed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I used same code in localhost, It is done well. But i upload on my shared server it is not working.....