Jump to content

[SOLVED] Dynamic MP3 Compression Serverside?


scooter41

Recommended Posts

Hi There!

 

I have a client who is wishing to sell mp3 downloads on his website, currently selling 128k, but now wanting to do 384 as well for an additional cost.

 

I was trying to think of a good way to upload both, and thought perhaps use the same name but add 384 on the end of one of the file names and search for that on upload.

 

Then I thought, maybe there is some kind mp3 compression software that can be done dynamically using a php script? then they could only upload 1 file to sort out both formats ? is this possible?

 

Thanks for any help in advance.

 

Scott

installed lame, and via SSH the following command works great, however in php no output file is created and no error is given either?

 

lame -b 128 /var/...path name... /httpdocs/test.mp3 /var/...path name... /httpdocs/test2.mp3

 

 

<?php

 

$source = "/var/...path name... /httpdocs/test.mp3";

$target = "/var/...path name... /httpdocs/test2.mp3";

 

 

$encode_cmd = "l";

echo exec( $encode_cmd );

?>

must have been a copy/paste error, this is how it is:

 

 

<?php

 

$source = "/var/...path name... /httpdocs/test.mp3";

$target = "/var/...path name... /httpdocs/test2.mp3";

 

 

$encode_cmd = "lame -b 128 $source  $target ";

exec( $encode_cmd );

?>

 

ok I have found a more functional syntax:

 

$encode_cmd = "lame -b 128 $source  $target ";

$output = exec($encode_cmd . ' 2>&1', $output, $return);

echo $output;

 

This it least gives me an output:

 

running: sh: lame: command not found

 

I guess I need to specify the full path to lame perhaps!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.