I have noticed that Wowza video-on-demand begins video playback at the first keyframe, rather than the actual start of the file, but audio begins at the start regardless of keyframe. This creates sync issues. For example, in our workflow we might:
live stream and record for two hours at our desired streaming settings (frame rate 30, keyframe every 150 frames)
use QuickTime Pro to delete the first 30 minutes from the resulting file (maybe this was just padding before our event, or maybe there were consecutive events recorded to one file, and we want to stream the second event on-demand)
use QuickTime Pro to quickly export the trimmed video to a MP4 container (passing through the existing video/audio rather than re-exporting)
copy this MP4 to a streaming server for on-demand streaming
When streamed on-demand in Wowza (by any method, either RTMP, RTSP, or HTTP), the audio and video begin simultaneously when you hit play, but audio starts precisely from the trim point, while the video starts from the first keyframe (which might be up to 5 seconds later). So the audio and video are out of sync.
This does not happen when streaming the same file through Darwin streaming server (RTSP) – the first few seconds might show “green” video until the first keyframe comes, but the video and audio are in sync.
(Sorry for the lack of demo files/streams to illustrate this – I can provide some later if necessary.)
I have tried to work around this issue by trimming exactly to a keyframe point instead of an arbitrary time (using MPEG Streamclip, which is the only free software I know which locates keyframe times), but this doesn’t help us when we record two video sources for parallel streaming playback in a SMIL file (for example, a camera feed next to a laptop feed). Even though both source streams/files get the same specified frame and keyframe rates in the encoder (Wirecast or QuickTime Broadcaster), no encoder seems able to maintain a precise enough frame rate to keep the keyframes aligned across the two files, even just for a few minutes. (Again, Darwin Streaming Server has no problem streaming two files in parallel in SMIL with different keyframe intervals – green video is simply shown whenever starting or seeking at a non-keyframe point.)
Is there any way to correct this behavior in Wowza, just for RTSP? I know I could re-encode the trimmed video to create new keyframes, but that can take a lot of time and will degrade the video quality. I haven’t had a chance to look yet, but I’m guessing this throws off parallel SMIL sync in Wowza even when I don’t trim the beginning of the files.