ffmpeg and python big problem

Discussion in 'Python' started by TerabyteST, May 21, 2009.

  1. TerabyteST

    TerabyteST Guest

    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!
     
    TerabyteST, May 21, 2009
    #1
    1. Advertising

  2. 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
     
    Emile van Sebille, May 21, 2009
    #2
    1. Advertising

  3. TerabyteST

    Rhodri James Guest

    On Thu, 21 May 2009 22:48:33 +0100, TerabyteST <> wrote:

    > 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.

    --
    Rhodri James *-* Wildebeeste Herder to the Masses
     
    Rhodri James, May 22, 2009
    #3
  4. TerabyteST

    Rhodri James Guest

    On Fri, 22 May 2009 13:54:26 +0100, TerabyteST <> wrote:

    > 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.

    --
    Rhodri James *-* Wildebeeste Herder to the Masses
     
    Rhodri James, May 22, 2009
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. maxwell hammer

    Python wrapper to ffmpeg and speex

    maxwell hammer, Jan 17, 2004, in forum: Python
    Replies:
    0
    Views:
    571
    maxwell hammer
    Jan 17, 2004
  2. Shaguf
    Replies:
    0
    Views:
    538
    Shaguf
    Dec 24, 2008
  3. Shaguf
    Replies:
    0
    Views:
    496
    Shaguf
    Dec 26, 2008
  4. Shaguf
    Replies:
    0
    Views:
    269
    Shaguf
    Dec 26, 2008
  5. Shaguf
    Replies:
    0
    Views:
    244
    Shaguf
    Dec 24, 2008
Loading...

Share This Page