ffmpeg and python big problem

T

TerabyteST

Hello. I am trying to make a video from images shot by my webcam in
python. I use a module I found on the net (here
http://osdir.com/ml/python.matplotlib.general/2005-10/msg00145.html )
but, even if I think I am doing everything correctly, what I only get
is a grey video with some multi-color squares on the top-left bit... I
don't think it's a problem with ffmpeg because I tried with two
different versions. Not even with the codec: i tried wmv, mpg, avi and
everything, but still the same result. And also, my webcam does the
capture right because if I check the image it's OK. Last thing left,
IMO, is the module, but I can't seem to find whats the problem... Is
it because the module was (maybe) made on Linux and I'm working on
windows? If you would help me I'd be so glad!
This program is for my friend and he needs it ready preety quick.

Thank you!
 
E

Emile van Sebille

On 5/21/2009 2:48 PM TerabyteST said...
Hello. I am trying to make a video from images shot by my webcam in
python. I use a module I found on the net (here
http://osdir.com/ml/python.matplotlib.general/2005-10/msg00145.html )
but, even if I think I am doing everything correctly, what I only get
is a grey video with some multi-color squares on the top-left bit... I
don't think it's a problem with ffmpeg because I tried with two
different versions. Not even with the codec: i tried wmv, mpg, avi and
everything, but still the same result. And also, my webcam does the
capture right because if I check the image it's OK. Last thing left,
IMO, is the module, but I can't seem to find whats the problem... Is
it because the module was (maybe) made on Linux and I'm working on
windows? If you would help me I'd be so glad!
This program is for my friend and he needs it ready preety quick.

Why not use mencoder directly? Last time I did this I used Python to
organize the shots and mencoder to create the video...

Emile
 
R

Rhodri James

Hello. I am trying to make a video from images shot by my webcam in
python. I use a module I found on the net (here
http://osdir.com/ml/python.matplotlib.general/2005-10/msg00145.html )
but, even if I think I am doing everything correctly, what I only get
is a grey video with some multi-color squares on the top-left bit...

Obvious starter question: do you have ffmpeg properly compiled for
Windows (i.e. using Cygwin or MinGW)?
I
don't think it's a problem with ffmpeg because I tried with two
different versions.

This is not a guarantee. ffmpeg is wonderful when it works, and a
total pig when it doesn't. Sometimes it's big and obvious about
not working and seg-faults on you, and sometimes it just does
something completely implausible with the information you give
it.
Not even with the codec: i tried wmv, mpg, avi and
everything, but still the same result.

The output vcodec doesn't matter as much as the input vcodec,
which is mjpeg. I think webcams are mjpeg devices, but I've
never used one so I'm not sure.
Last thing left,
IMO, is the module, but I can't seem to find whats the problem... Is
it because the module was (maybe) made on Linux and I'm working on
windows? If you would help me I'd be so glad!

I'm not nearly so worried about the module being written on Linux as
ffmpeg. The module is full of bad practice, but it doesn't do
anything os-specifically bad.

There is one further thing to check: your code that uses the module.
How do you feed data from the webcam to the VidStream object? If
you're creating intermediate files of webcam stuff, please say
what they are and how they came to be.

I have to admit, if you've got images from your webcam in a file
already, I don't see why you aren't using ffmpeg directly.
This program is for my friend and he needs it ready preety quick.

Aha. Ahahahahahahahaha.

Ahem.

Sorry, but "pretty quick" and "ffmeg" don't go together well in
my experience.
 
R

Rhodri James

Could you give me a link to a version that "works"?

Not with any confidence. The ffmpeg website (http://www.ffmpeg.org)
has a link to this page (http://ffmpeg.arrozcru.org/) which seems to
have binaries on it, but I don't use Windows so I have no idea if
they actually work or not.
For putting the data in the stream I save bmp stills from the webcam
and then use the write function giving the name of the file.

You don't believe in making life easy for yourself, do you? :)
Why are you turning stills into a video anyway? Wouldn't it be easier
to save the webcam output as video (whatever format it claims to be)
and get ffmpeg to work on it directly?
@Emile: if I can access MEncoder from python and give it the images
one by one, using a stream like i'm doing in ffmpeg, or telling it a
sequence to make a video from, I could try it.

You seem to have emailed me directly, not the list. I've copied this
back to the list so Emile can see it too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top