Esempio n. 1
0
void chroma_usage(void)
	{
	int mode = 0;
	const char *keyword;

	fprintf(stderr, "%s -x usage: Only the 3 plane formats are actually supported\n",
		__progname);
	for	(mode = 0; (keyword = y4m_chroma_keyword(mode)) != NULL; mode++)
		fprintf(stderr, "\t%s - %s\n", keyword, y4m_chroma_description(mode));
	exit(1);
	}
Esempio n. 2
0
static
void usage(const char *progname)
{
  fprintf(stderr, "\n");
  fprintf(stderr, "usage:  %s [options] [ppm-file]\n", progname);
  fprintf(stderr, "\n");
  fprintf(stderr, "Reads RAW PPM image(s), and produces YUV4MPEG2 stream on stdout.\n");
  fprintf(stderr, "Converts computer graphics R'G'B' colorspace to digital video Y'CbCr,\n");
  fprintf(stderr, " and performs chroma subsampling.\n");
  fprintf(stderr, "\n");
  fprintf(stderr, "If 'ppm-file' is not specified, reads from stdin.\n");
  fprintf(stderr, "\n");
  fprintf(stderr, " options:  (defaults specified in [])\n");
  fprintf(stderr, "\n");
  fprintf(stderr, "  -o n     frame offset (skip n input frames) [0]\n");
  fprintf(stderr, "  -n n     frame count (output n frames; 0 == all of them) [0]\n");
  fprintf(stderr, "  -F n:d   framerate [30000:1001 = NTSC]\n");
  fprintf(stderr, "  -A w:h   pixel aspect ratio [1:1]\n");
  fprintf(stderr, "  -I x     interlacing [p]\n");
  fprintf(stderr, "             p = none/progressive\n");
  fprintf(stderr, "             t = top-field-first\n");
  fprintf(stderr, "             b = bottom-field-first\n");
  fprintf(stderr, "  -L       treat PPM images as 2-field interleaved\n");
  fprintf(stderr, "  -r       repeat last input frame\n");
  {
    int m;
    const char *keyword;

    fprintf(stderr, "  -S mode  chroma subsampling mode [%s]\n",
	    y4m_chroma_keyword(DEFAULT_CHROMA_MODE));
    for (m = 0;
	 (keyword = y4m_chroma_keyword(m)) != NULL;
	 m++)
      if (chroma_sub_implemented(m))
	fprintf(stderr, "            '%s' -> %s\n",
		keyword, y4m_chroma_description(m));
  }
  /*  fprintf(stderr, "  -R type  subsampling filter type\n");*/
  fprintf(stderr, "  -v n     verbosity (0,1,2) [1]\n");
  fprintf(stderr, "  -B       PPM image is packed with BGR pixels [RGB]\n");
}
Esempio n. 3
0
/* usage
 * Prints a short description of the program, including default values 
 * in: prog: The name of the program 
 */
