Techniques for seamlessly inserting a second compressed video
stream (e.g., for an advertisement) into a first compressed video
stream (e.g., for a program video), which can be implemented in an ad
insertion processor that typically includes a real time
encoder (e.g., an MPEG
encoder), a buffer, a profiler, a
multiplexer, and a splicer. The profiler receives the first compressed video
stream and provides a “profile” for the stream, which may include
bit rate and other information about the stream. The real time
encoder receives and encodes a second video in accordance with a particular encoding scheme to generate the second compressed video stream. The real time encoder further controls the encoding of the second
video based at least in part on the profile of the first compressed video stream such that the profiles for the two streams are approximately similar at the point in time the second stream is inserted into the first stream. The buffer stores the first compressed video stream from the real time encoder until it is needed. The
multiplexer inserts the second compressed video stream into the first compressed video stream, and the splicer splices the two streams together to form the output video stream.