<?php
$wavfile=$_REQUEST['wav'];
$wav=file_get_contents($wavfile);
$descriptorspec = array(
0 => array( "pipe", "r" ),
1 => array( "pipe", "w" ),
2 => array( "file", "/dev/null", "w" )
);
$process = proc_open( "/usr/bin/lame - -", $descriptorspec, $pipes );
fwrite( $pipes[0], $wav );
fclose( $pipes[0] );
$mp3 = stream_get_contents( $pipes[1] );
fclose( $pipes[1] );
proc_close( $process );
header('Content-Type: audio/mpeg');
echo $mp3;
?>
Single php script to convert one wav file to mp3. This is based on Linux using lame utility. Permissions to www-data user must be set for executing lame and writing output file at destination path.
2 Responses
Warning: proc_open(/dev/null): failed to open stream:
Write a comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.