[FFmpeg-user] RTP decoded video plays too fast

Hooman Fazaeli hoomanfazaeli at gmail.com
Mon Feb 5 18:55:13 EET 2018


I am developing a SIP call recording app. To save conversations as
playable media files, I has done the following:

1.  Track SIP dialogs and save RTP media streams into custom .rtp
files. The files have a header which contains stream encoding
information (extracted
form SDP payloads) followed by the RTP packets itself, saved consecutively and
preceded w/ a 2 byte length field.

2. Developed a custom AVInputFormat. The format reads .rtp file header in its
read_header method and sets stream codec and its parameters. It also
creates RTPDemuxContext and RTPDynamicProtocolHandler instances. In
its read_packet method, the format reads rtp packets and passes them
to rtp demuxer.

3. To convert .rtp files to playable media, I use a simple command like below:

    > ffmpeg -i vp8-video.rtp vp8-video.flv

The output contains the video as expected but it plays almost 2 times
faster in VLC and widows media player. The problem exists w/ other
output formats such as .avi or .mp4, too.

Can anybody suggest what is going wrong? As RTP packets contain timing
information, why ffmpeg decodes them in a faster rate? How I can fix the problem
w/o using PTS filters?

NOTE: The trans-coded audio streams do not have this problem and play
w/ right speed.

More information about the ffmpeg-user mailing list