video analysis2.0拆分,ffmpeg封装go接口库
zhangmeng
2023-12-26 18a05d269516a5e33d8460291c2f93e73d95adce
csrc/ffmpeg/format/FormatOut.cpp
@@ -107,8 +107,8 @@
        enc_ctx_->codec_id = AV_CODEC_ID_H264;
        enc_ctx_->codec_type = AVMEDIA_TYPE_VIDEO;
        enc_ctx_->height = (prop.height_ & 0x01) ? prop.height_-1 : prop.height_;
        enc_ctx_->width = (prop.width_ & 0x01) ? prop.width_ - 1 : prop.width_;
        enc_ctx_->height = prop.height_ & ~0x01;
        enc_ctx_->width = prop.width_ & ~0x01;
        enc_ctx_->sample_aspect_ratio = prop.sample_aspect_ratio_;
        
@@ -182,7 +182,7 @@
        av_opt_set(enc_ctx_->priv_data, "tune", "zerolatency", 0);
        av_opt_set(enc_ctx_->priv_data, "profile", "baseline", 0);
    
        int err =avcodec_open2(enc_ctx_, codec, NULL);
        int err = avcodec_open2(enc_ctx_, codec, NULL);
        if( err< 0)
        {
            logIt("can't open output codec: %s", getAVErrorDesc(err).c_str());
@@ -194,14 +194,11 @@
            return false;
        }
        ofmt->video_codec = codec_id;
        if(ofmt->flags & AVFMT_GLOBALHEADER)
        {
        if(ofmt->flags & AVFMT_GLOBALHEADER){
            enc_ctx_->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
        }
        return true;
   }
   
    AVStream *FormatOut::getStream(){