I developed a system that contains many MP3 files that users can listen to them online/stream, since most of my users are Iranians and Iran internet speed is sucks, I came up with an idea, but I can’t find the right/best way to do that.
I have alots of different berates: 128kps, 192kps, 320kps, etc… I would like to know what’s the best way to remotely convert these files to 32/64kps qualitie, and of course, temporarily.
I mean, after the new file 32kbps generated. After period of time the generated file automatically delete.
I did lots of search before I ask this question, but none of the results answered my question.
BTW, I find the LAME library.
Is there a way to do that with pure PHP?
Is there a way to do that with pure PHP?
Nope. Not at all. PHP is a server-side scripting language that depends on add-ons & external functions. That said, there is a SWFMovie::streamMP3 function, but as the page says, “This function is EXPERIMENTAL.”
You are much better off learning about MP3 streaming software like Mopidity which is a Python-based music server. Might also look into Andromeda which appears to be PHP-based. And such. Reinventing the wheel will not be fun at all. You are better off researching how to use Open Source MP3 streaming software as best as possible & adapt it for your needs.
Related
Is there any possibility that I can get the beat rate (beats per minute or beats per second) of an audio file placed on my server, through PHP.
The main scenario is I have some audio file(mp3, wav etc) in some location on my server and I've to categorize them according to their beat rate.
I got this:
http://pear.php.net/reference/MP3_IDv2-0.1.4/__filesource/fsource_MP3_IDv2__MP3_IDv2-0.1.4IDv2FrameTBPM.php.html
Can anyone please explaing how to use the function getBPM()
I wrote a simple php class for BPM detection in audio files. It uses soundtouch and ffmpeg to get the BPM. You can get it here - php-bpm-detect
You could try calling the SoundTouch audio processing library from php after installing it on the server.
The FAQ states that it can detect BPM. I do not know if it can handle mp3 files, but then you could use ffmpeg to convert them to wav and then run the bpm detection.
Please Check the link for more info.
SoundStretch audio processing utility
Beat rate (BPM) can be calculated in many ways. First of all you need to find how to detect beats which are nothing but local peaks of sound energy. Supposing you want to analyse WAV file it would be best to search whole file sample-by-sample and find high differences between consecutive samples. How big differences? It is hard to tell, you will have to try with different values (different detection threshold). MP3 detection is harder because it is also compressed.
Here are some other ideas:
How to detect the BPM of a song in php
BTW: Are you sure you want to use PHP for BPM detection? If you have server you can probably use also other langages, like C/C++ launched as cgi script. It would be much more memory- and cpu-effective.
Good luck with your project!
EDIT: Try to use Google to find different projects, but covering the same topic (wav analysis), e.x. http://www.ixwebhosting.mobi/2011/09/20/3445.html - project that draws oscillogram from WAV file and saves it to PNG. If it draws waveform you are one step ahead-now you have to implement algorithm to not draw sample values but analyse them to find beats.
I am (still) attempting to upload large files <200mb via a html form using php.
During my research into this I have come across the term "chunking", I understand that this process can break the file into handy sizes such as 5mb and reassemble them into the full file at the server side.
My problem seems to be where I can begin? I seem unable to find the correct resources by googling (Or perhaps I'm suffering from not knowing which terms to search for).
So what I'm hoping for today is a chance to educate myself with the basics, a direction in which to look would be very helpful. I don't really want to download a plug-in or anything like that, I would prefer to learn by experimentation.
EDIT to add: Although the two answers below would appear to be correct, this takes me into the realm of stuff that I can't do as a designer...If anyone reading this can suggest a different approach I would appreciate it.
Web browsers do not split uploads into chunks. For this you'll have to use your own "chunking" client: a Flash program or a Java applet.
You can take a look at JUpload. There are also examples in the wiki.
From SourceForge :
Multiple File Upload Applet (JUpload) takes care of the limitation posed by traditional HTML upload forms by allowing you to upload a whole directory and the files within it with a single click. Optionally, it allows simple picture management.
I am looking to generate transport maps in a style similar to the iconic London underground [tube] map.
These maps will change from time to time and many will be required so instead of drawing them up manually in inkscape [or similar] I am hoping to have them generated dynamically from a db or dataset.
Does anyone know if there is any library apis etc. out there that would help with this task, or any suggestions in general of how [or how not] to go about this ?
I am thinking svg's would be the best way to go with this, plus there may be need for basic interactivity down the line.
I am working in php so otherwise it's GDlib, ImageMagick ?
Thanks in advance.
.k
Well, the answer really isnt in how to use GD or ImageMagick, there are manuals for that. As for helper libraries, most libraries focus on graphing, anything else you will have to write yourself. Your best bet as a solution would be to have your admin interface generate the images when data in the backend changes and cache the images, since there's no reason to build the image every time someone accesses it.
For generating maps, i think your best bet would be defining stations with one or many 'lines' which determine some sort of indicator of relationship to the stations around, and an x,y. You'd probably only need to determine a 'parent' station since you're just drawing lines from a-b. That way you can position them in the same manner as they're typically rendered on the actual trains, use the lines and surrounding stations to draw mappings.
Doesn't sound like too difficult a problem. 3 tables:
stations [stationid,name,x,y,meta1,meta2],
placements [placementid,stationid,lineid,parentstationid],
lines [lineid,name,meta1,meta2,colour,etc].
SVG would be pretty good at this sort of thing, and you would avoid the whole image building and caching process, but be wary of browser support issues.
Sounds like a pretty interesting project though, good luck :)
One strategy I use when I need to generate graphs from data in a db is to extract the data in some kind of XML way (e.g. Oracle SQLX or Cocoon XSP/ESQL or eXist-db XQuery) and process it through an XSLT to generate SVG. Good old Cocoon is fine for this kind of job if you don't want to write any code (except the XSL of course ;-).
The SVG itself can be loaded in some graphic tools to reprocess.
These maps will change from time to
time and many will be required so
instead of drawing them up manually in
inkscape [or similar] I am hoping to
have them generated dynamically from a
db or dataset.
If I were in your shoes, the very first thing I'd do is try to prove that the Google Maps API won't work for your application. Then, maybe, prove that ArcGIS won't work. (Even if they don't work, they're widely used, and you get to add lines to your CV.)
is thier a guideline of how i can deal with playing around with audios and recording webcams, and what file formats i should use for optimisation, and plus any poplaur modules, plugins and classes that i can use to prevent re-inventing the wheel. im really looking at using this kind of stuff for user generated content. basically im looking for good advice, on how i should deal with kind of stuff? thanks :)) sorry for the broad question?
Take a look at red5. It's a flash streaming server which can record and play back webcam streams. There are also commercial alternatives such as Wowza Media Server and Adobe Flash Media Server. All of these are flash based though. I don't know of any HTML5 based approaches.
I want to make a video site in which we can upload the video in any format and display it like youtube. How can I do this? My whole site is in PHP I'm a newbie in the video streaming sp plz be descriptive with your answer
Thanks
First you need a VideoPlayer written in Flash / Actionscript, there are also a lot of free ones arround in the internet, e.g.: FlowPlayer, You also could write you own. You acctually do not net to buy Flash for this. The Flash/Flex compiler mxmlc is available for free. You could also write you Flashvideoplayer in Haxe (also free).
You you do not want the users to switch within the video you could deliver the videos via HTTP, other wise you need an streaming server like: FlashMediaServer (not free). There are also open source alternatives like Red5 or haxeVideo.
You you do not have the video available in the right format you need to encode them: the best tool for this task could be ffmpeg
I suggest looking at the html5 <video> tag, this is probably the simplest way. For an example look at the the one from surfin' safari.
Be aware that some browsers support ogg and others h264, but not both.
Encoding of the video can be made using ffmpeg on the server.
One of my websites does this, and it's a MASSIVE pain.
However, there are websites out there that'll take a video and convert it to an FLV for you (for a price), for example we use a service called Hey!Watch which is reasonably reliable.
If you really want to encode it to flash yourself, you're going to need a full copy of Flash and a LOT of time =]
There is this highly underrated post with 3 great links for open source solutions that are like youtube and fits perfectly your question (and at least another one):
http://www.vidiscript.co.uk/
http://www.phpmotion.com/
http://osshare.sourceforge.net/
I'm posting this here just to point out the links. I think 2 of those 3 questions should be marked as duped anyway.