diff -aur -x .o -x '~' old/advancecomp-1.9/remng.cc new/advancecomp-1.9/remng.cc
--- old/advancecomp-1.9/remng.cc	2003-11-02 21:10:03.000000000 +0100
+++ new/advancecomp-1.9/remng.cc	2004-01-19 03:54:06.000000000 +0100
@@ -667,7 +667,7 @@
 // --------------------------------------------------------------------------
 // Extract
 
-void extract(const string& path_src) {
+void extract(const string& path_src, int nframe) {
 	adv_fz* f_in;
 	adv_mng* mng;
 	adv_fz* f_out;
@@ -722,48 +722,61 @@
 				first_tick = 1;
 		}
 
-		ostringstream path_dst;
-		path_dst << base << "-";
+		if ((nframe == -1) || (counter == nframe)) {
 
-		// not optimal code for g++ 2.95.3
-		path_dst.setf(ios::right, ios::adjustfield);
+		  ostringstream path_dst;
 
-		path_dst << setw(8) << setfill('0') << counter;
-		path_dst << ".png";
-
-		if (!opt_quiet) {
-			cout << path_dst.str() << endl;
-		}
-
-		f_out = fzopen(path_dst.str().c_str(), "wb");
-		if (!f_out) {
-			fzclose(f_in);
-			throw error() << "Failed open for writing " << path_dst.str();
-		}
-
-		++counter;
+		  if (nframe == -1) {
+		    path_dst << base << "-";
+		    // not optimal code for g++ 2.95.3
+		    path_dst.setf(ios::right, ios::adjustfield);
+		    path_dst << setw(8) << setfill('0') << counter;
+		  } else {
+		    path_dst << base;
+		  }
+
+		  path_dst << ".png";
+
+		  if (!opt_quiet) {
+		    cout << path_dst.str() << endl;
+		  }
+
+		  f_out = fzopen(path_dst.str().c_str(), "wb");
+		  if (!f_out) {
+		    fzclose(f_in);
+		    throw error() << "Failed open for writing " << path_dst.str();
+		  }
 
 #if 1
-		// convert to 4 byte RGBA format.
-		// mencoder 0.90 has problems with 3 byte RGB format.
-		png_convert_4(pix_width, pix_height, pix_pixel, pix_ptr, pix_scanline, pal_ptr, pal_size, &dst_ptr, &dst_pixel, &dst_scanline);
+		  // convert to 4 byte RGBA format.
+		  // mencoder 0.90 has problems with 3 byte RGB format.
+		  png_convert_4(pix_width, pix_height, pix_pixel, pix_ptr, pix_scanline, pal_ptr, pal_size, &dst_ptr, &dst_pixel, &dst_scanline);
 
-		png_write(f_out, pix_width, pix_height, dst_pixel, dst_ptr, dst_scanline, 0, 0, 0, 0, opt_level);
+		  png_write(f_out, pix_width, pix_height, dst_pixel, dst_ptr, dst_scanline, 0, 0, 0, 0, opt_level);
 
-		free(dst_ptr);
+		  free(dst_ptr);
 #else
-		png_write(f_out, pix_width, pix_height, pix_pixel, pix_ptr, pix_scanline, pal_ptr, pal_size, 0, 0, opt_level);
+		  png_write(f_out, pix_width, pix_height, pix_pixel, pix_ptr, pix_scanline, pal_ptr, pal_size, 0, 0, opt_level);
 #endif
 
-		fzclose(f_out);
+		  fzclose(f_out);
+
+
+		}
+
+                if (nframe == counter) break;              
+		++counter;
+
 	}
 
