ffmpeg将yuv封装为mp4测试代码

#include <stdio.h>
#include <conio.h>

extern "C"{
#include "inttypes.h"  
#include "libavcodec/avcodec.h"  
#include "libavformat/avformat.h"  
#include "libavfilter/avfiltergraph.h"  
#include "libavfilter/buffersink.h"  
#include "libavfilter/buffersrc.h"  
#include "libavutil/avutil.h"  
#include "libswscale/swscale.h"
#include "libswresample/swresample.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "libavutil/mathematics.h"
#include "libavutil/timestamp.h"
};

#define HAVE_VIDEO		1			
#define ENCODE_VIDEO	1 << 1		
#define HAVE_AUDIO		1 << 2		
#define ENCODE_AUDIO	1 << 3	
#define STREAM_DURATION   10.0
#define STREAM_FRAME_RATE 25 
#define SCALE_FLAGS SWS_BICUBIC
#pragma   warning(disable: 4996)
#define errReport(info, val) do{ \
	fprintf(stderr, "ERR(func=%s,line=%d): %s code=%d\n",__FUNCTION__, __LINE__, info, val);\
	getch();\
	exit(0);\
}while (0);

typedef struct{
	const char *input_file_name;	
	const char *output_file_name;
	int frame_width;				
	int frame_height;				
} IOParam;

typedef struct{
	AVStream *st;
	int64_t next_pts;
	int samples_count;
	AVFrame *frame;
	AVFrame *tmp_frame;

	float t, tincr, tincr2;
	struct SwsContext *sws_ctx;
	struct SwrContext *swr_ctx;
} OutputStream;

FILE *g_inputYUVFile = NULL;
void add_stream(OutputStream *ost, AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id){
	AVCodecContext *c;
	int i;
	*codec = avcodec_find_encoder(codec_id);
	if (!(*codec)) errReport("avcodec_find_encoder", -1);

	ost->st = avformat_new_stream(oc, *codec);
	if (!ost->st)  errReport("avformat_new_stream", -1);

	ost->st->id = oc->nb_streams - 1;
	c = ost->st->codec;
	switch ((*codec)->type){
	case AVMEDIA_TYPE_AUDIO:
		c->sample_fmt = (*codec)->sample_fmts ? (*codec)->sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
		c->bit_rate = 64000;
		c->sample_rate = 44100;
		if ((*codec)->supported_samplerates){
			c->sample_rate = (*codec)->supported_samplerates[0];
			for (i = 0; (*codec)->supported_samplerates[i]; i++){
				if ((*codec)->supported_samplerates[i] == 44100)
					c->sample_rate = 44100;
			}
		}
		c->channels = av_get_channel_layout_nb_channels(c->channel_layout);
		c->channel_layout = AV_CH_LAYOUT_STEREO;
		if ((*codec)->channel_layouts){
			c->channel_layout = (*codec)->channel_layouts[0];
			for (i = 0; (*codec)->channel_layouts[i]; i++){
				if ((*codec)->channel_layouts[i] == AV_CH_LAYOUT_STEREO)
					c->channel_layout = AV_CH_LAYOUT_STEREO;
			}
		}
		c->channels = av_get_channel_layout_nb_channels(c->channel_layout);{
			AVRational r = { 1, c->sample_rate };
			ost->st->time_base = r;
		}
		break;
	case AVMEDIA_TYPE_VIDEO:
		c->codec_id = codec_id;
		c->bit_rate = 400000;
		c->width = 352;
		c->height = 288;
		{
			AVRational r = { 1, STREAM_FRAME_RATE };
			ost->st->time_base = r;
		}
		c->time_base = ost->st->time_base;
		c->gop_size = 12; 
		c->pix_fmt = AV_PIX_FMT_YUV420P;
		if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO)	c->max_b_frames = 2;
		if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO)	c->mb_decision = 2;
		break;
	default:
		break;
	}
	/* Some formats want stream headers to be separate. */
	if (oc->oformat->flags & AVFMT_GLOBALHEADER)
		c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
}

int Add_audio_video_streams(OutputStream *video_st, OutputStream *audio_st, AVFormatContext *oc, 
						AVOutputFormat *fmt, AVCodec *audio_codec, AVCodec *video_codec, IOParam &io){
	int ret = 0;
	if (fmt->video_codec != AV_CODEC_ID_NONE){
		add_stream(video_st, oc, &video_codec, fmt->video_codec);
		video_st->st->codec->width = io.frame_width;
		video_st->st->codec->height = io.frame_height;
		ret |= HAVE_VIDEO;
		ret |= ENCODE_VIDEO;
	}
	if (fmt->audio_codec != AV_CODEC_ID_NONE){
		add_stream(audio_st, oc, &audio_codec, fmt->audio_codec);
		ret |= HAVE_AUDIO;
		ret |= ENCODE_AUDIO;
	}
	return ret;
}

