| | |
| | | logIt("Failed to copy context from input to output stream codec context\n"); |
| | | return false; |
| | | } |
| | | out_stream->codecpar->codec_tag = out_stream->codec->codec_tag = 0; |
| | | out_stream->codecpar->codec_tag = 0; |
| | | |
| | | if(ctx_->oformat->flags & AVFMT_GLOBALHEADER) |
| | | out_stream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; |
| | |
| | | int out_idx = -1; |
| | | std::vector<AVStream*> in_streams{in_v_stream_, in_a_stream_}; |
| | | for (auto i : in_streams){ |
| | | if (i->index == pkt->stream_index){ |
| | | if (i && (i->index == pkt->stream_index)){ |
| | | if (i->codecpar->codec_type == AVMEDIA_TYPE_VIDEO){ |
| | | out_idx = v_idx_; |
| | | in_stream = i; |
| | |
| | | pkt->pts = pkt->dts = pkt->duration * time_stamp; |
| | | |
| | | } |
| | | // logIt("BEFORE in stream timebase %d:%d, out timebase %d:%d, |
| | | // pts: %lld, dts: %lld, duration: %lld", |
| | | // in_stream->time_base.num, in_stream->time_base.den, |
| | | // out_stream->time_base.num, out_stream->time_base.den, |
| | | // pkt->pts, pkt->dts, pkt->duration); |
| | | |
| | | } |
| | | |
| | | bool FormatOut::writeFrame(AVPacket *pkt, const int64_t &frame_cnt, |