473,662 Members | 2,596 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python Video processing.

Ant
Hi all,

I have a specific task I want to automate - rotating a video file
through 90 degrees.

I've used the PIL library quite a bit to perform batch processing on
images, and would like to do similar on video. Can anyone see a problem
with the following:

1) Use pymedia to convert the video into a sequence of stills (e.g.
http://pymedia.org/tut/src/dump_video.py.html)
2) Use PIL to process each still
3) Use pymedia to re-pack the still into video format.

In particular, does anyone know whether the data obtained from decoding
the video frame as in the following snippet from
http://pymedia.org/tut/src/dump_video.py.html:

dd= d.convert( fmt )
img= pygame.image.fr omstring( dd.data, dd.size, "RGB" )

can be directly loaded into a PIL Image object (and back again?)?

Jun 13 '06 #1
2 5790
"Ant" <an****@gmail.c om> wrote:
In particular, does anyone know whether the data obtained from decoding
the video frame as in the following snippet from
http://pymedia.org/tut/src/dump_video.py.html:

dd= d.convert( fmt )
img= pygame.image.fr omstring( dd.data, dd.size, "RGB" )

can be directly loaded into a PIL Image object (and back again?)?


iirc, the pygame fromstring/tostring methods are designed to be data-compatible
with PIL's corresponding methods, so you should be able to do

im = Image.fromstrin g("RGB", dd.size, dd.data)

instead of doing that pygame.image call (not that the argument order is different).

for details, see the pygame tostring/fromstring docs, and the corresponding PIL
methods:

http://www.pygame.org/docs/ref/image.html
http://www.pythonware.com/library/pi...book/image.htm

hope this helps!

</F>

Jun 13 '06 #2
Ant
> im = Image.fromstrin g("RGB", dd.size, dd.data)

instead of doing that pygame.image call (not that the argument order is different).

for details, see the pygame tostring/fromstring docs, and the corresponding PIL
methods:


That's starting to look promising, yes - thanks! I'll give it a shot
this evening and see what happens...

Jun 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3794
by: Google Mike | last post by:
Is there a Linux PHP module so that I can process web cam video with Linux PHP from multiple USB ports? (I'm working on a video surveillance idea since I found out that my office spent a whopping $30K on their 8 camera system and were told it would cost $13K for 3 more cameras to be added. If that inspires you to do your own system, please do so -- I love it when people can make big cash with Linux!) For discussions here, realize that...
1
3689
by: Paul | last post by:
Hello, I am researching ideas for a long term project and am currently investigating Java's capability for processing live video feed. I wish to examine digital video feed in real time and do such operations as: i) Define all pixels as either foreground or background (depending on whether they have the same colour as the predefined background).
47
3646
by: Michael Scarlett | last post by:
There is an amazing article by paul graham about python, and an even better discussion about it on slashdot. The reason I point this out, is the more I read both articles, the more I realised how we would be mutilating the language with that god forsaken @ decorator. I don't know about the rest of you, but I learned python and fell in love with its syntax and simplicity. Python - just works. So please GVR. Don't complicate it. Leave it as...
137
7062
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very pragmatic - 3) I usually move forward when I get the gut feeling I am correct - 4) Most likely because of 1), I usually do not manage to fully explain 3) when it comes true. - 5) I have developed for many years (>18) in many different environments,...
0
2129
by: Stefan Tietke | last post by:
Hi all, for a realtime simulation of a video installation we want to use Quicktime to read video data from a file or stream and process the data in a realtime Gameblender model. We are trying to simulate a large-scale, low resolution media facade using individuell video pixels to control lamps mounted into the facade.
3
2063
by: triplejump24 | last post by:
i LOVE doing c++ programming, but i never can get myself started! Once i figure it out, its fun but anyways here it goes... Im given a file c:\temp\hwk8input.txt, which contains the records of the video collection of a small local library. There are four fields for each video: 1) A unique video ID number without space (v1, v2, etc.); 2) The full video title; 3) The availability of the video (0 for checked out and 1 for checked in); 4) A...
1
2078
by: Petr Prikryl | last post by:
Do you think that the following could became PEP (pre PEP). Please, read it, comment it, reformulate it,... Abstract Introduction of the mechanism for language extensions via modules written using other languages. Extensions of Python could be done via special interpreter extensions. From Python sources, the special modules would look like other modules, with the Python API (the key feature from
2
1410
by: yinglcs | last post by:
Hi, I am trying to use python for file processing. Suppose I have a file like this: I want to build a Hashmap between the line "begin_QOS_statistics" and "end_QOS_statistics" and for each line I want to put the first text as the key of the hash table and the second text as the value.
0
8435
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.