Local video tanscoding platform - php

I was search for a video platform which I can use as a web-service and install locally on my local server to my PHP website.
I know we can run PHP shell commands but I need to implement a solid system with the Transcoder.
So, it should provide a API using REST or SOAP to convert videos, convert videos in efficient way. Create video thumbnails. If it a ruby or Python then it would be great and should be a free and open source one.
I could see those Software on Github, seems its good but having limitations. https://github.com/streamio/streamio-ffmpeg.
Is this a bad idea to use Perl or Python written application using with PHP? what are the available FOS software

Is this a bad idea to use Perl or Python written application using with PHP?
A bad idea? No. But it can be annoying sometimes.
If you really want to use a web service for this instead of just calling exec/proc_open like the rest of the world, you can go ahead and do that without too much concern.
Another option available to you is Gearman a distributed work queue/RPC service with bindings for many languages, including PHP, Python and Ruby. You can easily write a daemon in Ruby that uses that ffmpeg wrapper, and call methods directly from your PHP code. Thanks to how Gearman works, you can easily scale out the video encoding services by just adding more workers.

You can use FFMPEG binary for conversion/thumb extraction with command line like exec() in PHP

Related

Executing Actionscript on a linux server

I have a set of ~5 ActionScript 3 classes that are currently used within a flex 4 application. Although their output is used to display graphs etc in my flex app, the classes themselves have no visual components - they are only used to do complex math computations (I originally implemented them in AS3 in order to avoid constant server calls when computations were needed by the flex app).
However, I now want to make the same mathematical computation engine available on my linux server so the computations can be done within PHP. Is there any way at all to access the logic in these classes on the server? I would really like to avoid re-implementing the complex logic in PHP.
Thanks so much for any help you can give!
How many lines of code in your AS3 classes, and what kind of load do you need to handle?
If you're building anything for more than one-off use then the easiest route is probably porting your ActionScript to JavaScript. There aren't any automated converters that I know of but JavaScript and AS3 are so similar that unless your five classes have thousands of lines of code you should be able to make short work of it. Once you've ported it to JavaScript it'll be trivial to run in Node.js, directly through the VM of your choice, or even in the user's browser.
If you only need this to scratch and itch or for limited use you may be able to get away with running AS3 directly in Tamarin or redtamarin. However as far as I know neither of these are currently suitable for production use.
If you are using this in a high-availability, high traffic PHP app, however, I think you'll experience a lot less pain in the long run just porting your code to PHP. AS3 and PHP are similar enough in syntax that you could probably just do a straight port.
Finally, you can find some further discussion and links in this thread: Is it possible to create a 'command line' swf?
You can use redtamarin
http://code.google.com/p/redtamarin/
from a Linux server standpoint you will be able to run
your AS3 source code as CGI (either the AS3 script directly or compiled as ABC)
or you can also bundle your AS3 code into an exe that you will then call via PHP
or make your AS3 script as executable with binfmt_misc
http://code.google.com/p/redtamarin/wiki/RunningShellScripts#Registering_an_extension_as_non-native_binaries_(Linux_only)
here on production and development servers we use redtamarin
as scripts, to do our SVN hooks, automate tasks on linux servers etc.
as socket servers, http servers and CGI
as executable to reuse AS3 logic into our automated builds
etc.
look a bit in the documentation you will see you have a lot of options
to reuse your AS3 code: stdin/stdout/stderr, sockets, pipes, CGI, etc.

PHP: possible to compile a web-application into a windows application?

I have developed a PHP web application, but a client insists on a real Windows application, since he doesn't like running the software inside a browser.
Are there any solutions for this, any compilers to turn a web project into a Windows exe ?
I have looked at Phc-Win , but that seems more suited for small command line utils, not for entire web-applications...
UPDATE:
just found this myself, both look quite promising...
http://www.zzee.com/phpexe/
http://www.exeoutput.com/index.php
There's no tool for this, short of a simple wrapper app that embeds a browser inside an otherwise normal application window. Your PHP app would have to be completely re-written to include ALL of the overhead code necessary to build a GUI - basically all the 'display' stuff that a browser does automatically, would have to added to your app.
Well some of you did not google good enough:
http://www.appcelerator.com/products/titanium-cross-platform-application-development/
Supports most of the "web-languages" to write native Applications.
Tutorial Reference for Appcelerator: http://appceleratortitanium.com/tutorials/3-appcelerator-titanium-tutorial-beginners.html
Quote:
"Q: What languages can I use to make desktop apps?
A: Javascript, PHP, Python, Ruby, HTML, HTML5, and CSS."
Not exactly what you are looking for: http://www.roadsend.co/home/index.php?pageID=compiler
You may look into "HipHop" (made by Facebook): Converts PHP to compileable C++-
There's a tool for this. :-) I never used it but you can try this: Winbinder.
It is simple to compile your PHP source code into an executable. Facebook released a compiler for PHP in early-2010, called HipHop, which aims to create C++. You could then compile this code, for example using gcc, to machine-code.
The more difficult point for a complex Web-App like yours is the user interface. When compiling the way I described above, the application can be run from command line - this might work for simple tasks, but not, if your application returns HTML.
One possibility to solve this problem is PHP-GTK. PHP-GTK is a API for GTK (the graphical user interface used by Linux Ubuntu by default), written in PHP. Using this solution would have to read some documentation about this API, and you would need to rewrite some parts of your program, but it would probably be the most beautiful solution, because it would create a "native" experience.
Another possible solution could involve Adobe AIR, which lets your create programs for the desktop, using HTML, CSS and JavaScript, but I don't know if and how this would work together with your compiled PHP.
Please also note that it isn't absolutely necessary to compile your PHP for it to run on the client's computer; You could also ship the PHP-interperter right with your (uncompiled) PHP-script. Of course, compiling brings benefits, such as faster execution of the program.
-- André

