I'm using windows 7 and xampp in localhost.I want to convert mp3 audio into ogg audio by php script.I downloaded 'ffmpegConverter_v0.2' zip file where the folder structure is :
ffmpegConverter_v0.2
--consoleConversor
--consoleConversor
--consoleConversor.exe
--ffmpeg.dll
--consoleMonitor
--consoleMonitor
--consoleMonitor.exe
--ffmpeg.dll
--Queue.xml
--serviceConversor
--ffmpeg.dll
--serviceConversor
--serviceConversor.exe
--serviceMonitor
--ffmpeg.dll
--Queue.xml
--serviceMonitor
--serviceMonitor.exe
--LEEME.txt
--README.txt
I keep the 'ffmpegConverter_v0.2' folder,mp.php and 'a.mp3' in same folder and used the following code in mp.php:
<?php
exec("ffmpegConverter_v0.2\serviceConversor\serviceConversor.exe -i a.mp3 -acodec libvorbis ap.ogg");
?>
then got the following error message :
what wrong did I do ? whats the exact way to install ffmpeg ? whats the exact way to write the command in php script for that and how can that be used in online server ? is there any other better converter else ?
-Thanks.
EDIT:
when I used the following line
<?php
exec("ffmpegConverter_v0.2\consoleConversor\consoleConversor.exe -i a.mp3 -acodec libvorbis ap.ogg");
?>
then I got this message
I also tried this :
<?php
exec("c:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe serviceConversor.exe");
exec("ffmpegConverter_v0.2\serviceConversor\serviceConversor.exe -i a.mp3 -vcodec libtheora -acodec libvorbis ap.ogg");
?>
then got the same message like the first picture.
This free software also allows users to convert, stream and play most types of multimedia files. To convert MP3 to OGG Vorbis using VLC follow these 3 easy steps. Step 1: Launch VLC and navigate to Media > Convert/Save. Step 2: Add your MP3 file and then click on the Convert/Save button.
You can convert any audio file supported to Audacity to 3 files types: MP3, WAV, and Ogg Vorbis. From Audacity, click "Project" > Select "Import Audio." Navigate to the file you want to convert > Click [Open].
Our MP3 to OGG Converter is free and works on any web browser. We guarantee file security and privacy. Files are protected with 256-bit SSL encryption and automatically deleted after 2 hours. What is an MP3 (MPEG-1 Audio Layer III or MPEG-2 Audio Layer III) file?
The used codecs supports variable bit rates (as a default), and .ogg files usually play back easily on all platforms. All things being equal, the sound quality exceeds that of mp3 somewhat. Select files from Computer, Google Drive, Dropbox, URL or by dragging it on the page.
What is an OGG (Ogg Vorbis) file? Ogg Vorbis (OGG) is a file that uses Ogg Vorbis compression. OGG is a patent-free, royalty-free encoding scheme provided by the Xiph.Org Foundation. Like MP3, OGG files are renowned for their high quality. OGG files include metadata, as well as artist and track title information.
MP3 files are the most widely-used audio file for consumers. Due to small size and acceptable quality, MP3 files are accessible to a wide audience, as well as easy to store and share. How to open an MP3 file? Because MP3 files are so prevalent, most major audio playback programs support them.
Forget about that serviceConversor
thing.
Get an FFmpeg build for Windows (a static build that matches your architecture should be a good start to avoid other DLL/etc. problems).
Then use exec
:
<?php
$retCode = exec('C:\\path\\to\\ffmpeg.exe -y -i file.mp3 -acodec libvorbis file.ogg');
?>
Don't forget to escape the backslashes (\\
); you didn't in your question.
exec
will return the return code of FFmpeg (I put it in $retCode
here), which is 0 for a success.
As some noted, you can add the -aq
option to set the OGG output quality for a VBR transcoding.
libvorbis is built in the static FFmpeg version; I just checked using ffmpeg.exe -codecs
:
DEA.L. vorbis Vorbis (decoders: vorbis libvorbis )
where DE means decoding and encoding are supported for this codec.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With