ffmpeg H264 编解码配置
2017-09-29 00:00
295 查看
ffmpeg H264编解码前面有文章介绍下,本文主要介绍一些参数配置。
编码:
解码:
编码codec 的time_base实际上表示视频的帧率,qmin,qmax决定了编码的质量,qmin,qmax越大编码的质量越差。zerolatency参数的作用是提搞编码的实时性。解码codec 加上CODEC_FLAG_LOW_DELAY,可提高解码速度(低延时)。
如需交流请加qq群流媒体/Ffmpeg/音视频 127903734 ,或加QQ350197870。
编码:
int InitEncoderCodec( int iWidth, int iHeight) { AVCodec * pH264Codec = avcodec_find_encoder(AV_CODEC_ID_H264); if(NULL == pH264Codec) { printf("%s", "avcodec_find_encoder failed"); return -1; } outPutEncContext = avcodec_alloc_context3(pH264Codec); outPutEncContext->gop_size = 30; outPutEncContext->has_b_frames = 0; outPutEncContext->max_b_frames = 0; outPutEncContext->codec_id = pH264Codec->id; outPutEncContext->time_base.num = 2; outPutEncContext->time_base.den = 15; outPutEncContext->pix_fmt = *pH264Codec->pix_fmts; outPutEncContext->width = iWidth; outPutEncContext->height = iHeight; outPutEncContext->qmin = 34; outPutEncContext->qmax = 50; AVDictionary *options = nullptr; outPutEncContext->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; av_opt_set(outPutEncContext->priv_data,"tune","zerolatency",0); av_dict_set(&options,"preset","ultrafast",0); int ret = avcodec_open2(outPutEncContext, pH264Codec, &options); if (ret < 0) { printf("%s", "open codec failed"); return ret; } return 1; }
解码:
codecContext->flags |=CODEC_FLAG_LOW_DELAY;
编码codec 的time_base实际上表示视频的帧率,qmin,qmax决定了编码的质量,qmin,qmax越大编码的质量越差。zerolatency参数的作用是提搞编码的实时性。解码codec 加上CODEC_FLAG_LOW_DELAY,可提高解码速度(低延时)。
如需交流请加qq群流媒体/Ffmpeg/音视频 127903734 ,或加QQ350197870。
相关文章推荐
- Android FFMpeg(三)——使用FFMpeg解码h264、aac
- 用ffmpeg把H264数据流解码成YUV420P
- ffmpeg h264解码, 屏蔽因为网络丢包等各种原因导致的花屏帧
- ffmpeg 解码 H264源码分析
- ffmpeg编译,解码 H264
- Live555接收h264使用ffmpeg解码为YUV420 .
- FFmpeg解码H264及swscale缩放详解
- ffmpeg 解码h264数据
- FFmpeg解码H264及swscale缩放详解
- 嵌入式linux------ffmpeg移植 解码H264(am335x解码H264到yuv420并通过SDL显示)
- 移植ffmpeg中的H264解码部分到Android
- ffmpeg对avs,h264编解码的支持
- Live555 + h264 + ffmpeg 客户端解码 笔记
- 嵌入式linux------ffmpeg移植 解码H264(am335x解码H264到yuv420并通过SDL显示) 分类: arm-linux-Ubuntu TI-AM335X ffmpeg-SDL-VLC-Live555 2015-07-29 10:28 154人阅读 评论(0) 收藏
- ffmpeg-1.0 解码 H264 (example修改成功)
- FFmpeg解码H264及swscale缩放详解
- ffmpeg 解码H264裸数据流
- H.264 代码下载,以及配置为FFMPEG的解码库
- Live555接收h264使用ffmpeg解码为YUV420
- 嵌入式linux------ffmpeg移植 解码H264(am335x解码H264到yuv420并通过SDL显示)