Encapsulating H.264 variable frame rate in MPEG2 transport stream

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; ? , , .

,

+5
1

DTS PTS 90 . . 2.4.3.6 1 ISO 13818 .

, (vui_parameters.fixed_frame_rate_flag = 0). , , . PTS DTS. mplayer , ffmpeg.

, , (nal_unit_type 10 11) . ( , ).

0

All Articles