Pymedia Fails To Build


Recommended Posts

First off I am looking a for a way in python to determine the dimesions of a video, for example 512:288(is that pixels?). do you know of a module that will do this?

I think the module pymedia may do this, but I am having trouble getting it to compile. below is the error message. Any help would be appreciated

building 'pymedia.video.vcodec' extension
i686-pc-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -fPIC -DBUILD_NUM=1536 -DPATH_DEV_DSP="/dev/dsp" -DPATH_DEV_MIXER="/dev/mixer" -D_FILE_OFFSET_BITS=64 -DACCEL_DETECT=1 -DHAVE_MMX=1 -DHAVE_LINUX_DVD_STRUCT=1 -DDVD_STRUCT_IN_LINUX_CDROM_H=1 -DCONFIG_VORBIS -DCONFIG_VORBIS -DCONFIG_FAAD -DCONFIG_VORBIS -DHAVE_AV_CONFIG_H -INone -INone -INone -INone -Ivideo/ -I/usr/include/python2.3 -c video/libavcodec/i386/dsputil_mmx.c -o build/temp.linux-i686-2.3/video/libavcodec/i386/dsputil_mmx.o
In file included from video/libavcodec/i386/dsputil_mmx.c:125:
video/libavcodec/i386/dsputil_mmx_rnd.h: In function `put_no_rnd_pixels8_l2_mmx':
video/libavcodec/i386/dsputil_mmx_rnd.h:60: error: can't find a register in class `BREG' while reloading `asm'
error: command 'i686-pc-linux-gnu-gcc' failed with exit status 1

Link to post
Share on other sites

No idea about the first question. The file utility will print dimensions for some formats but I don't know if it's reliable enough for regular use.

The error message from pymedia may be related to the tigher contraints on inline assembly in the newer versions of GCC. There's a comment in the source that makes me think it's known to break with some versions of GCC. (Is pymedia still being actively maintained? The latest source release on Sourceforge is pretty old.)

Link to post
Share on other sites

Hmm. thanks for the input. I am running gcc-3.3.5. Do you think it would be worth a try to install an older version of gcc? If i did that, do I just export a varaible telling it what version of gcc to use?

edit added later//

if I install gcc in my /opt directory, could I just go like this

export CC=/opt/gcc-2.95.3/bin/gcc

edit added later//

I am building gcc 2.95.3 now, I get the feeling I may not have done it correctly. I used these options

configure --prefix=/opt/gcc-2.95.3 \
   --enable-shared --enable-languages=c,c++ \
   --enable-threads=posix

I also patched it with these

gcc-2.95.3-no-fixinc.patch

gcc-2.95.3-2.patch

gcc-2.95.3-returntype-fix.patch

the docs i read also reccomended not building in the source directory, so I followed there advice

edit added later//

gcc built in about two minutes, that does not seem correct, I must have screwed something up. I tried usingit anyways

video/libavcodec/i386/dsputil_mmx_rnd.h: In function `put_pixels16_l2_mmx':
video/libavcodec/i386/dsputil_mmx_rnd.h:199: Invalid `asm' statement:
video/libavcodec/i386/dsputil_mmx_rnd.h:199: fixed or forbidden register 3 (bx) was spilled for class BREG.
error: command '/opt/gcc-2.95.3/bin/gcc' failed with exit status 1

Edited by shanenin
Link to post
Share on other sites

Looks like the inline assembly is broken. Not really surprised. A lot of multimedia libraries use dubious optimizations.

If you're interested, I just hacked a small utility that uses the xine library to get the dimensions of a video stream. I could wrap it in a Python extension.

Edited by jcl
Link to post
Share on other sites

to answer the first quest.. yes its in pixels. a standard TV is 720x480 but with 6:9 pull down (letter box or HD ) you will get a different sizing... in any case there is no DVD with better then 720x480

http://www.dvdupgrades.ch/about/videofaq.html

this should help

Link to post
Share on other sites
  • 4 weeks later...
If you're interested, I just hacked a small utility that uses the xine library to get the dimensions of a video stream.  I could wrap it in a Python extension.

<{POST_SNAPBACK}>

I must have missed this post, that would have been helpful(not needed anymore). That is pretty cool how python can use C code to do the really cpu intensive stuff.

Link to post
Share on other sites

I went to use my cropit program on an .mp4 file created by nero encoder, and it failed. I forgot the program I use to get the dimensions of the movie file only works on .avi files. Do you think your c module based of the xine lib would work on these mp4 files? if so, I would really be interested in trying to incororate it. As of now I use nero for about 2/3 of the movies I encode.

edit added later//

I tried to build your c++ program like this

shane@mainbox shane $ g++ test.cpp -o testavi
test.cpp:5:24: avm_except.h: No such file or directory
test.cpp:6:21: avifile.h: No such file or directory
-- plus additional erros cropped for this post--

so I changed the includes to look like this

#include <avifile-0.7/avm_except.h>
#include <avifile-0.7/avifile.h>
#include <avifile-0.7/image.h>
#include <avifile-0.7/infotypes.h>

now I get these errors

shane@mainbox shane $ g++ test.cpp -o testavi
test.cpp:15: warning: converting to `int' from `double'
test.cpp:16: error: syntax error before `=' token
test.cpp: In function `int main(int, char**)':
test.cpp:31: error: `FileExtension' undeclared (first use this function)
test.cpp:31: error: (Each undeclared identifier is reported only once for each
  function it appears in.)

two questions:

1. how was your program even finding the header files the way you had them listed?

2. the big questiion, why is the program failing to compile, user error on my part?

Edited by shanenin
Link to post
Share on other sites
I went to use my cropit program on an .mp4 file created by nero encoder, and it failed. I forgot the program I use to get the dimensions of the movie file only works on .avi files.  Do you think your c module based of the xine lib would work on these mp4 files?

It should if your xine installation has the codecs installed. I'll dig it out and clean it up.

1. how was your program even finding the header files the way you had them listed?

$ g++ `avifile-config --cflags --libs` $FILE

2. the big questiion, why is the program failing to compile, user error on my part?

<{POST_SNAPBACK}>

No idea. It compiles with three warnings (two unused arguments, one suggestion for parentheses) here with GCC 3.3.5.

Link to post
Share on other sites

I found a beautiful way to do this with mplayer

mplayer -identify -frames 0 file.mp4

look at the output it gives me

ID_FILENAME=test/anchor-man.mp4
ID_VIDEO_FORMAT=mp4v
ID_VIDEO_BITRATE=0
ID_VIDEO_WIDTH=704
ID_VIDEO_HEIGHT=368
ID_VIDEO_FPS=23.976
ID_VIDEO_ASPECT=0.0000
ID_AUDIO_CODEC=faad
ID_AUDIO_FORMAT=mp4a
ID_AUDIO_BITRATE=127856
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
ID_LENGTH=5845

since my program makes conf files for mplayer, it is safe to assume mplayer is already installed on the system

Edited by shanenin
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...