void Close_stream(AVFormatContext *oc, OutputStream *ost){
	avcodec_close(ost->st->codec);
	av_frame_free(&ost->frame);
	av_frame_free(&ost->tmp_frame);
	sws_freeContext(ost->sws_ctx);
	swr_free(&ost->swr_ctx);
}

AVFrame *alloc_picture(enum AVPixelFormat pix_fmt, int width, int height){
	AVFrame *picture;
	int ret;
	picture = av_frame_alloc();
	if (!picture)	return NULL;

	picture->format = pix_fmt;
	picture->width = width;
	picture->height = height;
	ret = av_frame_get_buffer(picture, 32);
	if (ret < 0)	errReport("av_frame_get_buffer", ret);
	return picture;
}

void Open_video(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg, IOParam &io){
	int ret;
	AVCodecContext *c = ost->st->codec;
	AVDictionary *opt = NULL;
	av_dict_copy(&opt, opt_arg, 0);
	ret = avcodec_open2(c, codec, &opt);
	if (ret < 0)	errReport("avcodec_open2", ret);

	av_dict_free(&opt);
	ost->frame = alloc_picture(c->pix_fmt, c->width, c->height);
	if (!ost->frame)	errReport("alloc_picture", -1);

	fopen_s(&g_inputYUVFile, io.input_file_name, "rb+");
	if (g_inputYUVFile == NULL)	errReport("Open input yuv file failed.", -1);
}

int write_frame(AVFormatContext *fmt_ctx, const AVRational *time_base, AVStream *st, AVPacket *pkt){
	av_packet_rescale_ts(pkt, *time_base, st->time_base);
	pkt->stream_index = st->index;
	//	log_packet(fmt_ctx, pkt);
	return av_interleaved_write_frame(fmt_ctx, pkt);
}

void fill_yuv_image(AVFrame *pict, int frame_index, int width, int height){
	int x, y, i, ret = av_frame_make_writable(pict);
	if (ret < 0)	errReport("av_frame_make_writable", ret);
	i = frame_index;
	for (y = 0; y < height; y++){ /* Y */
		ret = fread_s(&pict->data[0][y * pict->linesize[0]], pict->linesize[0], 1, width, g_inputYUVFile);
		if (ret != width)  errReport("y: fread_s", ret);
	}
	for (y = 0; y < height / 2; y++){/* U */
		ret = fread_s(&pict->data[1][y * pict->linesize[1]], pict->linesize[1], 1, width / 2, g_inputYUVFile);
		if (ret != width / 2)  errReport("u: fread_s", ret);
	}
	for (y = 0; y < height / 2; y++){/* V */
		ret = fread_s(&pict->data[2][y * pict->linesize[2]], pict->linesize[2], 1, width / 2, g_inputYUVFile);
		if (ret != width / 2)  errReport("v: fread_s", ret);
	}
}

AVFrame *get_video_frame(OutputStream *ost){
	AVCodecContext *c = ost->st->codec;
	AVRational r = { 1, 1 };
	if (av_compare_ts(ost->next_pts, ost->st->codec->time_base, STREAM_DURATION, r) >= 0)
		return NULL;
	fill_yuv_image(ost->frame, ost->next_pts, c->width, c->height);
	ost->frame->pts = ost->next_pts++;
	return ost->frame;
}

int Write_video_frame(AVFormatContext *oc, OutputStream *ost){
	int ret, got_packet = 0;
	AVCodecContext *c;
	AVFrame *frame;
	AVPacket pkt = { 0 };
	c = ost->st->codec;
	frame = get_video_frame(ost);
	av_init_packet(&pkt);
	ret = avcodec_encode_video2(c, &pkt, frame, &got_packet);
	if (ret < 0)	errReport("avcodec_encode_video2", ret);
	if (got_packet)
		ret = write_frame(oc, &c->time_base, ost->st, &pkt);
	else
		ret = 0;
	if (ret < 0)  errReport("write_frame", ret);
	return (frame || got_packet) ? 0 : 1;
}

