enc.c~

来自「linux 或者arm动态连接库的调用」· C~ 代码 · 共 47 行

C~
47
字号
//#include <unistd.h>
//#include "mpeg4ip.h"
//#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>

#include <fcntl.h>
#include <math.h>
#include <time.h>
#include "include/encore.h"

int main(int argc, char** argv)
{
	/* variables controlable from command line */
	unsigned int bitRate = 500000;			/* --bitrate=<uint> */
	unsigned int frameWidth = 320;			/* --width=<uint> */
	unsigned int frameHeight = 240;		/* --height=<uint> */
	float frameRate = 30.0;			/* --rate=<float> */
	unsigned int iFrameFrequency = 10;		/* --ifrequency=<uint> */

	ENC_PARAM encParams;
			
	// initialize encoder 
	encParams.x_dim = frameWidth;
	encParams.y_dim = frameHeight;
	encParams.framerate = frameRate;
	encParams.bitrate = bitRate;
	encParams.rc_period = 2000;
	encParams.rc_reaction_period = 10;
	encParams.rc_reaction_ratio = 20;
	encParams.max_key_interval = iFrameFrequency;

	if (encore(stdin, ENC_OPT_INIT, &encParams, NULL) != ENC_OK) {
		fprintf(stderr, 
			" error: can't initialize encoder\n"
			);
		exit(5);
	}

	// cleanup最后的释放 
	encore(stdin, ENC_OPT_RELEASE, NULL, NULL);
	
	return(0);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?