[Libav-user] HOW to control TS streaming speed?

Li Zhang lizhang at utelisys.com
Tue Apr 24 10:41:41 CEST 2012


Hi all,


I used the ffmpeg lib to transcode mpeg2 to H264 in TS container.  After that, I send them to a UDP address which was open using avio_open(). Now I used a thread to decode and another thread to encode. At the same time I used the third thread to send data packet using av_interleaved_write_frame().

However, I am not clear how I should control the sending.

1. Now, the sending stream can be played normally using VLC in windows system only lose several audio packets at the beginning. But if I play it in Linux system (ubuntu), it will lose lots of audio data in buffer and finally sounds not very nice. This information was found in VLC tools->statistics.  I do not know why? Is it possible that VLC in windows can adjust its buffer size adaptively?

2. I knew that the packet loss is caused by bad sending controlling tricks. So does anyone can give me some suggestions about the sending controlling?

3. I also knew that ffmpeg and VLC have solved this problem in their source code. But I can not find out where these code locates in.  Does anyone can give me any indication?


Thanks in advance.

Best regards,

Li


More information about the Libav-user mailing list