Just started using PHPVideoToolkit and I'm looking to take an MP3 and convert it to a video. I want to have a single image as the video with the audio playing.
On the Google Code page https://code.google.com/p/phpvideotoolkit/ it says it can assemble a video stream from a set of separate video images so I know it's possible but I cannot figure out how from the GitHub documentation.
The documentation found in the documentation directory of the repository appear to be empty.
Help is much appreciated
You can use ffmpeg
Turning Images into Video
ffmpeg -f image2 -i image%d.jpg video.mpg
This command will transform all the images from the current directory (named image1.jpg, image2.jpg) to a video file named video.mpg.
Playing music in the video
ffmpeg -i song.wav -i video.avi video_finale.mpg
This command will add a song.wav in video.avi and give a final video_final.mpg
Related
I have an array of images src.
$src = array("folder1/imagejsbs124.jpg","folder2/image45125hsja.jpg", ");
I want to convert those images into a video.mp4 creating a animated slideshow.
I searched stackoverflow but it didn't work for me. Therefore I asked this personally and hope someone will find an answer.
Try out as given here Create a video slideshow from images.
Simple example to generate a video from some images using ffmpeg can be
ffmpeg -f image2 -i image%d.jpg video.mpg
This will bascically use all images from the current directory (named image1.jpg, image2.jpg .... imagen.jpg) to generate a video named video.mpg.
Using php you can also checkout for FFmpeg-php which i basically a php extension for ffmpeg.
if files are in different directory then use Concatenate:
Create a file concat.txt and then use it as input
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
ffmpeg -f concat -i concat.txt video.mpg
I host a site on a Linux server that I built with php where I am able to upload audio files in one section and video files to another.
Each section uses php to upload a single audio file and a single video file. Each upload is assigned a unique filename so they can be viewed separately on an individual page where the uploader can post comments about their audio or video.
I want to be able to allow musicians and performers in the local area display their work. The site works, but large video files do not upload and my audio player only plays a few formats, and I like to convert them all to mp3's.
I installed ffmpeg on my linux server to help me with this and am able to connect to it with my terminal. My question is how do I get ffmpeg to interface with my uploaded php files.
For example, as the user uploads an audio file, can I have ffmpeg convert it while it's uploading, or do I need to set up a temporary folder for uploads, store it there, then have ffmpeg compress the file, convert it to a specific format and save it in another folder?
I would prefer to have it compress and change the format while it's uploading so as not to use server space, but if this is not the way ffmpeg works, then I don't have a choice. Any help would be appreciated.
It is NOT possible to transcode while uploading. But, it is possible to transcode all your videos to mp4 files and all your audio files to mp3 files using ffmpeg command which you can call from your PHP code using exec statements.
H264 BP is the video codec which is almost universal and supports most of the platforms devices, browsers, players etc. AAC is the best audio codec to use for online streaming.
So, convert all your videos with following exec statementin PHP.
exec("ffmpeg -i INPUT.avi -r 25 -b:v 1M -pass 1 -c:v libx264 -profile:v baseline -c:a aac -strict experimental -b:a 192k OUTPUT.mp4");
And convert all your audios with following exec statement in PHP.
exec("ffmpeg -i INPUT.wav -c:a aac -strict experimental -b:a 192k OUTPUT.mp3");
I once had the opportunity to work on such task around 4 years back. I still remember how I did this.
I installed ffmpeg and it should work using commands as well on shell. I used exec library of php to execute ffmpeg commands which converted video files into desired format i.e mp4. You better check out exec and learn ffmpeg command to convert file into desired format. Hope it helps
in my Webapplication the user should be able to upload his own videos (either format).
I am using ffmpeg to encode the video to .mp4 and .flv using the command:
ffmpeg -i uservid.whatever output.mp4 output.flv
while ffmpeg encodes the video, it's loaded in the flowplayer on the users-page. But flowplayer always says "file not found" cause ffmpeg is not yet finish with encoding.
Is there a possibility to load the video in a certain player even if it is not yet completly encoded? maybe there is a ffmpeg option?
Thanks
FLV yes, mp4 no. with flv you can have ffmpeg write to stdout and do whatever you need to with the output. mp4 requires a frame index (moov) that is not known until the entire file is encoded. flv encodes the information in every frame.
I am using fileuploader.js to upload a video file. Now i want to convert the video format to .mp4. I have used ffmpeg and php to convert the video to .mp4 after upload. The sample segment i used is
$converted = "uploads/".$uniqid.".mp4"; //$uniqid is the id for the video after upload
$cmd = "$ffmpeg -i $sourceUrl -f mp4 $converted"; //$sourceUrl is the path of the video
I have tried to convert .flv video file to .mp4 format and it does but the problem is i cannot see the video only hear the sound after converting. Is the conversion line used in $cmd incorrect. Please help.
Just ffmpeg -i source.flv output.mp4 should be enough, it will use default codecs for mp4. Can you paste the ffmpeg response to the above command?
I have an upload functionality on my site. And i want the php script to take out a random frame from the uploaded video, and save it as an image. Is that possible?please guide me how can i get first capture image in video upload in php
Thanks for Advance.
You need ffmpeg installed on your server.
With that, use the exec() function:
exec('ffmpeg -i /path/to/your/video.avi -f image2 -vframes 1 /path/to/thumbnail.jpg');
Take a look at the Flowplayer Tutorial or the ffmpeg documentation for more options