Does anybody know a purely PHP based way to alter the frequency of an MP3 file?
I am on shared hosting with this, so installing ffmpeg or something similar is out of the question.
If this requires actually altering the audio data, then I guess it is not possible nor feasible to do with PHP, but I was thinking maybe this is just a header setting. I don't know.
Background:
A client's website is utilizing a Flash based MP3 player to play some audio.
The client is producing the audio herself.
The trouble is that the tools that she is producing it with, and is familiar with, automatically produces MP3 files with a frequency of 48000hz, while some versions of Flash have trouble playing anything with a frequency differing from 44100khz. (See my related question here).
I would like to avoid adding yet another program to the already complex audio production process, and solve this on the web server end if possible.
I was thinking maybe this is just a header setting.
No. That is, you can probably change it in the header, if you don't mind your MP3s being played too slow or too fast with a shifted pitch.
If you want it to sound the same, you will need to re-encode. Decoding to WAV (or raw samples), resampling, then re-encoding is a possibility, and probably your only one.
Maybe the way MP3 works allows for a shortcut (like JPEG allowing for lossless rotation), but I am unaware of any such methods.
Related
I am developing an API, in PHP, hosted on a linux server, that requires me to make jpeg previews for a .pptx powerpoint presentation.
I first convert the file to pdf and then convert the pdf to jpegs.
The second step is easy, with ghostscript, it's the first part that's proving difficult.
I have tried using the libreoffice executable, but pptx isn't completely compatible. Certain backgrounds become invisible.
I have the same problem with many 3rd party APIs (which I suspect also use libreoffice); the ones that do work, are ridiculously expensive.
Installing office on a Linux server and using COM functions seems impossible, or very tedious at best.
I have looked at Aspose.Slides, which also seems rather expensive, and their documentation is filled with errors.
I could use suggestions on how to tackle this problem.
I have tried to find the underlying problem of why LibreOffice and online conversion tools have a problem with the backgrounds of the presentations I need to convert.
The background is a .emf file, which has bad support.
My solution
I've unzipped the presentation, converted the .emf files to png (using ghostscript), changed all mentions of .emf to .png in the XML, and rezipped the altered presentation.
When I now use the LibreOffice headless to convert to pdf, the background shows up.
It might be a bit hacky, but it works for the intent of my program.
ps. I see that my question has gathered a few downvotes. In my opinion it was a valid question, and listed the various solutions that had worked for others, but not for me. If anyone has insights or ways to improve it, feel free to comment.
I'm looking for a tool to facilitate mulitple webpage file uploads from a single file browse dialogue. I know this has been asked previously, but I can't find anything current.
I'd like to check file size prior to upload, and I gather Flash is still the only way to do that cross-browser?
Ideally, I'd like an upload progress metre. I'll be using Linux and Apache servers, but don't have access to install add-ons such as PHP APC. Again, I assume something flash-based is the only option there?
I've looked at SWFUpload, but that appears to be another of these projects where the developers have become quite zealous and turned a simple concept into a full suite of tools for the masses. It seems quite cumbersome and I don't think I want to use it for my purpose.
I'd prefer not to have to write something from scratch for this. Could someone recommend me something or perhaps suggest a non-Flash alternative if there is one? I do need full cross-browser compatibility without too many layers of degradation, so anything HTML 5 probably isn't what I want.
Thanks
As I mentioned earlier today ( Multiple file upload (client side) )
I am a big fan of Plupload which can check file size, show progress bar, single dialog for multiple files, and supports things other than Flash if needed.
Is there any library/module available with which i can generate images from a swf file?
The problem i am trying to solve is: I want to create a pdf from a web page and i am having problems in doing that when the web page has swf (question in stackoverflow)
I am thinking if i am able to read a swf and write out an image, i will be able to solve the above the problem
Will appreciate your help, Thanks
In fact, that is quite a hard task. I've spent hours looking for a program that could fulfill such a task. However, I eventually only found one. It isn't open-source but would really help you I guess.
Flash Animation Source can output all frames of a SWF file. It uses a DirectShow filter to do so. Therefore, a Windows operating system is required should you not want to use WINE.
In short, you'll just need to install Flash Animation Source on your computer and then find a way to get DirectShow frames using your desired programming language. Everything else is actually quite easy. You tell Windows the directory and the name of your SWF file and it'll do the rest, thus delivering you with an image. And did you know DirectShow filters can deliver all frames of a video? Therefore, you can choose which one you'd like to have.
By the way, please don't try to find another way to get an image of your SWF file. Believe me, you won't find one. I have looked for an open-source program that fits my needs but all of them fail. You need to use the propriertary Adobe Flash player for your outputs. There is no other option as the open-source alternatives still need a lot of development to genuinely output the vector-based frame as it is.
Any tips or methods(encryption, plugins etc) to load flash files (i.e. swf) as quickly as possible at the client side ???
consider files size is between 5MB - 10MB....
make sure gzip/deflate and http caching are active during transport
If you can break up your files, you have the option to load a small file first and then bring in additional files as needed or at least once the initial interface is up. I no longer activly develop for flash, so this might be a bit outdated, but I always had the best results when I structured my desktop applications with the ultimate goal of easy portability to the web...
You mean, load them more quickly than a standard <embed>? Hardly, seeing as the file is so and so large, and that number of bytes needs to be transferred to the client in any case.
Make sure compression is enabled as stillstanding says. There's probably not much more you can do except work on the Flash files themselves, reducing the quality of embedded images, splitting it into several files, reducing embedded fonts, etc..
For years, I've been investigating how to create music streams from my computer. I've seen programs, but anything useful I've seen is Windows only (I use a Mac).
Eventually, I got interested in how streams work. Is there any way I could create my own stream, possibly using socket functions in PHP? Is there a PHP library for this?
Take a look at Ampache. It is a Web-based Open Source Audio file manager. It is implemented with MySQL, and PHP. It allows you to view, edit, and play your audio files via the web.
In the end it all boils down to the protocol you'd want to use. Shoutcast IMHO is plain HTTP, so to make your own stream, you just output the streams content.
To make an ogg based webradio work with my Sonos system, I have created a little transcoding wrapper around sox which is is actually written in PHP, so it may be helpful to you to serve as an example.
You'll find it here: http://www.gnegg.ch/ogg2mp3/
If you are after implementing your very own streaming protocol - maybe even UDP based, then, I'm afraid, PHP may not be the right solution for the problem - at least not as long as it has its share of problems when used for long running processes (which 5.3 may bring some help for with its integrated garbage collection)