Does PHP have voice conversion library for 3gpp to mp4 - php

I need to convert an upload voice file from 3gpp format to mp4 format in PHP server code.
I googled but there seems no conversion library for this purpose. Can I do that in PHP and is there exist any library for it?
Thanks

AFAIK php don't have any library for this purposes, but you can always use ffmpeg for conversions:
ffmpeg -i test.3gp -sameq -ab 64k -ar 44100 test.mp4
Someone asked about how to convert 3gp to mp4 in the official forums, so you can take a look: http://ffmpeg-users.933282.n4.nabble.com/3gp-to-mp4-td942632.html (the example has been taken from there)

Related

How to convert a web form uploaded mp3 to wav using PHP and ffmpeg?

I have a form where the admin can upload an mp3. Is it possible to use ffmpeg from PHP to convert that mp3 to wav when I process the form submission?
Second google result: ffmpeg -i foo.mp3 -acodec pcm_s16le bar.wav. Wrap that with a shell_exec.

Parsing Thumbcache in PHP

I always wondered if it was possible to parse the thumbs db files located in Windows 7 in:
C:\Users\%userdata%\AppData\Local\Microsoft\Windows\Explorer
In Windows XP they used to be located in each folder, but I assume I would have to traverse these to find the directory I want, etc. I'm aware there are ways to generate thumbnails using ffmpeg and such, but want to find a way in PHP to parse that db file since Windows has already generated thumbs for me. It's not in plain text (which I was hoping for).
you could use a parser like vinetto via php's exec
I gave up trying to do parse these out and instead used ffmpeg to generate thumbs like this. The system call takes the 10th frame of the all the mp4 videos in my recordings folder and saves it as a 320x240 image and as the filename.jpg. I had a bunch of videos so I had to increase the max execution time of PHP to handle it.
foreach (glob("F:\\Recordings\\*.mp4") as $filename) {
$path = pathinfo($filename);
system("c:\\ffmpeg\\bin\\ffmpeg.exe -itsoffset -10 -i \"$filename\" -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 \"".$path['filename'].".jpg\"");
}

Create Video File using PHP

I have scenario for creating a video files using diff. assets like images, audio file.
What I want to do is, Find audio files from the particular folder and set it as background music, and fetch images from particular folder and show those images one by one.
So basically I have images and audio files and I want create a video file using those assets using PHP.
Can any one please suggest the start up point for this? Have done image capture from video and converting the video using Ffmpeg so I have think of Ffmpeg but, I think it will not allow to create a video.
ffmpeg will allow you to create videos from still images.
For example, to create a video with a 10fps frame rate, from images 001.jpg .... 999.jpg:
ffmpeg -r 10 -b 1800 -i %03d.jpg test1800.mp4
You can mux streams (audio and video) like (add relevant codec options for bitrate, etc)
ffmpeg -i video.mp4 -i audio.wav -map 1.1 -map 2.1 output.mp4
I'm not going to go into more detail, as ffmpeg is a pain (args change in incompatible ways between versions, and depending on how it was compiled), and finding a rate/compression/resolution setting that is good for you is trial-and-error.
Under Ubuntu you need PHP5, ffmpeg and access to ffmpeg binary, this can be easy achieved with:
apt-get install php5 ffmpeg
I'm using this php function to generate an mp4 video from one gif image and one mp3 file, both source image and output video files are 720x576 pixels:
function mix_video($audio_file, $img_file, $video_file) {
$mix = "ffmpeg -loop_input -i " . $img_file . " -i " . $audio_file . " -vcodec mpeg4 -s 720x576 -b 10k -r 1 -acodec copy -shortest " . $video_file;
exec($mix);
}
example use:
$audio_file = "/path/to/mp3-file";
$img_file = "/path/to/img-file";
$video_file = "/path/to/video-file";
mix_video($audio_file, $img_file, $video_file);
Phil's solution is the correct approach. Work out what needs to be done by documenting yourself on ffmpeg (it's messy, and I can't blame him for not wanting to do your homework), and then call it from within php.
Cursory googling reveals php wrappers (e.g. http://ffmpeg-php.sourceforge.net/). If none are recent/complete enough, stick to issuing the needed shell commands from php.
ImageMagick convert -delay 100 -quality 75 photo1.jpg photo2.jpg movie.mpg
Or
http://dvd-slideshow.sourceforge.net/wiki/Main_Page

mp3 to flv on the server side how to?

I googled it for a long time, all I found was the ffmpeg php api, and a site called mp32tube .. now I was to have the exact same functionality of mp32tube I want to give my users the ability to upload an mp3 add a picture, then compile an FLV on the server that contains the picture and the mp3...
the rest I can do, like uploading the video to youtube, it's simple with their own API ..
can anyone please guide me to something that automatically does this on my server? (a centos powered VPS)
thank you very much.
Rami
You should read FAQ first.
http://www.ffmpeg.org/faq.html#SEC14
then to add sound you may try;
ffmpeg -ar 22050 -ab 128k -i song.mp3 -i videoHaveNoSound.flv VideoWithSound.flv
Let me know the result.
in addition:
you findout a shorter way;
ffmpeg -r 12 -b 1800 -i img.jpg -i yourSound.mp3 -acodec copy outVideo.flv
There is no "automatic" way to do this. You'll have to have the user upload the 2 pieces of data, then run them through ffmpeg. There is tons of documentation for ffmpeg out there, just research the command you'll need to run, test it outside of php first, then once you get it working, implement it in your script. After its gone through ffmpeg, delete the files used for creation, and let them download the resulting flv.

.mov file to .flv file conversion issue for ffmpeg using PHP

Is there any possible way to convert .mov file to .flv file conversion issue for ffmpeg using PHP. If yes, kindly let me know how to do?
Thanks in advance,
Fero
I agree with Kemo, though following the conventions of Stackoverflow, I'll offer the key bit provided by the link given:
ffmpeg -i <filename.mpg> -deinterlace -ar 44100 -r 25 -qmin 3 -qmax 6 <filename.flv>
I often transcode with ffmpeg and I don't ever bother to give all those flags, so you may find my typical use works well enough for you too:
ffmpeg -i inputFile.mov outputFile.flv
That's supposed to just change container formats and it tries to keep everything else as close as possible. I just did that and it seemed to work fine, though I'm uploading my flv somewhere it I'm having an issue, but that's probably totally unrelated to ffmpeg. Any tips?

Categories