port Matlab program to run on Apache server

I'm in the process of analyzing a large chunk of data in matlab. The data is userdata which is freely available and which I want to use to make recommendations for users using my Internet service.
My question is: once I've written my algorithm in matlab what is the easiest/best way to integrate it into my php project /website?
Thanks in advance
Well, it really depends on what you are using Matlab for. In many ways, doing the same matrix transforms in PHP or Python would be a pain. Hence you were using Matlab. You can however keep everything in Matlab form by using the Matlab Web Server.
Simply compile down to a binary that can be run on your server. See the examples supplied by Matworks.

How to use iText java PDF library with PHP?

Google search results suggested that it's possible via PHP/Java Bridge . This bridge requires Java Application Server. My host (bluehost) does not allow to run any Java Application Server. What are the alternatives in this case to make iText work? Switching a host is not viable option for me.
Thanks.
I know this is an old post, but for those still looking for an answer, may I suggest having Java do your work for you as a REST service using Jersey (JAX-RS), then just call the service from PHP. You can put your Java service on a host that does allow Java and you can call that service from PHP using cURL (or even file_get_contents if your host allows it and if you know what you're doing).
Loose coupling over RESTful services is allows you to have your Java service and your PHP app on separate hosts. Don't waste you time with a PHP/Java Bridge. It's perfectly sane to call a RESTful service with a Java back-end from PHP. This way, later if you decide, your would rather re-do the service in C# or something else, at least there will be 0 impact on the PHP app because you used a language neutral RESTful approach.
I have not had any performance issues using this approach myself, YMMV
(It's mostly a matter of design: It's usually better to "bolt" things together then "weld" them together.)
Also, Java with JAX-RS is very very simple (IMHO, but again .. YMMV)
There's always iTextSharp, a C# translation of iText. Will your host let you run C#?
It looks like you can call C# from PHP, as detailed here.
The ITEXT website specifically says JAVA and .NET, Wish they can also build the PHP or PERL version
I have used the Java Itext, Its superb!!
PDFtk is a command line tool installed on many Linux systems. It is a front end to the iText library. It may do what you need. You'd have to shell out to the command line to invoke it from PHP.

PHP complex uses - Interact with external devices

Is it possible to access & control external devices in PHP?
For example, would it be capable of changing the speed of a USB fan or change the direction of a wireless toy car.
I'm trying to go beyond web dev and I'm wondering if the programming language I use is capable of handling my ideas or should I consider changing the environment.
If these would be possible, I'd very much appreciate any pointers to reading materials or suggestions on other languages that might be more suitable.
Thanks!
On Linux it surely is possible by accessing /dev/ files. But it'll be very tedious. I'd recommend you switching to Python, Ruby, Lua or Java.
For example there are bindings for libusb for Python, Ruby, Lua and Java.
You could write an external program, then use PHP's exec (or was it system?) function to interact with the executable or script.
Seems like the most sane way to do it. Another good alternative is to build a program or script that controls an external device that can communicate with a RESTfull type API exposed via HTTP - and then use lib_curl in PHP land to talk back and forth between it. Believe me, building a basic HTTP server in C++ that can be used to be remote controlled with PHP (or JS for that matter) is very simple.
Wait
I think I read the question wrong ;)
If you want to get into really cool stuff, I say that you learn C++. C++ is a great language that not only opens a lot of doors, but also provides a good learning experience. C++ is lots and lots of fun.
In response to comment
In the case with USB its a bit different and more complicated (as USB has an established protocol and such) but serial is as easy as dumping data into a handle.
You should be able to pick up C++ to get to that point fairly soon. Either way it's a great experience.
This would be possible with a extension, but not with pure PHP code. I don't know of any extensions being able to do something like this, but I think it should be possible.
If you find a command line tool that does this, then you can control it using exec(), system(), passthru() or shell_exec() (based on what output the program gives you back)
Just be sure to escapeshellcmd() if you give access to this program from a public website.

Categories