AVFrame *alloc_audio_frame(enum AVSampleFormat sample_fmt, uint64_t channel_layout, int sample_rate, int nb_samples){
	AVFrame *frame = av_frame_alloc();
	if (!frame)	errReport("av_frame_alloc", -1);
	frame->format = sample_fmt;
	frame->channel_layout = channel_layout;
	frame->sample_rate = sample_rate;
	frame->nb_samples = nb_samples;
	if (nb_samples){
		int ret = av_frame_get_buffer(frame, 0);
		if (ret < 0)	errReport("av_frame_get_buffer", ret);
	}
	return frame;
}

void Open_audio(AVFormatContext *oc, AVCodec *codec, OutputStream *ost, AVDictionary *opt_arg){
	AVCodecContext *c;
	int nb_samples, ret;
	AVDictionary *opt = NULL;
	c = ost->st->codec;
	av_dict_copy(&opt, opt_arg, 0);
	ret = avcodec_open2(c, codec, &opt);
	av_dict_free(&opt);
	if (ret < 0)  errReport("avcodec_open2", ret);
	/* init signal generator */
	ost->t = 0;
	ost->tincr = 2 * M_PI * 110.0 / c->sample_rate;
	/* increment frequency by 110 Hz per second */
	ost->tincr2 = 2 * M_PI * 110.0 / c->sample_rate / c->sample_rate;
	if (c->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE)
		nb_samples = 10000;
	else
		nb_samples = c->frame_size;
	ost->frame = alloc_audio_frame(c->sample_fmt, c->channel_layout, c->sample_rate, nb_samples);
	ost->tmp_frame = alloc_audio_frame(AV_SAMPLE_FMT_S16, c->channel_layout, c->sample_rate, nb_samples);
	/* create resampler context */
	ost->swr_ctx = swr_alloc();
	if (!ost->swr_ctx)  errReport("swr_alloc", ret);
	/* set options */
	av_opt_set_int(ost->swr_ctx, "in_channel_count", c->channels, 0);
	av_opt_set_int(ost->swr_ctx, "in_sample_rate", c->sample_rate, 0);
	av_opt_set_sample_fmt(ost->swr_ctx, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0);
	av_opt_set_int(ost->swr_ctx, "out_channel_count", c->channels, 0);
	av_opt_set_int(ost->swr_ctx, "out_sample_rate", c->sample_rate, 0);
	av_opt_set_sample_fmt(ost->swr_ctx, "out_sample_fmt", c->sample_fmt, 0);
	/* initialize the resampling context */
	if ((ret = swr_init(ost->swr_ctx)) < 0)   errReport("swr_init", ret);
}

AVFrame *get_audio_frame(OutputStream *ost){
	AVFrame *frame = ost->tmp_frame;
	int j, i, v;
	int16_t *q = (int16_t*)frame->data[0];
	AVRational r = { 1, 1 };
	/* check if we want to generate more frames */
	if (av_compare_ts(ost->next_pts, ost->st->codec->time_base, STREAM_DURATION, r) >= 0)
		return NULL;
	for (j = 0; j < frame->nb_samples; j++){
		v = (int)(sin(ost->t) * 10000);
		for (i = 0; i < ost->st->codec->channels; i++)
			*q++ = v;
		ost->t += ost->tincr;
		ost->tincr += ost->tincr2;
	}
	frame->pts = ost->next_pts;
	ost->next_pts += frame->nb_samples;
	return frame;
}

int Write_audio_frame(AVFormatContext *oc, OutputStream *ost){
	AVCodecContext *c;
	AVPacket pkt = { 0 }; // data and size must be 0;
	AVFrame *frame;
	int ret, got_packet, dst_nb_samples;
	av_init_packet(&pkt);
	c = ost->st->codec;
	frame = get_audio_frame(ost);
	if (frame){
		dst_nb_samples = av_rescale_rnd(swr_get_delay(ost->swr_ctx, c->sample_rate) + frame->nb_samples, c->sample_rate, c->sample_rate, AV_ROUND_UP);
		av_assert0(dst_nb_samples == frame->nb_samples);
		ret = av_frame_make_writable(ost->frame);
		if (ret < 0) errReport("av_frame_make_writable", ret);
		ret = swr_convert(ost->swr_ctx,ost->frame->data, dst_nb_samples,
						(const uint8_t **)frame->data, frame->nb_samples);
		if (ret < 0)	errReport("swr_convert", ret);
		frame = ost->frame;
		AVRational r = { 1, c->sample_rate };
		frame->pts = av_rescale_q(ost->samples_count, r, c->time_base);
		ost->samples_count += dst_nb_samples;
	}
	ret = avcodec_encode_audio2(c, &pkt, frame, &got_packet);
	if (ret < 0)  errReport("avcodec_encode_audio2", ret);
	if (got_packet){
		ret = write_frame(oc, &c->time_base, ost->st, &pkt);
		if (ret < 0)  errReport("write_frame", ret);
	}
	return (frame || got_packet) ? 0 : 1;
}

