[FFmpeg-devel] H264 encoding and RTP muxing - calculating pts and dts

Luca Abeni lucabe72
Tue Jul 20 13:35:19 CEST 2010


Hi,

I think this is a libav-user question, anyway...
On 07/20/2010 12:56 PM, Dominik Tomczak wrote:
> Hello
>
> My application uses libav libaries to encode frames with H264 and mux them
> using RTP. The sequence is
>
> int encodedBytes = avcodec_encode_video
> if (encodedBytes>  0)
> {
> AVPacket packet;
> ...
>
> av_interleaved_write_frame(&packet)
> }
>
> I get the video frames in RGB from my web camera, convert it to YUV but I
> don't know how to set DTS and PTS values for packet.
You can use the video4linux2 input, and it will generate proper timestamps
for the input frames; then, the H264 encoder will generate proper PTSs and
DTSs based on the input timestamps, and you can use them for the RTP muxer.

This basically is what ffmpeg.c does, and it works fairly well (just tested).


				Luca



More information about the ffmpeg-devel mailing list