static void usage(char *prog)
{
  char *h;
  
  if (NULL != (h = (char *)strrchr(prog,'/')))
    prog = h+1;
  
  fprintf(stderr, 
	  "usage: %s [ options ]\n"
	  "\n"
	  "where options are ([] shows the defaults):\n"
	  "  -v num        verbosity (0,1,2)                  [1]\n"
	  "  -b framenum   starting frame number              [0]\n"
	  "  -f framerate  framerate for output stream (fps)     \n"
	  "  -n numframes  number of frames to process        [-1 = all]\n"
	  "  -j {1}%%{2}d{3} Read PNG frames with the name components as follows:\n"
	  "               {1} PNG filename prefix (e g rendered_ )\n"
	  "               {2} Counting placeholder (like in C, printf, eg 06 ))\n"
	  "  -I x  interlacing mode:  p = none/progressive\n"
	  "                           t = top-field-first\n"
	  "                           b = bottom-field-first\n"
	  "  -L x  interleaving mode:  0 = non-interleaved (two successive\n"
	  "                                 fields per PNG file)\n"
	  "                            1 = interleaved fields\n"
          "  -S mode  chroma subsampling mode [%s]\n"
	  "\n"
	  "%s pipes a sequence of PNG files to stdout,\n"
	  "making the direct encoding of MPEG files possible under mpeg2enc.\n"
	  "Any 8bit PNG format supported by libpng can be read.\n"
	  "stdout will be filled with the YUV4MPEG movie data stream,\n"
	  "so be prepared to pipe it on to mpeg2enc or to write it into a file.\n"
	  "\n"
	  "\n"
	  "examples:\n"
	  "  %s -j in_%%06d.png -f 25 -I p -b 100000 > result.yuv\n"
	  "  | combines all the available PNGs that match \n"
	  "    in_??????.png, starting with 100000 (in_100000.png, \n"
	  "    in_100001.png, etc...) into the uncompressed YUV4MPEG videofile result.yuv\n"
	  "    The videofile has 25 frames per second and does not use any interlacing.\n"
	  "  %s -Ip -L0 -j abc_%%04d.png | mpeg2enc -f3 -o out.m2v\n"
	  "  | combines all the available PNGs that match \n"
	  "    abc_??????.png, starting with 0000 (abc_0000.png, \n"
	  "    abc_0001.png, etc...) and pipes it to mpeg2enc which encodes\n"
	  "    an MPEG2-file called out.m2v out of it\n"
	  "\n",
	  prog, y4m_chroma_keyword(DEFAULT_CHROMA_MODE), prog, prog, prog);
}
Esempio n. 4
0
int y4m_write_stream_header_cb(y4m_cb_writer_t * fd, const y4m_stream_info_t *i)
{
  char s[Y4M_LINE_MAX+1];
  int n;
  int err;
  y4m_ratio_t rate = i->framerate;
  y4m_ratio_t aspect = i->sampleaspect;
  const char *chroma_keyword = y4m_chroma_keyword(i->chroma);

  if ((i->chroma == Y4M_UNKNOWN) || (chroma_keyword == NULL))
    return Y4M_ERR_HEADER;
  if (_y4mparam_feature_level < 1) {
    if ((i->chroma != Y4M_CHROMA_420JPEG) &&
	(i->chroma != Y4M_CHROMA_420MPEG2) &&
	(i->chroma != Y4M_CHROMA_420PALDV))
      return Y4M_ERR_FEATURE;
    if (i->interlace == Y4M_ILACE_MIXED)
      return Y4M_ERR_FEATURE;
  }
  y4m_ratio_reduce(&rate);
  y4m_ratio_reduce(&aspect);
  n = snprintf(s, sizeof(s), "%s W%d H%d F%d:%d I%s A%d:%d C%s",
	       Y4M_MAGIC,
	       i->width,
	       i->height,
	       rate.n, rate.d,
	       (i->interlace == Y4M_ILACE_NONE) ? "p" :
	       (i->interlace == Y4M_ILACE_TOP_FIRST) ? "t" :
	       (i->interlace == Y4M_ILACE_BOTTOM_FIRST) ? "b" :
	       (i->interlace == Y4M_ILACE_MIXED) ? "m" : "?",
	       aspect.n, aspect.d,
	       chroma_keyword
	       );
  if ((n < 0) || (n > Y4M_LINE_MAX)) return Y4M_ERR_HEADER;
  if ((err = y4m_snprint_xtags(s + n, sizeof(s) - n - 1, &(i->x_tags))) 
      != Y4M_OK) 
    return err;
  /* non-zero on error */
  return (y4m_write_cb(fd, s, strlen(s)) ? Y4M_ERR_SYSTEM : Y4M_OK);
}
Esempio n. 5
0
void ysSource::describe_keywords(FILE *fp, const char *prefix) const 
{
  fprintf(fp, "%sactive=WxH+X+Y\n", prefix);
  fprintf(fp, "%smatte=WxH+X+Y\n", prefix);
  {
    ysYCbCr defbg(default_bgcolor());
    fprintf(fp, "%sbg=[ RGB:r,g,b | YCBCR:y,cb,cr |\n", prefix);
    fprintf(fp, "%s     RGBA:r,g,b,a | YCBCR:y,cb,cr,a ] (YCBCRA:%d,%d,%d,%d)\n",
	    prefix, defbg(0), defbg(1), defbg(2), defbg(3));
  }
  fprintf(fp, "%snorm=[ NTSC | PAL | SECAM ]\n", prefix);
  fprintf(fp, "%silace=[ NONE | TOP_FIRST | BOTTOM_FIRST | TOP_ONLY | BOTTOM_ONLY ]\n", prefix);
  {
    fprintf(fp, "%schromass=[ ", prefix);
    int i = 0;
    const char *keyword;
    while ((keyword = y4m_chroma_keyword(i++)) != NULL)
      fprintf(fp, "%s%s ", (i < 2) ? "" : "| ", keyword);
    fprintf(fp, "]\n");
  }
  fprintf(fp, "%ssar=[ N:D | NTSC | PAL | NTSC_WIDE | PAL_WIDE ]\n", prefix);
}