-	cout << mng_frequency_get(mng) / (double)first_tick << endl;
+	if (nframe == -1) {
+	  cout << mng_frequency_get(mng) / (double)first_tick << endl;
 
-	if (opt_verbose) {
-		cout << endl;
-		cout << "Example mencoder call:" << endl;
-		cout << "mencoder " << base << "-\\*.png -mf on:w=" << mng_width_get(mng) << ":h=" << mng_height_get(mng) << ":fps=" << mng_frequency_get(mng) / first_tick << ":type=png -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq -o " << base << ".avi" << endl;
+	  if (opt_verbose) {
+	    cout << endl;
+	    cout << "Example mencoder call:" << endl;
+	    cout << "mencoder " << base << "-\\*.png -mf on:w=" << mng_width_get(mng) << ":h=" << mng_height_get(mng) << ":fps=" << mng_frequency_get(mng) / first_tick << ":type=png -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq -o " << base << ".avi" << endl;
+	  }
 	}
 
 	mng_done(mng);
@@ -991,16 +1004,24 @@
 
 void extract_all(int argc, char* argv[]) {
 	for(int i=0;i<argc;++i) {
-		extract(argv[i]);
+	  extract(argv[i], -1);
+	}
+}
+
+void extractone_all(int argc, char* argv[]) {
+	for(int i=0;i<argc;++i) {
+	  extract(argv[i], 0);
 	}
 }
 
+
 #ifdef HAVE_GETOPT_LONG
 struct option long_options[] = {
 	{"recompress", 0, 0, 'z'},
 	{"list", 0, 0, 'l'},
 	{"list-crc", 0, 0, 'L'},
 	{"extract", 0, 0, 'x'},
+	{"extractone", 0, 0, 'X'},
 	{"add", 1, 0, 'a'},
 
 	{"shrink-store", 0, 0, '0'},
@@ -1025,7 +1046,7 @@
 };
 #endif
 
-#define OPTIONS "zlLxa:01234s:S:recCfqvhV"
+#define OPTIONS "zlLxXa:01234s:S:recCfqvhV"
 
 void version() {
 	cout << PACKAGE " v" VERSION " by Andrea Mazzoleni" << endl;
@@ -1040,6 +1061,7 @@
 	cout << "  " SWITCH_GETOPT_LONG("-l, --list            ", "-l    ") "  List the content of the files" << endl;
 	cout << "  " SWITCH_GETOPT_LONG("-z, --recompress      ", "-z    ") "  Recompress the specified files" << endl;
 	cout << "  " SWITCH_GETOPT_LONG("-x, --extract         ", "-x    ") "  Extract all the .PNG frames" << endl;
+	cout << "  " SWITCH_GETOPT_LONG("-X, --extractone      ", "-X    ") "  Extract one .PNG frame" << endl;
 	cout << "  " SWITCH_GETOPT_LONG("-a, --add F MNG PNG...", "-a    ") "  Create a .MNG file from some .PNG files" << endl;
 	cout << "Options:" << endl;
 	cout << "  " SWITCH_GETOPT_LONG("-0, --shrink-store    ", "-0    ") "  Don't compress" << endl;
@@ -1064,7 +1086,7 @@
 void process(int argc, char* argv[]) {
 	unsigned add_frequency;
 	enum cmd_t {
-		cmd_unset, cmd_recompress, cmd_list, cmd_extract, cmd_add
+		cmd_unset, cmd_recompress, cmd_list, cmd_extract, cmd_extractone, cmd_add
 	} cmd = cmd_unset;
 
 	opt_quiet = false;
@@ -1118,6 +1140,11 @@
 					throw error() << "Too many commands";
 				cmd = cmd_extract;
 				break;
+        		case 'X' :
+				if (cmd != cmd_unset)
+					throw error() << "Too many commands";
+				cmd = cmd_extractone;
+				break;
 			case 'a' : {
 				int n;
 				if (cmd != cmd_unset)
@@ -1223,6 +1250,9 @@
 	case cmd_extract :
 		extract_all(argc - optind, argv + optind);
 		break;
+	case cmd_extractone :
+		extractone_all(argc - optind, argv + optind);
+		break;
 	case cmd_add :
 		add_all(argc - optind, argv + optind, add_frequency);
 		break;
