Jump to content

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

You could install LAME on the server, and re-encode with that...

 

<?php
$source = "path/to/320k/file.mp3";
$target = "path/to/128k/file.mp3";
`lame -b 128 $source  $target` //I think that's how you set the bitrate with LAME
?>

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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.