Hello everyone,
In the beginning, we use libortp to implement our rtsp server.
Unfortunately, libortp costs too much cpu resource when we send rtp packet.
So, I'm planing to porting our code to new library, libffmpeg.
RTSP server would be included rtsp, rtp and rtcp protocols.
Rtsp protocol has been done in our server and we don't need the rtcp
protocol.
Last rtp, I initial rtp protocol by rtp container like below.
ff.oc = avformat_alloc_context();
ff.fmt = av_guess_format("rtp", NULL, NULL);
ff.oc->oformat = ff.fmt;
video_st = av_new_stream(ff->oc, VIDEO_INDEX);
oVcc = video_st->codec;
oVcc->codec_id = CODEC_ID_H264;
oVcc->codec_type = CODEC_TYPE_VIDEO;
oVcc->bit_rate = 2048 * 1024;
oVcc->width = 640;
oVcc->height = 480;
oVcc->time_base.den = 30;
oVcc->time_base.num = 1;
oVcc->gop_size = 30;
oVcc->pix_fmt = PIX_FMT_YUV420P;
oVcc->max_b_frames = 0;
oVcc->priv_data = 0;
Then, I send rtp out.
AVPacket sePacket;
av_init_packet(&sePacket);
sePacket.flags |= PKT_FLAG_KEY;
sePacket.stream_index = VIDEO_INDEX;
sePacket.data = pSrc;
sePacket.size = left;
sePacket.pts = 0;
av_write_frame(ff->oc, &sePacket);
av_free_packet(&sePacket);
Actually, VLC can receive the rtp data I send.
But VLC can not decode it.
My question is:
1. the pSrc is totally H264 data, should I do something before calling
av_write_frame???
2. Who has the sample code or any suggestion, please help me out??
Thanks a lot.
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user