Welcome Guest, Not a member yet? Register   Sign In
clip an uploaded song?

[eluser]newbie boy[/eluser]
my upload function works perfectly...

but my problem is how to clip an uploaded song in a particular time duration...

hope you can help me again guys...



[eluser]newbie boy[/eluser]
is there a way to do it php?

like the file uploading class maybe?

No, not to my knowledge. PHP is not an MP3/media player - that's what ffmpeg is for. Smile You wouldn't use notepad to edit a DVD, would you?

[quote author="newbie boy" date="1247067409"]is there a way to do it php?

like the file uploading class maybe?[/quote]

But even in the file uploading class, it uses a graphics library (normally GD2) for image manipulation
So you would just use PHP as a wrapper for something such as ffmpeg like fuzzy suggested

@Fuzz: I might not use notepad for DVD editing, but Notepad++ makes it so easy Wink

[eluser]newbie boy[/eluser]
got ffmpeg now,

i found this code for cropping a mp3 file down to 30secs...

ffmpeg -t 30 -acodec copy -i inputfile.mp3 outputfile.mp3

i just don't know how am i incorporate it with php...

i hope there someone who could help...

thanks guys...

[eluser]Colin Williams[/eluser]
Never a bad time to brush up on your PHP functions...

exec('ffmpeg -t 30 -acodec copy -i inputfile.mp3 outputfile.mp3');

More info at http://us.php.net/exec

[eluser]newbie boy[/eluser]
Colin Williams,

like how am i gonna pass my mp3 file to that code?

[eluser]Colin Williams[/eluser]
That's what the "inputfile.mp3" part of the command is for.

Consider this after your upload

$info = $this->upload->data();
$input_file = $info['full_path'];
$output_file = $info['file_path'] .'sample_'. $info['orig_name'];
$result = exec("ffmpeg -t 30 -acodec copy -i $input_file $output_file");

[eluser]newbie boy[/eluser]
Colin Williams,

have done this before?

mine, doesn't save it into another filename...

it's blank...

maybe the code for this audio clipping in ffmpeg is not right or something?

Theme © iAndrew 2016 - Forum software by © MyBB