| | |
| | | |
| | | 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_; |
| | | |
| | |
| | | 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()); |
| | |
| | | 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(){ |