Abstract:
A method for assembling multimedia streams enables assembly of any of a number of possible output multimedia streams from segments of source multimedia streams. Enabling assembly of the streams includes computing stream fragments for insertion between successive of the segments to form any of the output streams. According to such a method, computation required for creating transition points in source MPEG streams can be largely performed as a preprocess that produces data that can be stored for use in later assembling a stream, assembly of a stream requires relatively little computation and can be implemented using relatively inexpensive equipment, for example, in software.

Description:
BACKGROUND  
         [0001]    This invention relates to assembly of multimedia content.  
           [0002]    The MPEG (Motion Picture Expert Group) standards include specifications for the format of multimedia streams. One aspect of the specifications is for compressed encoding of video streams. Another aspect of the specification is for a transport stream that carries video and audio streams for programs. Such transport streams are often used to deliver television programming in cable television systems.  
           [0003]    Various approaches have been proposed for splicing MPEG streams. In general, such approaches require processing the streams when the splice is made. Some approaches to splicing compressed MPEG video streams involve decoding and then re-encoding portions of the streams to form the splice. Some approaches to splicing of MPEG streams involve modifying the steams and creating allowable points at which transitions may be made.  
         SUMMARY  
         [0004]    In one aspect, in general, a method for assembling multimedia streams enables assembly of any of a number of possible output multimedia streams from segments of source multimedia streams. Enabling assembly of the streams includes computing stream fragments for insertion between successive of the segments to form any of the output streams.  
           [0005]    The method can include one or more of the following features:  
           [0006]    The method includes determining the segments of the source streams from desired presentation time boundaries for those segments.  
           [0007]    At least some of the stream fragments are stored prior to assembly.  
           [0008]    The stream fragments are stored in a disk storage.  
           [0009]    The stream fragments are for concatenation between successive segments.  
           [0010]    The stream fragments are for concatenation without modification to form any of the output streams.  
           [0011]    Each of the source multimedia streams, each of the output multimedia streams, and each of the stream fragments include temporally encoded streams, such as MPEG streams.  
           [0012]    Each of the MPEG streams includes an MPEG transport stream.  
           [0013]    The output streams include video streams such that each video stream encodes a presentation of a continuous sequence of video frames.  
           [0014]    The video streams avoid overflow or underflow of a Video Buffer Verifier model.  
           [0015]    The method further includes assembling a first of the output multimedia streams from a series of the segments.  
           [0016]    Computing the stream fragments is performed prior to assembling transitions between segments of the first output stream.  
           [0017]    Computing the stream fragments is performed independently of assembling the first output stream.  
           [0018]    At least some of the stream fragments are stored, and assembling the first output stream includes retrieving those fragments.  
           [0019]    Assembling the first output stream includes inserting one or more of the stream fragments between each successive pair of the segments in the series.  
           [0020]    Inserting the stream fragments between each successive pair of segments includes inserting the two stream fragments between said segments.  
           [0021]    Assembly of the output stream includes concatenating the two stream fragments.  
           [0022]    A second of the output multimedia streams is assembled from a series of segments.  
           [0023]    At least some of the computed stream fragments are inserted into both the first output stream and the second output stream.  
           [0024]    A first set of the output multimedia streams is assembled and at least some of the computed stream fragments are not used in assembling any of the streams of that first set.  
           [0025]    Enabling assembly of any of the output streams includes enabling assembly of a succession of any of a first set of the stream segments and any of a second set of stream segments.  
           [0026]    Computing the stream fragments includes computing stream fragments each associated with a transition from a different one of the first set of segments, and computing stream fragments each associated with a transition to a different one of the second set of stream segments.  
           [0027]    In another aspect, in general, the invention features method for dynamic assembly of multimedia streams. Information for each of a set of replacement segments is stored, including for each replacement segment, a stream fragment associated with the beginning of the replacement segment and a stream fragment associated with the end of the replacement segment. For each of one or more original segments of a source multimedia stream, the original segment is replaced with one of the stored replacement segments. Replacing the segment includes inserting a stream fragment associated with each of the original segment and the replacement segment at each transition between the source stream and the replacement segment.  
           [0028]    In another aspect, in general, the invention features a method for assembling a multimedia stream. The method includes identifying transition points in one or more multimedia streams. This includes identifying a first transition point in a first of the streams and a second transition point in a second of the streams. Stream fragments each associated with one of the transition points in the streams are computed. This includes computing a first stream fragment associated with the first transition point in the first stream and computing a second stream fragment associated with the second transition point in the second stream. The multimedia stream is assembled from a number of elements, which include, a portion of the first stream prior to a first transition point, the first stream fragment, the second stream fragment, and a portion of the second stream following the second of the transition point.  
           [0029]    Among the advantages of the invention are one or more of the following:  
           [0030]    Because computation required for creating transition points in source MPEG streams can be largely performed as a preprocess that produces data that can be stored for use in later assembling a stream, assembly of a stream requires relatively little computation and can be implemented using relatively inexpensive equipment, for example, in software.  
           [0031]    The computation of the fragments can be performed independently of assembling the transitions, therefore the computation can be performed earlier or on a different computer than used for the assembly process.  
           [0032]    The same precomputed fragments can be used to assemble different output streams, thereby reducing the total amount of computation.  
           [0033]    The approach provides an economical way to replace or insert advertising in a television program. Because of the low complexity of inserting an advertising segment, a large number of different advertising streams can be economically provided.  
           [0034]    In a system in which multiple different streams are delivered to different subscribers, such as in a video-on-demand system, the invention provides a way of economically assembling the streams for different subscribers. For example, each video-on-demand stream may have a different set of advertising inserted into it that may be specifically targeted to the subscriber.  
           [0035]    The approach avoids underflow of a decoder buffer when presenting the assembled stream. Objectionable artifacts that result from underflow in some decoder implementations can be avoided.  
           [0036]    The approach enables a “coherent” stream to be assembled such that video picture presentation is continuous and regular at expected intervals across transitions between any combination of source segments.  
           [0037]    The approach can be applied to source multimedia streams that have not necessarily been prepared or modified to facilitate forming of transitions, and can be used to allow additional transition points in which some allowable transition points have previously been created.  
           [0038]    Other features and advantages of the invention are apparent from the following description, and from the claims. 
       
    
    
     DESCRIPTION OF DRAWINGS  
       [0039]    [0039]FIG. 1 is a diagram that illustrates assembly of a multimedia transport stream;  
         [0040]    [0040]FIG. 2 is a diagram that illustrates an out-transition fragment;  
         [0041]    [0041]FIG. 3 is a diagram that illustrates an in-transition fragment;  
         [0042]    [0042]FIG. 4 is a diagram that illustrates MPEG frames in a video stream of an out-transition fragment;  
         [0043]    [0043]FIG. 5 is a diagram that illustrates MPEG frames in a video stream of an in-transition fragment;  
         [0044]    [0044]FIG. 6 is a diagram that illustrates transport stream packets near a boundary between an out-transition fragment and an in-transition fragment;  
         [0045]    [0045]FIG. 7 is a diagram that illustrates delivery and presentation timing of frames near a boundary between an out-transition fragment and an in-transition fragment;  
         [0046]    [0046]FIG. 8 is a system block diagram;  
         [0047]    [0047]FIG. 9 is a diagram that illustrates an advertising insertion procedure;  
         [0048]    [0048]FIG. 10 is a block diagram of a set-top box; and  
         [0049]    [0049]FIG. 11 is a diagram that illustrates an advertisement replacement system. 
     
    
     DESCRIPTION  
       [0050]    1Content Assembly with Transition Fragments  
         [0051]    Referring to FIG. 1, an approach to multimedia content assembly involves combining segments of a number of source MPEG transport streams to form a new assembled MPEG transport stream. In FIG. 1, three MPEG transport streams are illustrated with the delivery time of the streams flowing from left to right (the delivery times for the different streams are not aligned). These include two source streams, TS A    110  and TS B    130 , and a new (assembled) stream TS A-B    150 . Combining desired segments of the source streams involves switching from one source stream to another during the assembly process. In the vicinity of a transition from source stream TS A    110  to source stream TS B    130 , new stream TS A-B    150  includes:  
         [0052]    (1) a segment  112  of transport stream TS A    110  that approximately corresponds to content that would have been presented up to a desired presentation “out time” t A    118  in that stream,  
         [0053]    (2) a transition portion  152 , which when decoded and presented results in a short black interval, and  
         [0054]    (3) a segment  132  of transport stream TS B    130  that approximately corresponds to content that would have been presented starting at a desired presentation “in time” t B    138  in that stream.  
         [0055]    The transition portion that is inserted between the two source transport streams results in a presentation interval that is viewed for a short time between the source streams. For example, in a transition from a television program to a commercial, a brief interval of black video and silent audio is presented. Also, the source streams are not necessarily switched at frames that correspond exactly to the desired in and out times.  
         [0056]    As a first step of assembling transport stream TS A-B    150  at a transition from stream TS A    110  to stream TS B    130 , the desired out time t A    118  and in time t B    138  are mapped to offsets in the transport streams (e.g., byte offsets relative to the start of the steam) that are associated with those times. These desired transition times (the in and out times) therefore determine the endpoints of the segments of the streams that will form the transition and the endpoints of the segments approximately correspond to these desired transition times. In this example, out time t A    118  is mapped to an offset d A    116  in stream TS A    110  and in time t B    138  is mapped to an offset d B    136  in stream TS B    130 . A discussion of this mapping procedure is deferred until later in this description.  
         [0057]    Transition portion  152  is made up of a concatenation of an out-transition fragment  120 , which is associated with an “out” transition at offset d A    116  in TS A    110  to another stream, and an in-transition fragment  140 , which is associated with a transition from another stream to TS B    130  at offset d B    136 .  
         [0058]    Out-transition fragment  120  for TS A  is pre-computed independent of the assembly processes, and is formatted as a transport stream such that a switching from TS A    110  at offset d A    116  to out-transition fragment  120  does not disrupt the formatting of the resulting transport stream. That is, various level of packet and frame structure in the transport stream remain properly formatted as the transport stream is switched at offset d A    116  without requiring examination of the content of the stream at the time of assembly. This proper formatting ensures that an MPEG compliant decoder receiving transport stream TS A-B  should be able to correctly decode and present the assembled program.  
         [0059]    In-transition fragment  140  is also pre-computed independent of the assembly processes, and is formatted as a transport stream such that switching from out transition fragment  120 , or in general switching from any similarly constructed out transition fragment corresponding to a different out point, to in-transition fragment  140  also does not disrupt the formatting of the resulting transport stream.  
         [0060]    In the new transport stream TS A-B    150 , in-transition fragment  140  is concatenated after out-transition fragment  120 , and then portion  132  of TS B    130  is concatenated after the transition fragments. This resulting transport stream TS A-B    150  is a compliant MPEG transport stream. As is discussed further below, compliance includes the assembled video streams satisfying a standard video buffer verifier (VBV) model, thereby ensuring that a MPEG compliant video decoder that receives the assembled video stream should not overflow or underflow. Compliance also includes ensuring the assembled stream contains no video discontinuities.  
         [0061]    Together, the concatenation of out-transition fragment  120  and in-transition fragment  140  form a transition fragment that joins the desired portions  112  and  132  of the original streams. Note that simple abutting of portions  112  and  132  of the source transport streams would not generally form a valid MPEG transport stream. For example, at offset d A    116  in TS A    110  there are in general a number of partial packets and frames which would not be completed appropriately in portion  132  of TS B    130  which follows offset  136 . Furthermore, even if the packet and frame structure were valid after concatenation, there would be a possibility that a decoder receiving the stream would suffer from buffer over- or under-flow because the encoder that generated desired portion  132  assumed a different state of the decoder at the start of that portion.  
         [0062]    Referring to FIG. 2, an MPEG encoded program  210 , which is carried in transport stream TS A    110 , is typically made up of a number of elementary streams (ES). For example, a television program typically includes a video elementary stream, and one or more audio elementary streams. In FIG. 2, a representative pair of streams is illustrated as a video stream ES A1    212  and an audio stream ES A2    222  along a time axis corresponding to the presentation time of the streams. Note that in general, an MPEG program may include additional elementary streams. For example, a number of different audio streams may each correspond to a different language or a different audio compression standard. Multiple video streams may correspond to different camera angles or to different aspect ratios.  
         [0063]    Elementary streams ES A1    212  and ES A2    222  are made up of a series of frames (not indicated in FIG. 2). The desired out time t A    110  is used to compute a frame offset f A1    218  in ES A1    212  and a frame offset f A2    228  in ES A2    222 . The details of this mapping process are deferred to later in this description. In FIG. 2, a portion  214  of ES A1    212  corresponds to encoded video of program  210  that is retained in the assembled stream, and portion  216  of ES A2    222  corresponds to video that is not retained if the transition is used. Similarly, a portion  224  corresponds to audio of program  210  that is retained, and a portion  226  corresponds to audio that is not retained if the transition is used.  
         [0064]    The elementary streams for program  210  are carried in corresponding packetized elementary streams (PES)  230 . Packetized elementary streams PES A1    232  and PES A2    242  carry elementary video stream ES A1    212  and audio stream ES A2    222 , respectively. Each packetized elementary stream is made up of a series of packets, which typically have variable length. As illustrated, PES A1    232  includes a series of packets  234 A-D and PES A2    242  includes a series of packets  244 A-D. Each PES packet includes a header (not illustrated) and a payload that carries the data for the corresponding elementary stream. The header of each packet indicates the size of the packet and optionally includes timing information that identifies the presentation time and delivery time of the frames in that packet.  
         [0065]    When transport streams are received at a decoder, the elementary audio and video streams are buffered and delivered to their respective decoders after a delay, which is in general time varying and different for each elementary stream. The delay for video data is typically longer than for audio data, therefore the video data prior to out frame f A1    218  occurs at a data offset  238  in PES A1    232 , which is delivered earlier than data offset  248  of PES A2    242 , which corresponds to out frame f A2    228 . Note that as illustrated, and in general, the out frames do not occur at boundaries of PES packets. As illustrated, data offset  238  occurs part way through PES packet  234 B, and data offset  248  occurs part way through PES packet  244 C.  
         [0066]    The packetized elementary streams for a program are multiplexed into a series of fixed length (188 byte) transport packets to form transport stream TS A    110  for the program. Each TS packet has a short header and a payload. Each PES packet is transported in the payload portion of multiple transport stream (TS) packets, and packets from different PES streams are interleaved in different TS packets. The start of each PES packet starts at the beginning of a corresponding TS packet payload.  
         [0067]    The start of PES packet  234 B, which is the PES packet containing the start of out frame f A1    218 , occurs at d A    116  in TS A    110 , and the start of PES packet  244 C, which contains the start of out frame f A2    228 , occurs at data offset  266  in TS A    110 . Data offset d A    116  is chosen to be the start of a TS packet such that the TS packets that carries the starts of PES packets  234 B and  244 C occur no earlier than d A    116 .  
         [0068]    The portion of TS A    110  starting at d A    116  includes a sequence of TS packets  250 A-M. In this example, packets  250 A-B contains an initial portion of PES packet  234 B that corresponds to video prior to out frame f A1    218 . Packet  250 C and  250 F include an initial portion of PES packet  244 C, which corresponds to audio prior to out frame f A2    228 . Packet  250 D includes the start of out frame f A1    218  and therefore includes data that are not retained in the assembled stream if this transition point is used. Such a packet that includes the start of out frame f A1    218  may also includes data for video frames prior to f A1    218 , as is illustrated in the figure, that are retained in the assembled stream. Packets  250 E, G, J, K, and M includes data for video frames in or after f A1    218 . Packet  250 L includes audio frames that are in or after f A2    228 .  
         [0069]    Assembly occurs at the transport stream level without requiring interpretation at the PES or ES level at the time the new stream is being assembled. Out-transition fragment  120  is aligned to a boundary of a TS packet, and is formed of an integral number of complete TS packets  260 A-M. New PES streams  270  are formed by replacing TS packets starting at packet  250 A in TS A    110  with TS packets  260 A-M of out-transition fragment  120 . A PES stream PES A′1    272  forms part of the new video stream (ending part way through a transition) and stream PES A′2    282  forms part of the new audio stream. PES A′1    272  carries a copy of the complete original PES packet  234 A of PES A1 ,  232 , and some number of new PES packets, illustrated as new PES packets  274 A and  274 B. PES A′2    282  carries copies of the complete original PES packets  244 A-B and some number of new PES packets, illustrated as new packet  284 A. Out-transition fragment  120  is constructed such that there is no partially delivered PES packet when the last byte of the out-transition fragment has been delivered.  
         [0070]    Out-transition fragment  120  typically includes data in audio and video frames from ES A1    212  and ES A2    222  that have presentation times prior to out frames f A1    218  and f A2    228 , respectively, but that occur after offset d A    116  in transport stream TS A    110 .  
         [0071]    Out-transition fragment  120  generally carries at least one newly constructed PES packet for each PES stream. As illustrated, out-transition fragment  120  includes two PES packets  274 A-B for PES stream PES A′1    272  and one new PES packet  284 A for PES stream PES A′2    282 . PES packet  274 A includes an initial portion that carries data of video source PES packet  234 B that have presentation times prior to out frame f A1    218 . This initial portion ends at offset  278  in PES A′1    272 .  
         [0072]    The remaining portions of PES stream PES A′1    272 , which occurs starting at offset  278  and ends in the out-transition fragment  120 , carries video data that will be presented in the transition between source programs. This video data carries black frames. The audio stream is terminated after out frame f A2    228 , which results in an audio decoder underflowing during the transition period and therefore presenting silence to the viewer. The frames and PES and TS packets are formed such that after the end of out-transition fragment  120  is delivered, a video buffer verifier model of a decoder is in a known state with respect to the number of buffered (delivered but not yet presented) video frames and the amount of data buffered to represent the buffered frames. This procedure includes adding a number of null packets to the end of out-transition fragment  120  (null packets are not shown) in order to control the end of the deliver time of the out-transition fragment. The computation of the number of null packets is discussed further below.  
         [0073]    Referring to FIG. 3, the program being switched to at a transition is also carried in layered PES and TS packets. Transport stream TS B    130  carries PES streams  330 , which carry elementary streams  310 . The desired in time t b    138  is mapped to in frames f B1    318  and f B2    328  for elementary streams ES B1    312  and ES B2    322 , respectively. Packetized streams PES B1    332  and PES B2    342  carry PES frames  334 A-D and  344 A-D, respectively, and in frames f A1    318  and f A2    328  occur in PES packets  334 B and  344 B, respectively.  
         [0074]    In-offset d B    136  corresponds to the first byte of a TS packet of TS B    130  that occurs after the last TS packet that carries any data from the source stream that needs to be modified to achieve a valid transition. In this case, d B    136  occurs after the later of the TS packet carrying the last of PES packet  334 B and  344 B. As illustrated in FIG. 3, in-offset d B    136  is at the beginning of the first TS packet following the last TS packet that carries a PES packet which includes any data in frames prior to the in frame for the corresponding elementary stream.  
         [0075]    As with out-transition fragment  120 , in-transition fragment  140  includes an integral number of TS packets  360 A-H. These packets carry modified PES packets that contain the trailing portions of PES packets  334 B and  344 B such that when the in-transition fragment is concatenated with TS B    130  starting at offset d B    136 , the PES packet structure is valid. Concatenating the in-transition fragment and the out-transition fragment results in the last TS packet of the out-transition fragment being directly followed by the first TS packet of the in-transition fragment. The headers of PES packets  334 B and  344 B are modified in in-transition fragment  140  so that they correctly reflect the characteristics (e.g., the length and any time stamps) of the data in frames that present after f B1  and f B2 . For frames prior to in frames f B1  and f B2 , the in-transition carries PES packets  374  and  384 , which carry data for transition frames, as well as data in or after the in-frames. As is discussed further below, the transition frames are computed such that the decoder is in a known state just before delivery of in frames f B1  and f B2 , for instance, ensuring that the decoder buffer will neither overflow or underflow.  
         [0076]    2Transition Fragments  
         [0077]    As introduced above, out-transition fragments  120  and in-transition fragments  140  are pre-computed independently of the assembly process. Computation of a transition fragment includes processing the elementary streams at the frame level such that in any transition, a valid sequence of frames is delivered to a decoder receiving the stream.  
         [0078]    Referring to FIG. 4, a sequence of source video frames  420 , which is illustrated in the presentation order for those frames, is made up of different types of frames according to standard MPEG encoding. MPEG encoding involves a temporal encoding of a series of video pictures such that the encoding of one picture may depend of the encoding of one or more other pictures. In an MPEG encoding, I-frames each fully encodes a picture, while P- and B-frames are predictive in that each encodes a picture based on a difference from a number of preceding or following pictures. P-frames are forward predicted from a previous picture, which could be encoded in an I-frame or a P-frame. B-frames are bidirectionally predicted from an earlier and a later picture that is encoded in an I-frame or a P-frame.  
         [0079]    Elementary video stream ES A1    212 , which is illustrated in the delivery order, is grouped into subsequences of encoded frames, which are each called a Group of Pictures (GOP)  405 . A GOP  405  is made up of an initial I-frame followed by a number of P- and B-frames. The length of a GOP is flexible, but is generally 12-15 frames in length. The delivery order for video frames differs from the presentation order for the frames. In particular, B-frames are delayed and delivered only after the frames upon which they depend have already been delivered. For example, a presentation sequence I B B P is delivered as I P B B. This results in the first B-frames for one GOP potentially being presented before the initial I-frame of that GOP.  
         [0080]    A desired out time t A    118  is used to compute out frame f A1    218  that corresponds to a start of a GOP  405  by rounding to the nearest GOP. That is, the out time is mapped to the frame after the presentation of the last P-frame of a GOP, and before the presentation of any B-frames that are delivered in the next GOP. This requirement of mapping to GOP boundaries is relaxed in alternative versions of the system.  
         [0081]    New elementary stream ES A′1    430 , which corresponds to PES A′1    272  in FIG. 2, delivers the same sequence of frames up to out frame f A1    218  as ES A1    212 . These frames are followed by H black frames  410  that are encoded using an initial I-frame, I B , followed by a series of zero-motion P-frames, P z . The zero motion frames consume very little data to encode, for example on order hundreds of bytes, because the image is unchanged from the initial I-frame. The “hold” parameter H is common to all out-transition fragments. For example, H=3, is an example of a suitable choice for the hold parameter.  
         [0082]    In presentation order, the assembled sequence of video frames  440  ends in a P-frame, followed by H black frames encoded as an I-frame followed by H-1 zero-motion P-frames.  
         [0083]    Out-transition fragment  120  is padded with a number of null transport stream packets (not shown in FIG. 2 or FIG. 4) so that at the end of the delivery of the end of the out-transition fragment aligns approximately (to within plus or minus ½ the delivery time of an 188 byte TS packet) with a particular picture presentation time. This presentation time is chosen so that the H black frames are delivered but not yet presented at the decoder that has received the out-transition fragment. Note that at a data rate of 6 Mb/s, one TS packet is approximately 0.25 ms in duration, which is a small fraction of the typical frame presentation interval of 33.3 ms for television signals.  
         [0084]    In certain circumstances, out-transition fragment  120  cannot be padded in this way, for example, because the presentation of audio extends beyond the presentation of video. In such a case, one (or more if necessary) additional black frames, P z , which are in addition to the H pictures needed, are added before the out-transition fragment is padded. The stream is padded with null packets to ensure the conditions described above are met. In essence, if the audio overshoots the video, we add video until this is no longer the case and then proceed as before.  
         [0085]    Referring to FIG. 5, desired in-time t B    138  is mapped to an in-frame f B1    318  that corresponds to the start of a GOP  505  in elementary video stream ES B1    312 . Note that as discussed above, due to the out of order delivery of frames in ES B1    312 , the first I-frame following f B1    318  of the desired portion of the stream may be followed by a number of B-frames that depend on frames prior to f B1 . In-transition fragment  140  is constructed such that the resulting elementary video stream ES B′1    530  has a total of T-H black frames for presentation before the I-frame at in frame f B1  of ES B1    312 . These black frames are made up of one black I-frame, followed by a number of zero-motion P-frames. The “link broken” indicator in the GOP header associated with the I-frame is set so that a decoder can ignore the immediately following B-frames. In practice, video decoders do not necessarily ignore such B-frames following the broken link indicator. Therefore B-frames that are delivered just after the I-frame are replaced with B-frames that do not depend on a picture that would have been delivered before the B-frame. For instance, zero-motion B-frames that depend only on the I-frame are used.  
         [0086]    The parameter T depends on the particular stream ES B1    312  and the in-frame f B1    318 . In particular, T depends on the decoder delay at the time that the frame at in-frame f B1    318  would have been delivered in the original source stream ES B . The decoder delay is the difference between the delivery time of the frame at offset f B1  and the decoding time of that frame. The parameter T is an integer that is equal to the decoder delay divided by the frame presentation interval, rounded up to the next larger integer.  
         [0087]    A number of null transport stream packets (not shown in FIG. 5) are inserted after the T-H black frames and before the first I-frame of the desired portion. The number of these null packets is determined such that at the point after that the last of the T-H black frames are delivered and the first I-frame of the desired portion is to be delivered the decoder delay matches the decoder delay that would have been present in the original TS stream at the point that the first I-frame of the desired portion would have been delivered. By matching the decoder delay, the video buffer verifier (VBV) decoder model is guaranteed to be satisfied, and a decoder receiving the assembled stream should not underflow. In addition, because the black frames that are buffered at that point use less data to encode than the frames of the original stream that would have been buffered at that point, the decoder buffer is also guaranteed not to overflow.  
         [0088]    Referring to FIG. 6, the detailed timing near the transition between out-transition fragment  120  and in-transition fragment  140  involves padding the out-transition fragment with null TS packets. In-transition fragment  140  starts with a leader section of a number of TS packets. These packets include a Program Association Table (PAT) and Program Map Table (PMT) for the stream to which the transition is made. The T-H black frames form a GOP that is encoded in TS packets that follow the leader section. The GOP header includes the broken link indicator and indicating a time base discontinuity starting at that GOP.  
         [0089]    Recall that the video ES stream in the out-transition fragment finishes with H black MPEG frames, I B  P Z  . . . P Z . These black frames have time stamps in the time base of the source stream, TS A . Null packets are added to the end of the out-transition fragments so that the delivery time just after the delivery of the last byte of the last null packet, or equivalently, the delivery time of the first packet of the in-transition fragment, is equal to the presentation time of the first of the H black frames within a tolerance of plus or minus ½ a TS packet delivery time.  
         [0090]    In the in-transition fragment, a number of initial TS packets, in this embodiment 3 packets, form a leader section. The first of these packet indicates a change of time base to match TS B . This is followed by the TS packets that carry the T-H black frames, a number of null TS packets that are used to adjust the delivery time of the first I-frame, and the desired video frames of in-transition fragment  140 .  
         [0091]    The decoding time stamps (DTS) of the T-H black frames are computed from the decoding time of the first desired I-frame. To be precise, the decode time for the first of the T-H black frames is DTS[1]=DT−((T-H)*FT) and the presentation time stamps for the sequence to the T-H black frames are PTS[1]=DTS[1]+FT; DTS[2]=DTS[2]+FT and PTS[2]=DTS[2]+FT. In this notation, DTS[n] is the decoding time stamp of the n th  of T-H pictures, DT is the decoding time of the first picture in the source stream, and FT is the frame time. The frame time, FT, is expressed in a 90 Khz clock.  
         [0092]    Referring to FIG. 7, this change of time base affects the increment of the frame time (taking into account the change in time base) from the last of the H black frames of the out-transition fragment to the first of the T-H back frames of the intransition fragment. In FIG. 7, timeline  710  is associated with the delivery time in the first time base, and timeline  720  in the second time base. Similarly, timeline  730  is associated with the presentation time in the first time base, and timeline  740  is associated with the presentation time in the second time base. As illustrated, on delivery timeline  710 , the last desired frame  712  of the TS A    110  is followed by H black frames  714 . As discussed above, the delivery time of the beginning of the in-transition fragment is adjusted using null TS packets in the out-transition fragment such that the presentation time of the first of the H black transition frames  714  coincides with the start of the intransition fragment, plus or minus ½ a TS packet delivery time  735 . On delivery timeline  720 , the T-H black frames  722  have delivery times well within the first frame time following the transition (not drawn to scale) followed by delivery of the first desired frame  724  of TS B . Also as introduced above, the T-H black frames  722  in the in-transition fragment have presentation times that are equally spaced in increments of one frame time (e.g., 33.3 ms) to match the presentation time of the first frame following the black transition frames. Note that the presentation times of the T-H black frames do not in general fall on whole multiples of a frame time following the delivery time of the first byte of the in-transition fragment, therefore the actual frame time between the last of the H black frames and the first of the T-H black frames may deviate from a standard frame time by as much as one half TS packet time, e.g., 33.3 ms plus or minus 0.25 ms in a 6 Mbps stream.  
         [0093]    Fixed equal steps in presentation times for successive MPEG frames is not strictly required by the MPEG standard. However, in practice, some decoders cannot tolerate as a large deviation as 0.25 ms in one step. In an alternative embodiment in which video frames must be presented in exactly equal presentation time increments, the assembled transport stream is retimed by adjusting the time stamps in the stream during or after assembly.  
         [0094]    3 Stream End-Points  
         [0095]    Transition fragments are also computed at the beginning and end of source streams. For example, a source stream for an advertisement that is to be inserted into a program may have a short duration, for example 30 seconds. At the start of the stream, only an in-transition fragment is computed while at the end of the stream only an out-transition fragment is computed. Computation of these fragments is similar to that described above for out- and in-transition fragments, but differs slightly in details related to the transitions occurring at the end points of the source stream. For example, referring to FIG. 5, there are no delayed B-frames that occur after the first I-frame of the stream, and therefore the zero-motion B-frames do not have to be computed.  
         [0096]    4 Audio Streams  
         [0097]    Audio frames are independently coded (similar to I-Frames in MPEG video) and as long as the elementary audio streams start and stop on elementary frame boundaries, no audio artifacts are generated. Audio decoders generally deal gracefully (i.e., generate silence) when no audio frame are transmitted. Therefore, in the approach described above, after the audio stream terminates during the transition, silence is presented.  
         [0098]    An alternative approach is to transmit audio frames containing silence, or alternatively other appropriate transition sounds, in the out- and in-transition fragments (see PES packets  284 A in FIG. 2 and  384  in FIG. 3).  
         [0099]    5 System Architecture  
         [0100]    Referring to FIG. 8, a content splicing system  800  for assembling a stream as described in the example above accepts source MPEG transport streams  810  and produces one or more output MPEG transport streams  890 , which are formed by assembling various portions of source streams  810 . As source streams  810  are input to the system, system  800  stores the streams in a source storage  840 , typically RAM or magnetic disk. The source streams are also processed by a transition point identification module  820 , which identifies transition points (time and data offsets) in the source transport streams.  
         [0101]    Potential transition points may be predefined and provided along with the source stream for example from cue tones with analog sources or from DVS-253 signaling imbedded in digital sources. Such signals identify, for example, times at which advertisements can be inserted. The potential transition points may in addition or alternatively be identified dynamically by the system based on the content of the MPEG stream. For example, automated scene change analysis is performed on the source video to identify potential transition points.  
         [0102]    Data identifying the potential transition points is stored in an index  850 . For the identified transition points, a transition generator  830  calculates in- and out-transition fragments for those transition points according to the approach described above and these fragments are stored in a transition storage  860 , which is also typically RAM or magnetic disk, for example the same disk used for source storage  840 .  
         [0103]    At a later time, which can be as short as the time needed to compute the transition fragments for a source stream, or can be an extended time before a stream is assembled, an assembly module  880  retrieves portions of source streams  810  that are stored in source storage  840  and retrieves particular transition fragments from transition storage  860 , and concatenates the retrieved portions and fragments to form output stream  890 . The particular portions of the source streams to be assembled in this way is driven by an assembly list  870 , which specifies the offsets at which transitions between different source streams are to occur.  
         [0104]    Referring to FIG. 9, source transport stream(s)  810  are indicated with segments  912 A-F separated by potential transition points. For each transition point, transition generator  830  generates a corresponding out-transition fragment  140 A-F and a corresponding in-transition fragment  120 A-F.  
         [0105]    In an assembly process in which a program in segment  912 B, such as an original commercial, is to be replaced by a program in segment  912 E, such as a replacement commercial, the resulting stream  890  includes a replacement stream  950  that is delivered in place of segment  912 B. This replacement stream includes out-transition fragment  120 B, in-transition fragment  140 E, segment  912 E, out-transition fragment  120 F, and finally in-transition fragment  140 C.  
         [0106]    Referring to FIG. 10, in an alternative architecture, the assembly process is performed at a remote location, for example, in a set-top box at a customer premises of a cable television system. One application of this is to replace television commercials with particular commercials that are selected according to the set-top box. In such an application, the set-top box receives an original stream  810  along with an out-transition fragment  120  (such as out-transition fragment  120 B for replacement of a commercial in segment  912 B) as well as an in-transition fragment (such as in-transition fragment  140 C) over one input channel  1022 . Alternative commercials segments (for example segment  912 E) along with their associated in-transition fragments (for example, fragment  140 E) and out-transition fragments (for example, fragment  120 F) are transmitted on other input channels  1022 . A tuner/input selector  120  dynamically selects the appropriate input channel for the commercial. To the extent that the duration of the original commercial segment  912 B is equal to the replacement stream  950 , which includes the pair of out- and in-transition fragments at each end of the replacement commercial, no retiming or buffering of the source stream  810  is needed to continue after the commercial. Null TS packets at the points where the tuner selects a different channel allow the packets to be lost without loosing necessary content. Various types of input channels  1022  for the alternative commercials can be used. For example, these channels may correspond to different delivery channels in the cable television system. Alternatively, the alternative commercials can be delivered and buffered in the set-top box until they are presented.  
         [0107]    Referring to FIG. 11, an advertisement replacement system involves storing a number of advertisement transport streams  1110 . For each advertisement stream, an in-transition fragment  1112  associated with the start of the advertisement stream, and an out-transition fragment  1114  associated with the end of the stream are stored. Note that for any particular advertisement, the in-transition fragment  1112 , the advertisement stream  1110  itself, and the out-transition fragment  1114  may be stored together as one sequence of TS packets without necessarily identifying the boundaries between the three components. A source program  1120  is accepted by the system. The source program includes a number of original advertisements  1130 . For each advertisement, an out-transition fragment  1132  is stored associated with the start of the advertisement, and an in-transition fragment  1134  is associated with the end of the advertisement. These in-and out-transition fragments may be computed and delivered to the system in conduction with the source program, computed in a batch if the source program is stored, or computed “on-the fly” shortly before the advertisement would be delivered.  
         [0108]    During delivery, each original advertisement  1130  can be replaced by zero or more advertisements  1110  to form a new stream  1140 . An insertion of a single replacement advertisement corresponds to replacing original advertisement  1130  with out-transition fragment  1132 , in-transition fragment  1112 , the replacement advertisement stream  1110 , the out-transition fragment  1114  for the replacement advertisement, and the in-transition fragment  1134  for the original advertisement. If no advertisement is to be presented, the original advertisement  1130  is replaced by the out-transition fragment  1132  followed by the in-transition fragment  1134  associated with the original advertisement. Multiple advertisements can be concatenated with an out-transition and in-transition fragment between each advertisement to replace a single original advertisement in similar manner.  
         [0109]    Another application involves presentation of selected portions of a program by presenting short segments in succession. In this application, transition fragments display frozen frames. For example, to present an initial portion of each of a sequence of scenes, an in-transition fragment is associated with the start of the scene, and out-transition fragments are associated with one or more points in the scene. In operation, presentation of a “fast-forward” version of a program involves replacing a trailing portion of each scene with an out-transition fragment followed by an in-transition fragment of the next scene. Selection of the out-transition point in each scene then determines the “speed” of the fast forward presentation.  
         [0110]    6 Alternatives  
         [0111]    In the embodiments described above, an out-transition fragment and an in-transition fragment are concatenated when assembling a stream. In one alternative, rather than concatenating the out- and in-transition fragments, the fragments are “woven” together. Recall that both the out-transition fragment and the in-transition fragment in general have a number of null TS packets. In particular, each out-transition fragment has a number of trailing null TS packets, as shown in FIG. 6. If a number of null packets whose delivery time is equal to the presentation time of one frame are removed from the transition, and one of the T-H black frames is also removed from the in-transition fragment then the duration of the black transition is shorter by one frame, and the transition still forms a compliant MPEG stream. In order to make removal of black frames efficient, each of the frames is encoded in a separate PES packet in set of TS packets in the in-transition fragment. Deletion of the black frame then corresponds to deletion of the associated TS packets for that PES packet. The process can be repeated until the T-H black frames of the null packets in the out-transition fragment are exhausted.  
         [0112]    Rather than mapping a desired splice time (a desired in-time and out-time) in a source transport stream to a particular frame in each elementary stream of the source transport stream, an alternative is to map the desired time into a cluster of different frames in each elementary stream. In- and out-transitions are then generated for each of these frames. The cluster is used, for example, when cue timing is inaccurate. When a default frame for a desired splice time does not match visually where the stream should be entered or left, the frame is manually corrected by selecting another frame (and corresponding transition fragments) from the cluster.  
         [0113]    Rather than generate a cluster of splice points requiring after-the-fact manual correction of a miss timed splice cue, in an alternative approach, content near the splice point is analyzed and an in-frame and an out-frame (which may be different) are picked to best match a profile of what is expected in an ad replacement scenario. One example is to analyze at the overall brightness of the pictures around the splice point and pick the darkest. Note, however, that opportunities to replace ads are typically demarked with a short black interval in the original program signal. Therefore, another approach is to leave the stream at the point where the black interval begins and return to the stream as close as possible to where the black interval ends. This offers the benefit of replacing the original black sequence with a black splice transition sequence, thus reducing or eliminating the perceived effect of the splice altogether.  
         [0114]    Mapping a desired transition to a frame at a GOP boundary is not necessary. For example, with little added computation out-points can be aligned to P-Frame boundaries inside of GOPs, thereby yielding more accurate out transitions. With somewhat more computation, out-points and in-points can also be created at any frame, for example, by recoding a portion of the GOP containing the transition.  
         [0115]    The approaches described above for fixed-rate delivery of transport streams are equally applicable to variable-rate delivery. Also, the approach is not limited to multimedia streams encoded according to the MPEG standard.  
         [0116]    Other pictures rather than black frames can be encoded during the in- and out-transitions, subject to using relatively few bits thereby avoiding buffer overflow during presentation of the spliced stream. Furthermore, transition effects, such as a frozen frame or a gradual fade, can be encoded in the transition fragments. In alternative embodiments in which a frozen frame is to be displayed throughout the entire transition, the in-transition fragment does not include an initial I-frame, and uses zero-motion predictive frames that depend of images encoded in the out-transition fragment. That is, a GOP spans both the out- and the in-transition fragment.  
         [0117]    Rather than retaining the MPEG encoding of pictures into their original I-, P-, and B-frames, computation of the transition fragments can alternatively include decoding and recoding certain of the MPEG frames, for example, to adjust the degree of compression in the MPEG stream.  
         [0118]    In-transition and out-transition fragments need not be concretely represented. Rather, parameters that can be used to generate each of these fragments can be computed and the transition fragments are then dynamically generated from the parameters at assembly time.  
         [0119]    Rather than encoding frames in the transition fragments using sequences of a black I-frame followed by zero-motion P-frames of the form IPPPPPP . . . , an alternative is to use a sequence of frames that includes zero-motion B frames. Such sequences can have the form IBBPBBP . . . . Such a form is typically used to encode video programming, and the decoders of some set-top boxes may expect that form and may not, in fact properly, process sequences made up of only zero-motion P frames. When using zero-motion B-frames, the presentation and decoding time stamps of the frames are adjusted accordingly.  
         [0120]    The description above concentrates on assembling MPEG streams. The same approach can be applied to other types of multimedia streams, including other versions of the MPEG standard, as well as multimedia streams encoded using other standards.  
         [0121]    7 Implementation  
         [0122]    An approach to implementing the methods described above uses software that is accessed by a computer processor, for example, from a storage disk or over a local area network. The computer executes the software under the control of an operating system. One example is a general purpose Intel Pentium processor executing the software under a Microsoft Windows operating system. Other general purpose or special purpose processors, and other software environments can alternatively be used. Pre-computation of transition fragments and assembly of the streams can be performed by the same computer or computers, or different computers can be used for computation of the transition fragments and the assembly. Furthermore, transition fragments can be computed remotely and delivered to a computer that hosts the assembly process. In such a case, the transition fragments can be delivered together with, or separately from, the stream for which they have been computed. In alternative implementations, some or all of the functions are performed by special purpose circuitry, which may include programmed processors.  
         [0123]    Other embodiments are within the scope of the following claims.