This is an iphone ringtone converter using php. Its a simplest way of creating ( .m4r ) format audio which is the recommended type for IOS product tones.
This package uses ffmpeg and ffprobe libraries so make sure they are installed before you install it.
composer require mugenyi/m4rconverter
Provide the class with 2 values.
-
Path to the file to be converted.
-
Directory to save the converted file.
$converter = new M4rconverter\Converter('tracks/avril.mp3','converted'); $converter->convert();
M4rconverter allows you to easily configure the underlying FFmpeg and audio.
-
configure ffmpeg
$converter->setFFMpegConfiguration([ 'ffmpeg.binaries' => '/opt/local/ffmpeg/bin/ffmpeg', 'ffprobe.binaries' => '/opt/local/ffmpeg/bin/ffprobe', 'timeout' => 3600, // The timeout for the underlying process 'ffmpeg.threads' => 12, // The number of threads that FFMpeg should use ]);
-
configure audio
$converter->setAudioFormatConfiguration([ 'bitrate' => 256, //AudioKiloBitrate 'audioChannel' => 2, 'duration'=>30 //time in seconds for the output file 'seek'=>30 //time in seconds to seek ]);
M4rconverter is built on top of php-ffmpeg package. special thanks to the team behind the project.
itunemachine.com uses this package to make name ringtones