日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ffmpeg H264 编解码配置

發布時間:2025/3/20 编程问答 54 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ffmpeg H264 编解码配置 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

ffmpeg H264編解碼前面有文章介紹下,本文主要介紹一些參數配置。

編碼:

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,可提高解碼速度(低延時)。

?視頻教程 播放地址: http://www.iqiyi.com/u/1426749687

轉載于:https://www.cnblogs.com/wanggang123/p/6346787.html

總結

以上是生活随笔為你收集整理的ffmpeg H264 编解码配置的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。