ffmpeg编码h264只包含I帧P帧的方法

简介: ffmpeg使用avcodc_encode_video编码,默认产生的h264包含B帧,在安防行业很多地方是不需要用到B帧的。   1.基础知识充电 这就涉及到h264的各种profile格式了,参考 h264各种profile h264分4种等级(profile):Baseline、Main、Extended、High Baseline profile:支持I帧P帧 Main profile:支持I/P/B/SP/SI帧 Extended profile:支持I/P/B帧 High profile:。

ffmpeg使用avcodc_encode_video编码,默认产生的h264包含B帧,在安防行业很多地方是不需要用到B帧的。

 

1.基础知识充电

这就涉及到h264的各种profile格式了,参考

h264各种profile

h264分4种等级(profile):Baseline、Main、Extended、High

Baseline profile:支持I帧P帧

Main profile:支持I/P/B/SP/SI帧

Extended profile:支持I/P/B帧

High profile:。。。。。。

 

2.实战验证

将h264写成文件,使用H264Visa播放,在SummImfo-》Stream信息中,确实是:Stream Type:High Profile @Level 31

 

3.锁定问题

现在的问题就是,如何让ffmpeg编码时,编码出来baseline等级?

 

4.解决办法:

打开编码器之前先设置成baseline

[cpp]  view plain  copy
 
  1. AVDictionary *opts = NULL;  
  2.   
  3. av_dict_set(&opts,"profile","baseline");  
  4.   
  5. if(avcodec_open2(pCtxEnc,pCodecEnc,&opts)<0)  
  6.   
  7. {  
  8.   
  9. //return;  
  10.   
  11. }  
目录
相关文章
|
1月前
|
存储 编解码 数据处理
【FFmpeg 视频基本格式】深入理解FFmpeg:从YUV到PCM,解码到编码(三)
【FFmpeg 视频基本格式】深入理解FFmpeg:从YUV到PCM,解码到编码
36 0
|
1月前
|
存储 编解码 数据处理
【FFmpeg 视频基本格式】深入理解FFmpeg:从YUV到PCM,解码到编码(二)
【FFmpeg 视频基本格式】深入理解FFmpeg:从YUV到PCM,解码到编码
40 0
|
3月前
ffmpeg 命令提取音视频数据-ffmpeg导出h265裸流-ffmpeg导出h264裸流
ffmpeg 命令提取音视频数据-ffmpeg导出h265裸流-ffmpeg导出h264裸流
67 0
|
1月前
|
存储 缓存 编解码
【FFmpeg 视频基本格式】深入理解FFmpeg:从YUV到PCM,解码到编码(一)
【FFmpeg 视频基本格式】深入理解FFmpeg:从YUV到PCM,解码到编码
44 0
|
3月前
|
编解码 并行计算
ffmpeg cuda加速 h264->hevc(h265) 缩小存储空间
ffmpeg cuda加速 h264->hevc(h265) 缩小存储空间
53 0
|
8月前
ffmpeg编码报错:more samples than frame size (avcodec_encode_audio2)
ffmpeg编码报错:more samples than frame size (avcodec_encode_audio2)
50 0
ffmpeg编码报错:more samples than frame size (avcodec_encode_audio2)
|
存储 编解码 C++
FFmpeg连载5-音视频编码
ffmpeg连载系列
109 0
|
编解码
ffmpeg编码格式转换
ffmpeg编码格式转换
371 0
FFMPEG最简解码H264(NVIDIA硬解)
FFMPEG最简解码H264(NVIDIA硬解)
280 0
ffmpeg把YUV转换为H264
ffmpeg把YUV转换为H264
101 0