Trouble syncing libavformat/ffmpeg with x264 and RTP

后端 未结 1 647
萌比男神i
萌比男神i 2021-02-04 16:35

I\'ve been working on some streaming software that takes live feeds from various kinds of cameras and streams over the network using H.264. To accomplish this, I\'m using the x2

1条回答
  •  情歌与酒
    2021-02-04 17:08

    1) You didn't set PTS for frames you send to libx264 (you probably should see "non-strictly-monotonic PTS" warnings) 2) You didn't set PTS/DTS for packets you send to libavformat's rtp muxer (I not 100% sure it need to be set but I guess it would be better. From source code it looks like rtp use PTS). 3) IMHO usleep(33333) is bad. It cause encoder to stall this time also (increasing latency) while you could encode next frame during this time even if you still don't need to send it by rtp.

    P.S. btw you didn't set param.rc.i_rc_method to X264_RC_ABR so libx264 will use CRF 23 instead and ignore your "param.rc.i_bitrate = BITRATE". Also it can be good idea to use VBV when encoding for network sending.

    0 讨论(0)
提交回复
热议问题