FFmpeg音视频核心技术精讲与实战

一、日志:
    <libavutil/log.h>头文件
    av_set_log_level();  AV_LOG_DEBUG/AV_LOG_INFO/AV_LOG_WARNING/AV_LOG_ERROR
    av_log();
二、文件删除和重命名:
    avpriv_io_delete();
    avpriv_io_move();
三、操作目录
    avio_open_dir();
    avio_read_dir();
    avio_close_dir();
    AVIODirContext --> 操作目录的上下文
    AVIODirEntry   --> 目录项。用于存放文件名,文件大小等信息
四、多媒体文件的基本概念
    每种流是由不同的编码器编码的
    从流中读出的数据称为包
    在一个包中有一个或者多个帧
    
    重要结构体
        AVFormatContext
        AVStream(Track)
        AVPacket
    
    操作流数据的基本步骤
        (1)解复用 --> 打开容器
        (2)获取流
        (3)读数据包
        (4)释放资源
五、打印音/视频信息
    av_register_all();
    avformat_open_input()/avformat_close_input();
    av_dump_format();
六、抽取音频数据
    av_init_packet();
    av_find_best_stream();
    av_read_frame()/av_packet_unref()
七、抽取视频数据(H264)
    start code --> 00 00 00 01 或者 00 00 01
    SPS/PPS
    codec->extradata
八、将MP4转成flv格式
    avformat_alloc_output_context2()/avformat_free_context();
    avformat_new_stream();
    avcodec_parameters_copy();
    
    avformat_write_header();
    av_write_frame()/av_interleaved_write_frame();
    av_write_trailer();
九、从MP4截取一段视频
    av_seek_frame();
十、H264解码
    常用数据结构
       AVCodec        编码器结构体
       AVCodecContext 编码器上下文
       AVFrame        解码后的帧
    结构体内存的分配和释放
       av_frame_alloc/av_frame_free();
       avcodec_alloc_context3();
       avcodec_free_context();
    解码步骤:
       查找解码器(avcodec_find_decoder)
       打开解码器(avcodec_open2)
       解码(avcodec_decode_video2)
十一、H264编码流程
    查找编码器(avcodec_find_encoder_by_name)
    设置编码参数,并打开编码器(avcodec_open2)
    编码(avcodec_encode_video2)
    

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值