Hi,

When I tried to play, on a Philips DVP642, video encoded with
transcode and Xvid 1.1, I got the same problem as this fellow:

http://www.exit1.org/archive/dvdrip-users/2005-08/msg00080.html

After much trial and error, I finally figured out that forcing
"--export_par 1" would make the hardware player happy. I think
I see why, too: it looks like "export_xvid4.c" is unconditionally
setting up the codec for "user supplied PAR" with dimensions of
0:0. It seems that Xvid 1.0 fixed that up for you, but 1.1 gives
you exactly what you ask for -- apparently. (I say "apparently"
because I don't have any way of checking those bits in the video
frames, but I strongly suspect it's actually passing that through
into the file, and "mplayer" ignores it, but the hardware player
hates it.)

So here's a patch against anonCVS. The "unrelated" items were
required to build against NetBSD 1.2. Do with it as you wish.


diff -ru /m/source/misc/transcode/export/export_xvid4.c 
/var/tmp/transcode/export/export_xvid4.c
--- /m/source/misc/transcode/export/export_xvid4.c      2006-06-04 
21:08:41.000000000 -0500
+++ /var/tmp/transcode/export/export_xvid4.c    2006-06-04 21:31:33.000000000 
-0500
@@ -61,6 +61,7 @@
 #include "aud_aux.h"
 #include "libtc/libtc.h"
 #include "libtcvideo/tcvideo.h"
+#include "tc_defaults.h"
 
 #include "libtc/cfgfile.h"
 
@@ -1056,15 +1057,16 @@
        x->quant_intra_matrix = xcfg->quant_intra_matrix;
        x->quant_inter_matrix = xcfg->quant_inter_matrix;
 
-       /* pixel aspect ratio
-        * transcode.c uses 0 for EXT instead of 15 */
-       if ((vob->ex_par==0) &&
-           (vob->ex_par_width==1) && (vob->ex_par_height==1))
-           vob->ex_par = 1;
-
-       x->par = (vob->ex_par==0)? XVID_PAR_EXT: vob->ex_par;
-       x->par_width = vob->ex_par_width;
-       x->par_height = vob->ex_par_height;
+       /* pixel aspect ratio */
+       if (vob->export_attributes & TC_EXPORT_ATTRIBUTE_PAR) {
+               if (vob->ex_par == 0) {
+                       x->par = XVID_PAR_EXT;
+                       x->par_width = vob->ex_par_width;
+                       x->par_height = vob->ex_par_height;
+               } else {
+                       x->par = vob->ex_par;
+               }
+       }
 
        return;
 }
diff -ru /m/source/misc/transcode/libtc/iodir.h /var/tmp/transcode/libtc/iodir.h
--- /m/source/misc/transcode/libtc/iodir.h      2006-04-11 03:47:23.000000000 
-0500
+++ /var/tmp/transcode/libtc/iodir.h    2006-06-04 20:55:39.000000000 -0500
@@ -29,6 +29,7 @@
 #define IODIR_H
 
 #include <dirent.h>
+#include <limits.h>
 
 typedef struct tcdirlist_ TCDirList;
 struct tcdirlist_ {
diff -ru /m/source/misc/transcode/testsuite/test-tcstrdup.c 
/var/tmp/transcode/testsuite/test-tcstrdup.c
--- /m/source/misc/transcode/testsuite/test-tcstrdup.c  2006-05-27 
05:29:27.000000000 -0500
+++ /var/tmp/transcode/testsuite/test-tcstrdup.c        2006-06-04 
21:18:08.000000000 -0500
@@ -59,6 +59,7 @@
     return 0;
 }
 
+#if 0
 static int test_strndup(size_t n)
 {
     const char *s1 = TEST_STRING;
@@ -83,17 +84,20 @@
     tc_info("test_strndup() end");
     return 0;
 }
+#endif
 
 int main(void)
 {
     test_strdup();
 
+#if 0
     test_strndup(0);
     test_strndup(1);
     test_strndup(5);
 
     test_strndup(strlen(TEST_STRING)-2);
     test_strndup(strlen(TEST_STRING)-1);
+#endif
 
     return 0;
 }
diff -ru /m/source/misc/transcode/tools/Makefile.am 
/var/tmp/transcode/tools/Makefile.am
--- /m/source/misc/transcode/tools/Makefile.am  2006-06-04 15:45:22.000000000 
-0500
+++ /var/tmp/transcode/tools/Makefile.am        2006-06-04 21:21:50.000000000 
-0500
@@ -116,6 +116,7 @@
        $(LIBTCVIDEO_LIBS) \
        $(LIBTCAUDIO_LIBS) \
        $(XIO_LIBS) \
+       $(PTHREAD_LIBS) \
        -lm
 tcexport_LDFLAGS = -export-dynamic
 

That works.  The Philips is happy enough to see no PAR, or else
Xvid is setting the PAR (not sure) -- that hardware player just
doesn't like the insane PAR settings.

I also have a longer patch against 1.0.2 to use the Xvid 1.1 rate
controls.  I won't post it here because it's not very interesting:
besides being out-of-date against CVS, it doesn't have the profile
support (yet), but I'd be happy to send it to anyone who wants to
work on it.

-- 
Frederick

Reply via email to