shanenin Posted July 29, 2005 Report Share Posted July 29, 2005 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 appreciatedbuilding 'pymedia.video.vcodec' extensioni686-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.oIn 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 Quote Link to post Share on other sites
jcl Posted July 29, 2005 Report Share Posted July 29, 2005 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.) Quote Link to post Share on other sites
shanenin Posted July 30, 2005 Author Report Share Posted July 30, 2005 (edited) 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 thisexport CC=/opt/gcc-2.95.3/bin/gccedit added later//I am building gcc 2.95.3 now, I get the feeling I may not have done it correctly. I used these optionsconfigure --prefix=/opt/gcc-2.95.3 \ --enable-shared --enable-languages=c,c++ \ --enable-threads=posixI also patched it with thesegcc-2.95.3-no-fixinc.patchgcc-2.95.3-2.patch gcc-2.95.3-returntype-fix.patchthe docs i read also reccomended not building in the source directory, so I followed there adviceedit added later//gcc built in about two minutes, that does not seem correct, I must have screwed something up. I tried usingit anywaysvideo/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 July 30, 2005 by shanenin Quote Link to post Share on other sites
jcl Posted July 30, 2005 Report Share Posted July 30, 2005 (edited) 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 July 30, 2005 by jcl Quote Link to post Share on other sites
iccaros Posted July 30, 2005 Report Share Posted July 30, 2005 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 720x480http://www.dvdupgrades.ch/about/videofaq.htmlthis should help Quote Link to post Share on other sites
shanenin Posted August 27, 2005 Author Report Share Posted August 27, 2005 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. Quote Link to post Share on other sites
shanenin Posted August 30, 2005 Author Report Share Posted August 30, 2005 (edited) 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 thisshane@mainbox shane $ g++ test.cpp -o testavitest.cpp:5:24: avm_except.h: No such file or directorytest.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 errorsshane@mainbox shane $ g++ test.cpp -o testavitest.cpp:15: warning: converting to `int' from `double'test.cpp:16: error: syntax error before `=' tokentest.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 August 30, 2005 by shanenin Quote Link to post Share on other sites
jcl Posted August 30, 2005 Report Share Posted August 30, 2005 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` $FILE2. 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. Quote Link to post Share on other sites
shanenin Posted August 30, 2005 Author Report Share Posted August 30, 2005 if I change the incudes back to the way you had them, this should workg++ `avifile-config --cflags --libs` test.cpp -o testaviI am still getting the same errors Quote Link to post Share on other sites
shanenin Posted August 30, 2005 Author Report Share Posted August 30, 2005 (edited) I found a beautiful way to do this with mplayermplayer -identify -frames 0 file.mp4look at the output it gives meID_FILENAME=test/anchor-man.mp4ID_VIDEO_FORMAT=mp4vID_VIDEO_BITRATE=0ID_VIDEO_WIDTH=704ID_VIDEO_HEIGHT=368ID_VIDEO_FPS=23.976ID_VIDEO_ASPECT=0.0000ID_AUDIO_CODEC=faadID_AUDIO_FORMAT=mp4aID_AUDIO_BITRATE=127856ID_AUDIO_RATE=48000ID_AUDIO_NCH=2ID_LENGTH=5845since my program makes conf files for mplayer, it is safe to assume mplayer is already installed on the system Edited August 30, 2005 by shanenin Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.