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

[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...

thanks...
#2

[eluser]TheFuzzy0ne[/eluser]
http://stackoverflow.com/questions/43890...30-seconds
#3

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

like the file uploading class maybe?
#4

[eluser]TheFuzzy0ne[/eluser]
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?
#5

[eluser]Dam1an[/eluser]
[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
#6

[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...
#7

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

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

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

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

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

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

Consider this after your upload

Code:
$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");
#10

[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