|
Linux for Video Production (O'ReillyNet)Linux for Video Production (O'ReillyNet)Posted Aug 20, 2005 7:29 UTC (Sat) by drag (subscriber, #31333)In reply to: Linux for Video Production (O'ReillyNet) by djabsolut Parent article: Linux for Video Production (O'ReillyNet)
Psyco can offer _some_ very nice acceleration for Python apps... but at expense for memory usage...
Which isn't a bad thing. Python's garbage collector is very agressive and Python program's average memory usage is MUCH smaller then something like Java or .NET even.
The problem with having a x2 to x3 speed up is that it's still very much slower then (good) c/c++ programming. (it's a hell of a lot faster then bad c/c++ programming)
The problem with saying something like 'Oh, it's using python so it much be slow' is because it's a very ignorant (and forgivable) statement.
What is missing is a understanding of python-style developement for applications that require good speed, which is basicly that you don't program in python when speed matters, you program in C or C++ and then incorpate that functionality as code into your larger python-based program.
What you generally do is initially write out your program in Python and using pre-made/tested/optimized modules/frameworks from third parties were appropriate. Then after you get it 'correct', or close enough to what you want and have it provide the functionality you want, then you break out the profiler and study what parts of the programs are taking the most time to accomplish.
Typically the majority of the program consumes the minority of the resources.. it's certain things, certain parts of the program that end up being time-critical. You rewrite those parts that are causing the slow-downs as modules in C/C++ code.
Then everytime you want to make a change you don't have to recompile the entire stupid thing.. end users have much more access to the code so they can 'fix' problems themselves. Then the important parts are written in C and are designed to only take specific inputs from the python stuff, proccess as fast as possible, and then give specific outputs that can be intellegently delt with by the python code.
In this specific application's case, PiTiVi, Python may make a good choice. A bad UI written in C is going to slow down users much more then a good UI in python (that would also be easily modifiable and scriptable if done correctly). At it's core it's going to depend on gstreamer to do the heavy lifting... And that's definately not written in Python and should be just as fast as any other C code. So it all depends on how robust gstreamer will be. (will I like gstreamer idea's alot.. I still can't get it to run totem on powerpc without crashing)
(Log in to post comments)
Linux for Video Production (O'ReillyNet) Posted Aug 20, 2005 8:05 UTC (Sat) by cantsin (guest, #4420) [Link] I see and understand you point. But since video editing is a realtime task, only the trivial parts - i.e. only the GUI - of the application could be coded in Python. One should consider that Cinelerra, a program written in C++, recommends the use of Dual Opterons in connection with a 16-node cluster to do realtime compositing and editing. It seems highly speculative on behalf of the programmer to expect that those critical parts of the program will be simply provided by gstreamer (a framework that at the moment isn't even mature for multimedia playback) and a number of plugins, and that the realtime arbitration between them and gstreamer will be handled by the Python frontend. It might be feasible at the moment to writer a multimedia player frontend in Python using libxine/mplayer/gstreamer as backend at this moment, but I don't see video editing being feasible this way.
Linux for Video Production (O'ReillyNet) Posted Aug 20, 2005 11:23 UTC (Sat) by cantsin (guest, #4420) [Link] Sorry, I should have written:...feasible this way any time soon.
Linux for Video Production (O'ReillyNet) Posted Aug 20, 2005 11:57 UTC (Sat) by drag (subscriber, #31333) [Link] Well I agree with you entirely.
All of it rests on the shoulders of gstreamer framework.
Be aware that the framework was designed for this sort of thing from the beginning more or less.. It's not intended just for playback but for the specific ability to pipe data between plugins/whatever... Use filters, transcoders and codecs like Bash uses grep, sed, and awk.
The python, I expect is just for "glue" to allow a easy way for end users to start, stop, and connect gstreamer's various parts together in a convient manner. I doubt that python will handle the data in any serious way... Maybe for small specialized tasks and such.
Other examples of people using python in programs would be stuff like Panda3d. (which is open source) It's used in a few commercial games and is designed specificly to work with python. There is a python scripting framework for Blender (which itself is increadably powerfull and fast) that people are using to do some very advanced things, like modelling based on bitmaps or whatnot while also making it easier for normal people to write stuff like import and export scripts. And of course script-foo for the Gimp and such.
Also don't forget that Google uses Python in their stuff, and Zope is used on some very busy commercial sites.
But for this paticular thing to succeed it all depends on gstreamer. They could of just as easily used Mono and .NET or Java instead of python for all that matters. (although obviously I like python a lot)
|
Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.