[Live-devel] openRTSP woes
Ross Finlayson
finlayson at live555.com
Tue May 19 15:52:31 PDT 2009
>The second issue that we have run into is with audio/video sync.
>Right now, at the beginning of many of the recorded files, we are
>seeing very fast video with normal speed audio which I think is the
>culprit. This lasts for less than a second. (Using the -y flag
>seems to help but it throws away audio data making our audio very
>bad) Is it possible this occurs until the first keyframe is seen?
>
>We are encoding at full resolution and full framerate from these cams:
>
>openRTSP -q -f 30 -w 1280 -h 720 -t -Q -b 2000000
>rtsp://10.10.10.10/axis-media/media.amp?videocodec=h264&resolution=1280x720&audio=1&duration=0&fps=30&videobitrate=10000&videomaxbitrate=10000&videobitratepriority=framerate&videokeyframeinterval=2&compression=10&color=1&clock=0&date=0&text=0
First, you should make sure that you are seeing properly synced audio
and video when you play the stream directly, using (e.g.) VLC. If
(for whatever reason) you're not getting A/V sync when you play the
stream directly, then you will never be able to get A/V sync when you
record the data into a file.
Second, it's important to realize that the ".mov" (or ".mp4") file
format is badly designed, and is poorly suited for recording live
input streams (like these). One basic problem with the file format
is that it records audio/video data using sample/frame *durations*,
rather than timestamps (or presentation times). This makes it very
difficult to keep audio/video data in sync, if the input data is
synchronized using presentation times, as is the case for incoming
RTP/RTCP data. Because of this, the current implementation of
writing ".mov" or ".mp4" files is - and will likely always remain -
an unreliable hack.
If you want to have any chance of A/V sync working when writing
".mov" or ".mp4" files, then you *must* use the "-y" option. This
may lose a small amount of initial data (until RTCP synchronization
begins), but that's unavoidable.
If you really want to look at the appropriate code for this, then the
class to look at is "QuickTimeFileSync".
--
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
More information about the live-devel
mailing list