int Open_coder_muxer(AVOutputFormat **fmt, AVFormatContext **oc, const char *filename){
	av_register_all();
	avformat_alloc_output_context2(oc, NULL, NULL, filename);
	if (!oc){
		printf("Could not deduce output format from file extension: using MPEG.\n");
		avformat_alloc_output_context2(oc, NULL, "mpeg", filename);
		if (!oc)	return -1;
	}
	*fmt = (*oc)->oformat;
	return 0;
}

int main(){
	AVDictionary *opt = NULL;
	IOParam io = {NULL};
	int ret;
	int have_video = 0, have_audio = 0;
	int encode_video = 0, encode_audio = 0;
	int videoFrameIdx = 0, audioFrameIdx = 0;
	OutputStream video_st = { 0 }, audio_st = { 0 };
	AVOutputFormat *fmt;
	AVFormatContext *oc;
	AVCodec *audio_codec = NULL, *video_codec = NULL;
	io.output_file_name = "out.mp4";
	io.input_file_name = "walk.yuv";
	io.frame_width = 176;
	io.frame_height = 144;

	if(Open_coder_muxer(&fmt, &oc, io.output_file_name) < 0) 
		errReport("Open_coder_muxer", -1);

	ret = Add_audio_video_streams(&video_st, &audio_st, oc, fmt, audio_codec, video_codec, io);
	have_video = ret & HAVE_VIDEO;
	encode_video = ret & ENCODE_VIDEO;
	have_audio = ret & HAVE_AUDIO;
	encode_audio = ret & ENCODE_AUDIO;

	if (have_video)	Open_video(oc, video_codec, &video_st, opt, io);
	if (have_audio)	Open_audio(oc, audio_codec, &audio_st, opt);
		
	av_dump_format(oc, 0, io.output_file_name, 1);
	if (!(fmt->flags & AVFMT_NOFILE)){
		ret = avio_open(&oc->pb, io.output_file_name, AVIO_FLAG_WRITE);
		if (ret < 0)	errReport("avio_open", ret);
	}
	ret = avformat_write_header(oc, &opt);
	if (ret < 0)  errReport("avformat_write_header", ret);

	while (encode_video || encode_audio) {
		if (encode_video && (!encode_audio || av_compare_ts(video_st.next_pts, 
		video_st.st->codec->time_base, audio_st.next_pts, audio_st.st->codec->time_base) <= 0)){
			encode_video = !Write_video_frame(oc, &video_st);
			if (videoFrameIdx % 3 == 0) printf("\n");
			if (encode_video)
				printf("v:%d ", videoFrameIdx++);
			else
				printf("Video ended, exit.\n");
		}
		else {
			encode_audio = !Write_audio_frame(oc, &audio_st);
			if (encode_audio)
				printf("a:%d ", audioFrameIdx++);
			else
				printf("Audio ended, exit.\n");
		}
	}
	av_write_trailer(oc);
	if (have_video)	Close_stream(oc, &video_st);	
	if (have_audio)	Close_stream(oc, &audio_st);
	if (!(fmt->flags & AVFMT_NOFILE))  avio_closep(&oc->pb);
	avformat_free_context(oc);
	printf("Procssing succeeded.\n");
	getch();
	return 0;
}

结果:

