mencoder generates empty .avi file

1.5k Views Asked by At

i am calling mencoder from a python script to generate a movie from various .png files:

import sys, os
command =   ''.join([
            'mplayer\mencoder.exe ',
            'mf://frames/out_*.png ',
            '-mf type=png:w=800:h=600:fps=10 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o out.avi '
            ])
print "executing", command
os.system(command)

mencoder gives me a 4KB out.avi and this output:

    C:\Windows\system32\cmd.exe /c python make_video.py
    executing mplayer\mencoder.exe mf://frames/out_*.png -mf type=png:w=800:h=600:fps=10 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o out.avi
    MEncoder Sherpya-SVN-r34118-4.2.5 (C) 2000-2011 MPlayer Team
    success: format: 16  data: 0x0 - 0x0
    MF file format detected.
    [mf] search expr: frames/out_*.png
    [mf] number of files: 129 (516)
    VIDEO:  [MPNG]  800x600  24bpp  10.000 fps    0.0 kbps ( 0.0 kbyte/s)
    [V] filefmt:16  fourcc:0x474E504D  size:800x600  fps:10.000  ftime:=0.1000
    Opening video filter: [expand osd=1]
    Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
    ==========================================================================
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    Selected video codec: [ffpng] vfm: ffmpeg (FFmpeg PNG)
    ==========================================================================

    Flushing video frames.
    Filters have not been configured! Empty file?
    Writing index...
    Writing header...
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.

    Video stream:      nan kbit/s  (-2147483648 B/s)  size: 0 bytes  0.000 secs  0 frames

Please help.

1

There are 1 best solutions below

2
On

I guess this is an old thread, but i was having the same issue so thought I'd share my solution in case someone else runs into this same page.

basically the error comes in when trying to run mencoder from outside your source folder location. so to get this to work, just CD into the folder with your source images and run the command from there.

OR you can modify your python script and add a line changing the current path to your source image path just before running mencoder. Something like: os.chdir(sourcefolder) # where sourcefolder is the location of your source images

Cheers! -Kevin