Suppose I have H.264 AnxB frames coming from a real-time conversation. What is the best way to encapsulate an MPEG2 transport stream while storing time information for later playback?
I use the libavcodec and libavformat libraries. When I get a pointer to an object (* pcc) of type AVCodecContext, I set foll.
pcc->codec_id = CODEC_ID_H264;
pcc->bit_rate = br;
pcc->width = 640;
pcc->height = 480;
pcc->time_base.num = 1;
pcc->time_base.den = fps;
When I get NAL units, I create an AVPacket and call av_interleaved_write_frame ().
AVPacket pkt;
av_init_packet( &pkt );
pkt.flags |= AV_PKT_FLAG_KEY;
pkt.stream_index = pst->index;
pkt.data = (uint8_t*)p_NALunit;
pkt.size = len;
pkt.dts = AV_NOPTS_VALUE;
pkt.pts = AV_NOPTS_VALUE;
av_interleaved_write_frame( fc, &pkt );
I basically have two questions:
1) For variable frame rates, there is a way to not specify foll. pcc-> time_base.num = 1; pcc-> time_base.den = fps; and replace it with something to indicate a variable frame rate?
2) , " "
pkt.dts pkt.pts?
, ffplay, (fps), .
, . , , SPS PPS. , .
pcc- > width = 640; pcc- > height = 480;
? , , .
,