[libx264 @ 01e04fc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP
FMA4 FMA3 LZCNT BMI1
[libx264 @ 01e04fc0] profile High, level 1.3
[libx264 @ 01e04fc0] 264 - core 148 r2665 a01e339 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
ma_qp_offset=-2 threads=4 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
nterlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=12 keyint_min=1 scenecut
=40 intra_refresh=0 rc_lookahead=12 rc=abr mbtree=1 bitrate=400 ratetol=1.0 qcom
p=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':
    Stream #0:0: Video: h264 (libx264), yuv420p, 176x144, q=-1--1, 400 kb/s, 25
tbn, 25 tbc
    Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 64 kb/s

v:0 a:0 a:1 v:1 a:2 a:3 v:2 a:4 a:5
v:3 a:6 v:4 a:7 a:8 v:5 a:9 a:10
v:6 a:11 a:12 v:7 a:13 v:8 a:14 a:15
v:9 a:16 a:17 v:10 a:18 v:11 a:19 a:20
v:12 a:21 a:22 v:13 a:23 a:24 v:14 a:25
v:15 a:26 a:27 v:16 a:28 a:29 v:17 a:30 a:31
v:18 a:32 v:19 a:33 a:34 v:20 a:35 a:36
v:21 a:37 v:22 a:38 a:39 v:23 a:40 a:41
v:24 a:42 a:43 v:25 a:44 v:26 a:45 a:46
v:27 a:47 a:48 v:28 a:49 v:29 a:50 a:51
v:30 a:52 a:53 v:31 a:54 a:55 v:32 a:56
v:33 a:57 a:58 v:34 a:59 a:60 v:35 a:61 a:62
v:36 a:63 v:37 a:64 a:65 v:38 a:66 a:67
v:39 a:68 v:40 a:69 a:70 v:41 a:71 a:72
v:42 a:73 a:74 v:43 a:75 v:44 a:76 a:77
v:45 a:78 a:79 v:46 a:80 v:47 a:81 a:82
v:48 a:83 a:84 v:49 a:85 a:86 v:50 a:87
v:51 a:88 a:89 v:52 a:90 a:91 v:53 a:92 a:93
v:54 a:94 v:55 a:95 a:96 v:56 a:97 a:98
v:57 a:99 v:58 a:100 a:101 v:59 a:102 a:103
v:60 a:104 a:105 v:61 a:106 v:62 a:107 a:108
v:63 a:109 a:110 v:64 a:111 v:65 a:112 a:113
v:66 a:114 a:115 v:67 a:116 a:117 v:68 a:118
v:69 a:119 a:120 v:70 a:121 a:122 v:71 a:123 a:124
v:72 a:125 v:73 a:126 a:127 v:74 a:128 a:129
v:75 a:130 v:76 a:131 a:132 v:77 a:133 a:134
v:78 a:135 a:136 v:79 a:137 v:80 a:138 a:139
v:81 a:140 a:141 v:82 a:142 v:83 a:143 a:144
v:84 a:145 a:146 v:85 a:147 a:148 v:86 a:149
v:87 a:150 a:151 v:88 a:152 a:153 v:89 a:154 a:155
v:90 a:156 v:91 a:157 a:158 v:92 a:159 a:160
v:93 a:161 v:94 a:162 a:163 v:95 a:164 a:165
v:96 a:166 a:167 v:97 a:168 v:98 a:169 a:170
v:99 a:171 a:172 v:100 a:173 v:101 a:174 a:175
v:102 a:176 a:177 v:103 a:178 a:179 v:104 a:180
v:105 a:181 a:182 v:106 a:183 a:184 v:107 a:185 a:186
v:108 a:187 v:109 a:188 a:189 v:110 a:190 a:191
v:111 a:192 v:112 a:193 a:194 v:113 a:195 a:196
v:114 a:197 a:198 v:115 a:199 v:116 a:200 a:201
v:117 a:202 a:203 v:118 a:204 v:119 a:205 a:206
v:120 a:207 a:208 v:121 a:209 a:210 v:122 a:211
v:123 a:212 a:213 v:124 a:214 a:215 v:125 a:216 a:217
v:126 a:218 v:127 a:219 a:220 v:128 a:221 a:222
v:129 a:223 v:130 a:224 a:225 v:131 a:226 a:227
v:132 a:228 a:229 v:133 a:230 v:134 a:231 a:232
v:135 a:233 a:234 v:136 a:235 a:236 v:137 a:237
v:138 a:238 a:239 v:139 a:240 a:241 v:140 a:242
v:141 a:243 a:244 v:142 a:245 a:246 v:143 a:247 a:248
v:144 a:249 v:145 a:250 a:251 v:146 a:252 a:253
v:147 a:254 v:148 a:255 a:256 v:149 a:257 a:258
v:150 a:259 a:260 v:151 a:261 v:152 a:262 a:263
v:153 a:264 a:265 v:154 a:266 a:267 v:155 a:268
v:156 a:269 a:270 v:157 a:271 a:272 v:158 a:273
v:159 a:274 a:275 v:160 a:276 a:277 v:161 a:278 a:279
v:162 a:280 v:163 a:281 a:282 v:164 a:283 a:284
v:165 a:285 v:166 a:286 a:287 v:167 a:288 a:289
v:168 a:290 a:291 v:169 a:292 v:170 a:293 a:294
v:171 a:295 a:296 v:172 a:297 a:298 v:173 a:299
v:174 a:300 a:301 v:175 a:302 a:303 v:176 a:304
v:177 a:305 a:306 v:178 a:307 a:308 v:179 a:309 a:310
v:180 a:311 v:181 a:312 a:313 v:182 a:314 a:315
v:183 a:316 v:184 a:317 a:318 v:185 a:319 a:320
v:186 a:321 a:322 v:187 a:323 v:188 a:324 a:325
v:189 a:326 a:327 v:190 a:328 a:329 v:191 a:330
v:192 a:331 a:332 v:193 a:333 a:334 v:194 a:335
v:195 a:336 a:337 v:196 a:338 a:339 v:197 a:340 a:341
v:198 a:342 v:199 a:343 a:344 v:200 a:345 a:346
v:201 a:347 v:202 a:348 a:349 v:203 a:350 a:351
v:204 a:352 a:353 v:205 a:354 v:206 a:355 a:356
v:207 a:357 a:358 v:208 a:359 a:360 v:209 a:361
v:210 a:362 a:363 v:211 a:364 a:365 v:212 a:366
v:213 a:367 a:368 v:214 a:369 a:370 v:215 a:371 a:372
v:216 a:373 v:217 a:374 a:375 v:218 a:376 a:377
v:219 a:378 v:220 a:379 a:380 v:221 a:381 a:382
v:222 a:383 a:384 v:223 a:385 v:224 a:386 a:387
v:225 a:388 a:389 v:226 a:390 a:391 v:227 a:392
v:228 a:393 a:394 v:229 a:395 a:396 v:230 a:397
v:231 a:398 a:399 v:232 a:400 a:401 v:233 a:402 a:403
v:234 a:404 v:235 a:405 a:406 v:236 a:407 a:408
v:237 a:409 v:238 a:410 a:411 v:239 a:412 a:413
v:240 a:414 a:415 v:241 a:416 v:242 a:417 a:418
v:243 a:419 a:420 v:244 a:421 a:422 v:245 a:423
v:246 a:424 a:425 v:247 a:426 a:427 v:248 a:428
v:249 a:429 a:430 v:250 v:251
v:252 v:253 v:254
v:255 v:256 v:257
v:258 v:259 v:260
v:261 v:262 v:263
v:264 v:265 v:266
v:267 v:268 v:269
Video ended, exit.
a:431 a:432 Audio ended, exit.
[libx264 @ 01e04fc0] frame I:21    Avg QP:20.89  size:  6258
[libx264 @ 01e04fc0] frame P:140   Avg QP:23.57  size:  2203
[libx264 @ 01e04fc0] frame B:89    Avg QP:26.97  size:   710
[libx264 @ 01e04fc0] consecutive B-frames: 28.8% 71.2%  0.0%  0.0%
[libx264 @ 01e04fc0] mb I  I16..4:  1.9% 50.7% 47.4%
[libx264 @ 01e04fc0] mb P  I16..4:  0.1%  1.7%  1.2%  P16..4: 28.0% 37.0% 30.1%
 0.0%  0.0%    skip: 1.9%
[libx264 @ 01e04fc0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 39.7% 22.8%  9.5%
 direct: 7.0%  skip:20.9%  L0:27.2% L1:31.9% BI:40.9%
[libx264 @ 01e04fc0] final ratefactor: 18.58
[libx264 @ 01e04fc0] 8x8 transform intra:51.5% inter:50.8%
[libx264 @ 01e04fc0] coded y,uvDC,uvAC intra: 96.6% 96.0% 88.2% inter: 55.0% 47.
7% 12.7%
[libx264 @ 01e04fc0] i16 v,h,dc,p: 10% 23% 12% 55%
[libx264 @ 01e04fc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 21% 12%  4%  7% 10%  6%
 7%  9%
[libx264 @ 01e04fc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 15%  9%  4% 13% 12% 10%
 7%  7%
[libx264 @ 01e04fc0] i8c dc,h,v,p: 50% 16% 26%  7%
[libx264 @ 01e04fc0] Weighted P-Frames: Y:48.6% UV:15.7%
[libx264 @ 01e04fc0] ref P L0: 64.8% 23.0%  9.0%  2.6%  0.6%
[libx264 @ 01e04fc0] ref B L0: 95.5%  4.5%
[libx264 @ 01e04fc0] kb/s:402.40
[aac @ 01e058e0] Qavg: 355.671
Procssing succeeded.


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值