[GRASS5] RE: [bug #4140] (grass) Nviz doesn't start either from GUI or CLI

Hamish hamish_nospam at yahoo.com
Wed Mar 15 20:36:06 EST 2006


> I dug back into some of my old archives from when I had looked into
> going back to an nviz start-up script. 

what's the advantage of starting from a script? disadvantage?


The attached patch will change the NVIZ animation encoding codec from
MPEG-1 to the much nicer Xvid. It's a proof of concept hack, but
functional. Even with a 5x bitrate the Xvid file size isn't all that
much bigger than the MPEG-1 file, but the quality is way better. I don't
think the Ogg Theora is working, but I didn't really spend any time on
that. Also I know the Xvid codec has a "cartoon mode", but I couldn't
find where to assert that. It might be useful to try.

I think it's good to give the user the option to use a better codec than
MPEG-1, either by another Tcl radio button for Xvid or an arbitrary
codec taken from an environmental variable (or g.gisenv grass variable)
if given.

Which approach do you think is best?


Hamish
-------------- next part --------------
Index: lib/ogsf/gsd_img_ppm.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/ogsf/gsd_img_ppm.c,v
retrieving revision 2.2
diff -u -r2.2 gsd_img_ppm.c
--- lib/ogsf/gsd_img_ppm.c	21 Nov 2005 16:33:08 -0000	2.2
+++ lib/ogsf/gsd_img_ppm.c	16 Mar 2006 01:29:52 -0000
@@ -147,13 +147,17 @@
 
         avcodec_init();
 
-        register_avcodec(&mpeg1video_encoder); /* just mpeg1 */
+//        register_avcodec(&mpeg1video_encoder); /* just mpeg1 */
+	register_avcodec(&xvid_encoder);
+//	register_avcodec(&oggtheora_encoder);
 	/* -- use with othe formats ...
 	avcodec_register_all();
 	*/
 
         /* find the mpeg1 video encoder */
-        codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO);
+//        codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO);
+	codec = avcodec_find_encoder(CODEC_ID_XVID);
+//	codec = avcodec_find_encoder(CODEC_ID_THEORA);
         if (!codec) {
                 fprintf(stderr, "codec not found\n");
                 return(-1);
@@ -163,7 +167,8 @@
         picture= avcodec_alloc_frame();
 
         /* put sample parameters */
-        c->bit_rate = 400000;
+//        c->bit_rate = 400000;
+        c->bit_rate = 2000000;
         /* resolution must be a multiple of two */
         c->width = r - l + 1;
         c->height = t - b + 1;
@@ -180,6 +185,7 @@
         /* open it */
         if (avcodec_open(c, codec) < 0) {
                 fprintf(stderr, "could not open codec\n");
+		G_debug(1, "avcodec_open() returned %d", avcodec_open(c, codec));
                 return(-1);
         }
 


More information about the grass-dev mailing list