# Patent

## Title
On-device multiplexing of streaming media content

## Abstract

Techniques are disclosed for multiplexing a dynamic bit-rate video stream with an audio stream received by a client device in a manner that allows the resulting multiplexed stream to be played back without disruption, despite dynamic changes in the bit rate of the video stream that may occur. A content server may stream both a video stream and an audio stream to a client device for playback. The client device may multiplex the video and audio streams prior to them being presented to a playback engine for decoding and playback to a user.

## Background
CROSS REFERENCE TO RELATED APPLICATION
This application claims priority to the provisional patent application titled “Seamless Bit Rate Stream Switching” filed on Dec. 22, 2008, having Ser. No. 61/140,032, which is incorporated herein by reference in its entirety. This application also claims priority to the provisional patent application titled “Seamless Bit Rate Stream Switching” filed on Mar. 27, 2009, having Ser. No. 61/164,327, which is incorporated herein by reference in its entirety.


BACKGROUND OF THE INVENTION
1. Field of the Invention
Embodiments of the invention generally relate to the playback of audio and video data streamed over a computer network to a client device. More specifically, embodiments of the present invention relate to multiplexing dynamic bit-rate video and audio video streams on a client device.
2. Description of the Related Art
Consumer demand for digital video products has greatly increased in recent years. Examples of popular applications include video conferencing, video security and surveillance and, importantly, the distribution of entertainment content, including a rapidly a growing market for Internet video streaming. Video encoding and compression is a common component of these applications. Coding-decoding (codec) algorithms allow digital video and audio data to be transmitted in real time. Several codecs currently in use have been developed as an industry standard such as MPEG-2, MPEG-4, H.264/AVC and AVS, while others are proprietary algorithms, such as On2, Real Video, and Windows Media Video (WMV) (now standardized by SMPTE as VC-1).
Internet video streaming of compressed audio and video is typically performed using a network of computing systems collectively referred to as a digital content distribution system. And such systems typically include a content server, a content player, and a communications network connecting the content server to the content player. The content server stores digital content files available for download from the content server to the content player. The digital content files correspond to movies, televisions shows, sporting events, music productions, etc. The digital content file typically provides sequential content data, organized according to playback chronology, including audio data and/or video data.
The content player (e.g., a Blu-ray® disk player) downloads and plays a digital content file, usually in response to a user request. The process of playing the digital content file includes decoding and rendering audio and video data to generate audio and video signals sent to speakers and a display screen. In practice, the content server transmits (i.e., streams) digital content to the content player, which plays the digital content file while content data is being received. To account for variable latency and bandwidth within the communications network, a content buffer queues incoming content data ahead of the content data actually being played. During periods of network congestion, which leads to lower available bandwidth, less content data is added to the content buffer, which may drain down as content data is being de-queued to support playback at a certain playback bit rate. However, during periods of high network bandwidth, the content buffer is replenished and additional buffer time is added until the content buffer is generally full again. In particular systems, the content buffer may queue content data corresponding to a time span ranging from seconds to more than a minute.
SUMMARY OF THE INVENTION
One embodiment of the present invention includes a method for encoding a media file to allow on-device multiplexing of audio and video data and dynamic bit rate switching. The method may include providing a plurality of video encodings of the media file. Each video encoding may provide an encoding of the media file at a distinct video bit rate and each video encoding may include a plurality of portions of video data. In each of the plurality of portions of video data, one or more insertion points for multiplexing portions of video data with portions of audio data on the client device is identified. Additionally, one or more of the portions of video data may be padded to be aligned to a continuity count boundary. The method may also include storing, in the video encoding, a file header which includes an indication of the positions of the plurality of insertion points in the video encoding and providing at least one audio encoding of the media file. The audio encoding may include a header indicating a plurality of audio segments, each corresponding to one of the plurality of portions of video data. The method may also include storing the plurality of video encodings and the audio encoding on a media delivery system in order to be streamed to client device upon request.
In a particular embodiment, each of the plurality of video encodings includes a sequence of one or more groups of pictures (GOPs). For example, each GOP may be encapsulated in a sequence MPEG-2 transport stream packets. In such a case, padding at least one portion of video data to be aligned to a continuity count boundary may comprise adding video filler packets such that each GOP begins with an MPEG-packet having a continuity count of 0 and ends with a packet having a continuity count of 15.
In a particular embodiment, the method may further include receiving, from a client device, a request to stream the media file, transmitting, to the client device, the file header generated for each of the plurality of video encodings and the file header generated for the audio encoding. In response to requests from the client device, portions of video data from at least one of the video encodings and audio segments form the audio encoding may be streamed to the client device. Further, the client device may be configured to multiplex the streamed portions of video data with the streamed portions of audio segments to generate a multiplexed stream presented to a playback engine on the client device for decoding and playback. The client device may be further configured to switch streaming portions of video data from a first one of the video encodings to a second one of the video encodings.
Another embodiment of the invention includes a computer-implemented method for multiplexing an audio stream and a video stream on a client device. The method may generally include transmitting, to a streaming media server, a request to stream a media file stored on the streaming media server. The method may also include receiving, from the streaming media server, a file header describing each of a plurality of video encodings of the media file available from the streaming media server, and receiving, from the streaming media server, a file header describing at least one audio encodings of the media file available from the streaming media server. The method may also include transmitting, to the streaming media server, a request to download at first portion of video data from a first one of the plurality of video encodings and at least a first portion of audio data from the audio encoding, receiving the requested first portion of video data and first portion of audio data, and multiplexing the first portion of video data and first portion of audio to generate a multiplexed stream for playback by a playback engine on the client device.
In a particular embodiment, this method may also include transmitting, to the streaming media server, a second request to download at second portion of video data from a second one of the plurality of video encodings and at least a second portion of audio data from the audio encoding. And in response, receiving the requested second portion of video data and second portion of audio data. This method may also include multiplexing the second portion of video data and second portion of audio for playback by the playback engine on the client device and adding the multiplexed second portion of video data and second portion of audio to the multiplexed stream. The playback engine is generally configured to decode and playback the multiplexed stream without disrupting playback when decoding and playing back the first and second portions of video data.
Other embodiments include, without limitation, a computer-readable medium that includes instructions that enable a processing unit to implement one or more aspects of the disclosed methods as well as a system configured to implement one or more aspects of the disclosed methods.



BRIEF DESCRIPTION OF THE DRAWINGS
So that the manner in which the above recited features of the present invention may be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings. It is to be noted, however, that the appended drawings illustrate only typical embodiments of this invention and are therefore not to be considered limiting of its scope, for the invention may admit to other equally effective embodiments.
FIG. 1 illustrates bit rate switching and on-device multiplexing in a Blu-Ray® disc player, according to the specification published by the Blu-Ray Disc Association.
FIG. 2 illustrates an example networked computing environment which includes a media delivery system streaming content to a networked client device, according to one embodiment of the invention.
FIG. 3 further illustrates the media delivery system of FIG. 2, according to one embodiment of the invention.
FIG. 4 further illustrates the content player of FIG. 2, according to one embodiment of the invention.
FIG. 5 illustrates a method for encoding a media file to allow for on-device multiplexing on a networked client device, according to one embodiment of the invention.
FIG. 6 illustrates a method for on-device multiplexing of streaming media content delivered to a networked client device, according to one embodiment of the invention.
FIG. 7 illustrates an example of multiplexing a video and audio stream supplied to a playback engine, according to one embodiment of the invention.
FIG. 8 further illustrates portions of audio and video encoded in audio and video streams prior to being multiplexed on a client device, according to one embodiment of the invention.



DETAILED DESCRIPTION
Embodiments of the invention provide techniques for decoding and playing media content streamed over a communications network to a networked client device, such as a set-top box, PC, mobile telephone, video gaming platform, or Blu-ray® disc player. More specifically, embodiments of the invention provide for multiplexing a dynamic bit-rate video stream with an audio stream received by a client device in a manner that allows the resulting multiplexed stream to be played back without disruption, despite dynamic changes in the bit rate of the video stream that may occur.
In practice, a digital content file (e.g., a movie title) stored on a content server may be encoded using a variety of different bit rates. Prior to initiating playback, the content player may measure available bandwidth from the content server and select a digital content file having a bit rate that can be supported by the measured available bandwidth. To maximize playback quality, the content player may select to stream the digital content file with the highest bit rate that does not exceed the measured bandwidth. However, the amount of bandwidth available may change during playback of AV programs downloaded over a data network. Thus, it becomes desirable to seamlessly switch between video streams of varying bit rates, e.g., to reduce the streaming bit rate when prevailing network bandwidth deteriorates. Seamless bit rate stream switching during playback balances a viewer's desire for a high quality viewing experience and efficient use of the available network bandwidth of the network connection over which AV programs are downloaded. For example, the first few seconds of a program sent over a network to a digital media player after the viewer initiates playback may be digitally encoded at a low bit rate so as to reduce the transmission time of program content over the network and hence minimize the delay between initiating playback and presenting content to the viewer. Thereafter, as playback continues, the bit rate of encoded content sent to the digital media player may be increased to take advantage of available network bandwidth and to present the highest quality audiovisual content to the viewer.
However, certain prevalent techniques for switching bit rates in some digital media players are awkward and significantly degrade a viewer's viewing experience. For example, the Blu-ray® Disc Association (BDA), an industry consortium responsible for establishing format standards for Blu-ray® disc technology, has established standards known collectively as the “Blu-ray® Disc Format Specifications” that include the “Blu-ray® Disc Read-Only Memory (ROM) Format,” the “Blu-ray® Disc recordable Format,” and the “Blu-ray® Disc Rewritable Format.” For ease of reference, these specifications are referred to herein as a collection as the “Blu-ray® specification.”
The Blu-ray® specification includes specifications for a Blu-ray® Disc Player (BD-Player) to playback digitally encoded AV programs downloaded over a data network such as the Internet. According to the Blu-ray® specification, portions of an AV program downloaded to a BD-Player may be stored in a local storage as one or more AV stream files subsequently delivered to the decoder of the BD-Player as a stream of AV data for playback. Effectively, the downloaded AV program is presented to the decoder as a virtual Blu-ray® disc. However, the Blu-ray® specification requires configuring the decoder of the BD-Player with a size and a time length of all portions of an AV program contained in the AV stream files before playback of the AV program can begin. Thus, switching bit rates during playback of an AV program requires that the decoder of the BD-Player be reconfigured because the size or number of portions of the AV program typically changes when the bit rate is switched. Other protocols for streaming AV content over data networks may have similar requirements for configuring size or length of portions of an AV program prior to content streaming and playback. Reconfiguring the decoder during playback is a suboptimal solution for changing video (or audio) bit rates because doing so noticeably disrupts an otherwise smooth presentation of audio and video.
In one embodiment, a content server may stream both a video stream and an audio stream to a client device for playback. The client device may multiplex the video and audio streams prior to them being presented to a playback engine. Further, as noted above, the bit rate of the video stream may change during playback in response to changes in prevailing bandwidth conditions. However, as also noted above, some devices have certain constraints regarding how digital media is presented to a playback engine for decoding and presentation to a viewer. For example, a playback engine on a Blu-ray® disc player may require a multiplexed and encrypted data stream, where both a size and a length of each portion of an AV program data is specified before playback of the AV program can begin.
Accordingly, in one embodiment, a stream formatter or other playback logic on the client device may be configured to present such a playback engine with a multiplexed video stream that satisfies these constraints. As described in greater detail herein, the available video stream files for a given title may be encoded in a manner to support on-device multiplexing with dynamic bit rate switching. For example, each file encoding a video or audio stream may include a header specifying the portions (and sizes) of AV data is contained in a given audio or video file. In one embodiment, the stream formatter may be configured to retrieve this information regarding each available video (and audio) stream file available for a given title prior to initiating playback. And the stream formatter may use this information to build an index of the stream used to configure the playback engine as well as to multiplex the audio and video streams. For example, the playback engine may be configured with a size for each portion of the video data specified as the largest size of that portion stored in any of the any of the available bit rate encodings. If a portion is then played back using a lower-bit rate, the stream formatter may pad that portion as needed so as to match the size specified when the playback engine was configured.
The header generated for a given video stream may include a field indicating the size of the header, a field indicating byte (or packet) offset where the header ends and stream data begins, and an index listing insertion points in each group of pictures (GOP) where a segment of audio may be multiplexed with the video to provide a multiplexed AV stream for a playback engine on a client device.
Further, during playback, the stream formatter may change the bit rate at which video is being decoded and played back by changing which video file is being streamed from the content server, multiplexed with an audio file, and supplied to the playback engine for decoding and playback, without also requiring the playback engine to be reconfigured with each bit rate change and without causing other disruptions to playback of the streaming media content. That is, the formatter may vary the bit rate of the video in an encrypted stream while still presenting it to the playback engine as a single multiplexed stream.
In one embodiment, each bit rate encoding of a media file includes a plurality of GOPs and each GOP may be stored in a variable number of transport stream packets (e.g., MPEG-2 M2TS packets), depending on the byte size of the GOP itself Note, the MPEG-2 standard specifies a fixed packet size of 188 bytes in length. However, additional fields may be added by other standards. For example, the Blu-ray® specification adds four bytes of additional data to each 188 byte MPEG-2 packet, resulting in a packet size of 192 bytes). By configuring each GOP to begin on an I-frame boundary (a frame which contains all necessary rendering information within itself, and includes a sequence header at the start of each GOP), the bit rate (and video data supplied to the playback engine) may be changed at any GOP boundary without disrupting video playback (save for an increase or decrease in video quality resulting form the change in bit-rate). To preserve a playback continuity count included in the header of each MPEG-2 transport stream packet, each GOP may be padded with video filler packets so as to end with a continuity count of 15, resulting in each successive GOP to begin with a packet having a continuity count of 0 (assuming a four-bit continuity counter is used, as is the case for the MPEG-2 transport stream standard). This allows the bit rate to be switched at any GOP boundary without resulting in a continuity count error.
Note however, although a particular embodiment of the invention is described using a BD-Player which implements the Blu-ray® specifications as an example of a client device, it should be understood that embodiments of the invention may be adapted to for a broad variety of streaming media protocols. Accordingly, references to the Blu-ray® specifications or a BD-Player are made as an illustrative example and not intended to be limiting of the present invention. Further, in the following description, numerous specific details are set forth to provide a more thorough understanding of the present invention. However, it will be apparent to one of skill in the art that the present invention may be practiced without one or more of these specific details. In other instances, well-known features have not been described in order to avoid obscuring the present invention.
FIG. 1 illustrates bit rate switching and on-device multiplexing in a Blu-Ray® disc player, according to the specification published by the Blu-Ray Disc Association. As shown, a HyperText Transfer Protocol (HTTP) server 101 is coupled to a Blu-ray Disc Player 102 via a data communications network, such as the Internet. In the example, server 101 stores multiple video files 103 and an audio file 113, each corresponding to a given media property (e.g., a movie). In this example, video files 103 encode the given media property in three different bit rates: 500 kbps, 1000 kbps, and 1500 kbps. Additionally, the audio file 113 encodes an audio stream associated with the media property at 128 kpbs. Each video file 103 includes a header having a playlist information file 105, segments of video (e.g., MPEG-2 transport stream packets of storing video data corresponding to 2 seconds of video at a progressive frame rate of 30 fps), and one or more clip information files. Each clip information file corresponds to one of the segments of video data. For example, the file 103 stored at 1000 kbps includes a playlist information file 105, clip information files 107a-n, and corresponding video stream files 109a-n. 
Each AV stream file has a corresponding clip information file that stores time stamps of the access points into the corresponding AV stream file that are referenced in the playlist information file. During playback of an AV program, and in particular, during playback of a portion of the AV program that corresponds to a playing interval defined in the playlist information file, the BD-Player reads the clip information file to find out the position where it should begin to read data from the AV stream file corresponding to the playing interval. Further, the clip information files include information indicating where segments of audio from audio file 113 may be multiplexed with segments of video. For example, assume each video stream file 109a-n stores approximately 2 seconds of video, and each corresponding segment of audio stores approximately 2 seconds of audio. In such case, the clip information files 107a-n may indicate a byte (or packet) offset indicting a first and second point for each video stream file 109a-n at which to insert a portion of the corresponding audio file 115a-n, resulting in a multiplexed stream with alternating segments of audio and video data every two-thirds of a second. Of course, the size and playback length of segments of audio and video data may be tailored to suit the needs of a particular case. Nevertheless, as the Blu-ray® specification allows for a maximum separation between video and audio data of up to 1 second, using a video and audio segment size of approximately 2 seconds and a multiplexed stream alternating between audio and video every two-third seconds has proven to be effective.
As shown, BD-Player 102 includes playback logic 104 and local storage 106. The Blu-ray specification standard provides specifications for playback logic 104 to download and write files to local storage 106 including playlist information files, clip information files, and multiplexed audio visual stream files. In effect, the Blu-ray specification standard allows playback logic 104 to use local storage 106 to create a virtual Blu-ray Disc that includes AV program content downloaded from a server over a network. To create such a virtual Blu-ray Disc using local storage 106, playback logic 104 must store playlist information files, clip information files, and AV stream files in accordance with the Blu-ray® specification.
In particular, according to the Blu-ray specification, playback of an AV program (e.g., AV program 103) cannot start until the corresponding playlist information file (e.g., playlist information file 105), all corresponding clip information files (e.g., clip information files 107a-n), and at least one AV stream file (i.e., an audio visual stream multiplexed from one of the video files 103 and the audio file 113) is completely downloaded to local storage 106. Once these files are present in local storage 106, playback logic 104 can cause BD-Player 102 to begin playback of the AV stream multiplexed from video file 103 and audio file 113. After playback starts, playback logic 104 can continue to cause BD-Player 102 to download the remaining video files (e.g., video files 109b-n) and audio files (e.g., audio files 115b-n) for multiplexing. So long as the next stream file needed at BD-Player 102 is completely downloaded to local storage 106 and multiplexed by playback logic 104 before the BD-Player has finished playing the current AV stream file, playback of an AV program will be presented to the viewer without any momentary stops or flickers or other playback events that cause a noticeable interruption of smooth audio and video playback.
However, as discussed above, it may be desirable to switch bit rates during playback of a video program. For example, if BD-Player 102 is connected to HTTP server 101 through a typical home Digital Subscriber Line (DSL) or cable modem which can download data at approximately 1500 kbps, concurrent usage of the home DSL or cable modem, for example, by another family member, can cause BD-Player 102 to fall behind in downloading AV stream files from server 101. That is, BD-Player 102 can no longer download AV stream files from server 101 as fast as the rate at which the AV stream files are being streamed to the decoder of the BD-Player. In such a case, it would be useful to be able to seamlessly switch, for example, from playing AV stream files at 1500 kbps to playing AV stream files at 1000 kbps.
Unfortunately, to switch bit rates according to the Blu-ray specification, the playlist information file, all the clip information files, and at least one AV stream file for the new bit rate must be completely downloaded to local storage 106 before playback of the AV program at the new bit rate can begin. For example, to switch from playback of AV program 103 at 1500 kbps to playback of AV program 103 at 1000 kbps, playlist information file 105, clip information files 107a-n, and at least one video files 109a-n must be completely downloaded to local storage 106 before BD-Player 102 can switch to playback of AV program 103 at 1000 kbps If the streaming bit rate were switched during playback of AV program 103 encoded at 1500 kbps, visible interruptions may occur as switching to a different playlist information file is not seamless for media processed according to the Blu-Ray® specification. Instead, switching to a different playlist information file results in a visible interruption in viewing a program that may last several seconds, causing a poor user experience.
In one embodiment, a BD-Player may be configured with additional playback logic to allow for seamless bit rate switching during playback, without requiring the BD-Player to be reconfigured with changed size data and without causing a noticeable interruption of smooth audio and video playback. In particular, as video files are downloaded for playback, the size of the video file (or the size of groups of pictures (GOPs) in the clip file) is compared with a clip information file. The clip information file may be used to configure the BD-Player prior to initiating playback of streaming AV data. The playback logic 105 may pad the video file (or one or more GOPs in the clip file) such that the size of the clip file matches the configured size specified in the clip information file. Once padded, the video file 103 may be multiplexed with the corresponding audio clip 115a-n and presented to the decoder of the BD-player 102. Note, as shown, clips 115a-n from a single audio file 113 are multiplexed with any of the video files 103 as the video bit rate is switched as appropriate using the techniques described herein. However, in an alternative embodiment, the audio data may also include multiple files, each encoded at different bit rates. In such a case, the playback logic 104 may also switch between audio bit rates as appropriate for prevailing bandwidth conditions.
FIG. 2 illustrates an example networked computing environment which includes a media delivery system 210 streaming content to a networked client device, according to one embodiment of the invention. As shown, FIG. 2 illustrates a media delivery system 210, media selection service 214, viewing location 228, and ordering location 234. In one embodiment, a media server 201 of the media delivery system 210, presentation server 216 of media selection service 214, BD-Player 202 of the viewing location 228, and computer 236 of the ordering location 234 are all connected to data network 226. The data network 226 is included to be representative of any combination of computer networks capable of delivering data from one computer to another. For example, data network 226 may comprise any combination of a local area network (“LAN”), a wide area network (“WAN”), the Internet, a telecommunications network, a satellite network, a cable television network, or a wireless network. Further, data network 226 may itself include one or more networks coupled together to form a single logical network and that supports appropriate network protocols (e.g., TCP/IP for the Internet).
Illustratively, media delivery system 210 includes a media library 212 that comprises AV files 203. The term “audiovisual program” or “AV program” as used herein refers broadly to a collection of audio stream files, video stream files, or multiplexed audiovisual files that can be delivered using a streaming media protocol over a data network. Examples of AV programs include music, recordings of spoken words, movies, sports programs, television series episodes, documentary motion pictures, instructional programs, or any other form of program. AV files 203 include a stored set of files that can be delivered on demand over a network connection to a computer such as BD-Player 202. In a practical embodiment, there may be thousands of AV programs stored in or managed by the media delivery system 210. AV files 203 may include multiple video (and/or audio) encodings of a given title, where each encoding is made at a different bit-rate. Further, in one embodiment, the AV files 203 may include separate audio and video streams for one or more titles. In such a case, when a user requests a particular title, the audio and video streams delivered to a user may be multiplexed together by playback logic on the BD-player 202 prior to being decoded and played back to the user.
As shown, media delivery system 210 also includes media server 201 coupled to the media library 212. Media server 201 generally is configured to retrieve a selected or specified file or files that comprise AV files 203 from the media library 212 in response to a request from BD-Player 202 and deliver the files using a streaming media protocol to the BD-Player 202 in response to the request. In one embodiment, media server 201 is configured to deliver files stored in media library 212 using the HyperText Transfer Protocol (HTTP) and/or HTTP over Secure Socket Layer (HTTPS) through data network 226 to BD-Player 202. However, embodiments are not limited to any particular network protocol and any suitable network protocol may be used to deliver AV program content from media delivery system 210 to BD-Player.
Also as shown, media selection service 214 includes a presentation server 216, one or more application servers 218, and a database server 220. The media selection service 214 may be integrated into or co-located with the media delivery system 210 as a single system, and the media delivery system 210 may be implemented as an application on the application servers 218 or otherwise contained within the media selection service 214. In the media selection service 214, the one or more application servers 218 are coupled to the presentation server 216 and database server 220.
The database server 220 maintains a user account 222 for a user of the service including a media queue 224. The user account 222 is associated with a user at the ordering location 234 and the viewing location 228. The database server 220 is configured with an inventory of audiovisual programs that are available for delivery using the media delivery system 210. Application servers 218 and database server 220 is coupled through network 226 to media server 201 and other elements of media delivery system 210 (not shown), to enable the media delivery system 210 to determine which AV files 203 are in media queue 224 for delivery to the viewing location 228. The presentation server 216 is configured with programs for generating a user interface display, receiving user input selecting audiovisual programs for rental or viewing, and other functions.
The media queue 224 may provide a list of AV files 203 that a particular user or user account has rented or requested to download or view. The queue 224 may include a list of both tangible media for rental, such as DVD titles, and AV files 203 for instant watching (i.e., streaming) or for downloading. Media queue 224 also may represent multiple associated queues, so that the service 214 may maintain one queue of tangible media for rental and a separate but associated queue of audiovisual programs for instant watching or downloading. Further, one user account 222 may be associated with multiple user profiles each having a separate queue in any of the foregoing queue arrangements. In one embodiment, the media selection service 214 is the Netflix® service commercially available from Netflix, Inc., Los Gatos, Calif.
Illustratively, viewing location 228 includes the BD-Player 202, an input device 230, and a display 232. For purposes of illustrating a clear example, FIG. 2 shows one viewing location 228, but in a practical embodiment there may be at least many thousands of viewing locations concurrently served by one or more media delivery systems 210.
BD-Player 202 includes any digital media player that complies with one or more of the video based player profiles specified in the Blu-ray® specification. At present the Blu-ray specification includes three video based player profiles known as “Profile 1.0”, “Profile 1.1”, and “Profile 2.0” (“Profile 2.0” is referred to commercially as “BD-Live”). However, embodiments are not limited to digital media players that implement existing versions of the Blu-ray specification and include digital media players that implement any future version of the Blu-ray specification—or the protocols for streaming media to a networked client device. In addition, BD-Player 202 may implement some or all portions of the Advanced Access Content System (AACS) standard for secure content distribution and digital rights management.
In one embodiment, BD-Player 202 is a computer system configured as a set-top box coupled to data network 226 and configured to receive AV files 203 and generate corresponding video output for a display 232 at viewing location 228. In such a case, the BD-player 202 may include firmware with playback logic configured to multiplex audio and video files streamed by the media delivery system 210. Alternately, the playback logic itself may be streamed to the BD-player 202. For example, the BD-player 202 may be configured to be capable of executing BD-J (Blu-ray Java®) applications retrieved over the Internet. In such a case, the BD-player 202 first downloads the playback logic as a BD-J application and then executes this application both to configure the BD-player 202 to play a title from media library 212 as well as to retrieve and multiplex audio video streams for the selected title. Non-limiting examples of set-top boxes include Blu-ray Disc player devices, streaming video playback boxes such as the Netflix Player by Roku, digital satellite television set-top boxes, video game consoles, digital video recorder (DVR) devices, cable converter boxes, or a set-top box device configured to support one or more video player profiles of the Blu-ray® specifications. In another embodiment, BD-Player 202 is a desktop or workstation computer system configured coupled to data network 226 and configured with a digital media player application that implements one or more video player profiles of the Blu-ray® specifications (or other streaming media protocols) and that is configured to receive AV files 203 and generate corresponding video output for a display 232 at the viewing location 228.
Input device 230 is any user input device suitable for controlling the operation of BD-Player 202. In an embodiment, input device 230 is a remote control device that uses infrared light-emitting diode emissions, radio-frequency signals, or wired signals to communicate with player 202 and input device 230 comprises one or more control buttons for operating functions of the player 202. For example, input device comprises a play button, a fast forward button, a rewind button, and a selection button. In another embodiment, input device 230 is an alphanumeric keyboard and mouse combination of the kind commonly connected to a personal computer or workstation computer
Display 232 is any display device capable of displaying motion picture or video images according NTSC, PAL, ATSC, or other standards for conventional video, HD video, or other format. In an embodiment, display 232 comprises a television monitor or other similar suitable video display.
Ordering location 234 may provide a computer 236 that can connect to presentation server 216 through data network 226. For purposes of illustrating a clear example, FIG. 1 shows one ordering location 234, but in a practical embodiment there may be many thousands of ordering locations concurrently served by one or more media selection services 214. In an embodiment, computer 236 is configured with a browser or other interface program that can connect to a complementary web server or other server program to interact with functions provided by media selection service 214. The ordering location 234 and the viewing location 228 may be the same location or different locations in various embodiments. Further, the functionality of computer 236 may be included in BD-Player 202. For example, BD-Player 202 may be configured with a browser or other user interface program that can connect to a web server or other server program to interact with functions provided by media selection service.
FIG. 3 further illustrates the media server and media delivery system 210 of FIG. 2, according to one embodiment of the invention. As shown, media delivery system 210 comprises a computing system having, without limitation, a central processing unit (CPU) 305, a network interface 315, an interconnect 320, a memory 325, and storage 330. The media delivery system 210 may also include an I/O devices interface 310 connecting I/O devices 212 (e.g., keyboard, display and mouse devices) to the media delivery system 210.
The CPU 305 retrieves and executes programming instructions stored in the memory 325. Similarly, the CPU 305 stores and retrieves application data residing in the memory 325. The interconnect 320 facilitates transmission of programming instructions and application data between the CPU 305, I/O devices interface 310, storage 330, network interface 315, and memory 325. CPU 305 is included to be representative of a single CPU, multiple CPUs, a single CPU having multiple processing cores, and the like. And the memory 325 is generally included to be representative of a random access memory. The storage 330 may be a disk drive storage device. Although shown as a single unit, the storage 330 may be a combination of fixed and/or removable storage devices, such as fixed disc drives, floppy disc drives, tape drives, removable memory cards, optical storage, network attached storage (NAS), or a storage area-network (SAN).
As shown, storage 330 includes elementary video and audio streams 350, 352 and encoded video and audio streams 354, 356. And the memory 325 includes an HTTP server 335 and an encoding tool 340. Each encoded audio and video file 354, 356 is included to represent a copy of the same general media file, encoded at a different bit rate. Of course, in practice, many distinct media titles may be available for streaming. The HTTP server 335 may be configured to stream encoded video files 354 and encoded audio files 356 to a client device (e.g., BD-player 202) using a streaming media protocol. For example, in one embodiment, the encoded video files 354 and encoded audio files 356 are MPEG-2 compliant transport stream files encoding video (or audio) at a specified bit rate. In such a case, the HTTP server 335 may encapsulate MPEG-2 packets in an HTTP stream and transmit them to a client device. More simply, the media server 201 may stream one of the encoded video audio and files 354, 356 selected from the encodings available in storage 330. In turn, the client device may multiplex the files and present them to a playback engine (e.g., a BD-J application executing on a Blu-ray® disc player) for decoding and playback.
In one embodiment, an encoding tool 340 may be configured to generate the encoded video and audio files 354, 356 from an elementary audio/video stream files 350, 352, such as a high-definition H.264/AVC encoded file and a raw audio stream. By sampling the elementary AV stream files 350, 352 the encoding tool 340 may generate multiple video (and audio) encodings of the same media property, each encoded at different bit rates. Further, the encoding tool 340 may generate the encoded video files 354 and/or encoded audio files 356 in a way so as to allow a client device (e.g., a Blu-ray disk player) to receive and multiplex encoded video and audio data in order to generate a multiplexed stream presented to a playback engine on the client device. Further, the encoded video and audio files 354, 356 may be configured to allow the client device to vary the bit rate of the streaming media content, i.e., to dynamically change which of the encoded video files 354 (or audio files 356) is streamed to the client device.
In one embodiment, e.g., the particular encoded video and audio files 354, 356 used to stream data may be determined by the client device as a function of the prevailing bandwidth conditions. For example, the client may be configured to begin streaming playback by initially requesting the lowest bit rate of encoded video files 354 and to increase the bit-rate up to the greatest rate supportable by the prevailing bandwidth between the client device and the media delivery system 210. Further, as the available bandwidth changes, the bit rate at which the encoded video and audio files 354, 356 is streamed may be changed. In such a case, the HTTP server 335 may change from streaming one encoding to the client to another, in response to client requests for video (or audio) data from different encodings. However, rather than reconfiguring the client device each time the streaming bit-rate is changed, the client device may pad portions of the encoded video file 354 such that the size of a given portion matches the configured size of that portion specified to the client device prior to streaming.
For example, each encoded video file 354 may provide a sequence of groups of pictures (GOPs), and a set of sequential GOPs may themselves be grouped, e.g., in groups of video 2 seconds in length. That is, each encoded video file 354 may be subdivided into a number of clip files, and each clip file may include a sequential set of one or more GOPs from a given encoding. The clip files present in a given encoded video file 354 may be specified in the header associated with that file. Further, the header may specify a number of insertion points (by byte or packet offset) in each GOP for multiplexing audio data. In one embodiment, e.g., each GOP may correspond to two seconds of video playback and the header may specify two insertion points for multiplexing audio data with the video data. Corresponding GOPs in different encodings 354 represent the same sequence of pictures (i.e., represent the same two seconds of video) and have the same insertion points. However, as the encoded video files 354 are generated at different bit rates, both the size and the byte/packet offset for each GOP and each insertion point recorded will vary among different encodings. In one embodiment, the encoding tool 340 may be configured to pad an encoded video file 354 with video filler packets such that each GOP begins with an I-frame and that each GOP begins with an MPEG-2 packet having a continuity counter value of 0. Doing so allows a client device to switch from multiplexing one encoded video file 354 with an audio file 356 to a different encoded video file 356, without reconfiguring the playback engine receiving the multiplexed data or otherwise disrupting streaming media playback (save for a change in audio/video quality resulting from the changed bit-rate).
As noted, encoded video file 354 may include a file header indicating the packet (and/or byte) offset of each GOP (and insertion point for multiplexing) in that encoded video file 354. From this information, the size of each GOP may be determined. As the clip files storing the GOPs are downloaded, the client device may compare the size of each GOP to a reference size determined prior to initiating streaming playback. Further, the client device may pad each GOP as necessary so that the size of each GOP in the multiplexed stream presented to the playback engine is the same as specified in the client information file used to configure the playback engine.
Note, while each encoded video and audio files 354, 356 may generally be referred to as having a bit rate using a fixed value (e.g., a bit rate of 1500 k per second) the actual bit rate may vary at different points within a given encoding. As is known, variable bit rate (VBR) encoding techniques adjust the bit rate of an encoding depending on the content being encoded. For example, if there is little change in a visual scene, the bit rate at which content is encoded may be decreased. Conversely, if there is rapid change in the scene, the bit rate may increase, up to the maximum specified for the encoding. Thus, VBR encoding offers a higher audio-visual quality at a smaller file size.
FIG. 4 further illustrates BD-Player 202 of FIG. 2 in greater detail, according to one embodiment of the invention. As shown, BD-Player 202 includes a network interface 438, local storage or memory 406, a removable media device 440, playback logic 404, CPU 442, user input processing unit 444, decoder 446, display device 432, and audio device 348.
Playback logic 404 provides one or more sequences of computer executable instructions for performing various functions that are described further herein. The instructions comprising playback logic 404 may be stored on a non-volatile memory of BD-player 202 such as, for example, a hard disk, flash memory, or firmware of BD player 202. Alternatively, instructions comprising playback logic 404 may be read by player 202 from a removable non-volatile computer-readable storage medium (e.g., a Blu-ray Disc) using removable media device 440. Still further, instructions comprising playback logic 404 may be received over data network 426 via network interface 438 (e.g., as a BD-J application).
The combination of network interface 438 and data network 426 broadly represent any of the following: an Ethernet port configured to couple BD-player 202 to a router, hub, DSL modem or adapter, or cable modem; an integrated DSL modem or adapter, or cable modem; an Ethernet port configured to couple BD-player 202 to a wireless access point; and any other electronic interface to a source of audiovisual program data, and the like.
As noted, in one embodiment, playback logic 404 may comprise an executable Blu-ray® Disc Java (BD-J) application read from a Blu-ray Disc inserted into player 402 and/or downloaded over network 426 from media server 201. In another embodiment, logic 404 is stored in firmware of player 402, for example, in a flash ROM of player 402. In another embodiment, a bootstrap portion of logic 404 is stored in firmware of player 402 and the bootstrap portion, when executed by CPU 342, downloads an application portion of logic 404 (e.g., an BD-J Xlet) from media server 201. The application portion of logic 404, when executed by CPU 442, performs the various functions that are described further herein. CPU 442 may comprise one or more processors and/or one or more processor cores.
Local storage or memory 406 is a hard disk or flash memory for storing files; including playlist information files, clip information files, and AV stream files downloaded from media server 201 by playback logic 404. In one embodiment, playback logic 404 may configure decoder 446 to process a transport stream of a specified size and bit rate by causing player 202 to store a playlist information file and a metadata describing the collection of clip information files associated with a given encoding of a media title. Thereafter, logic 404 may initiate playback of the playlist by invoking a playback function provided by an application programming interface (API) offered by a system layer of player 202. For example, once a user selects a media title for playback, the playback logic 404 may retrieve the headers associated with each bit-rate encoding of that file and generate clip information files describing the size and length of each clip (i.e., the sequence of GOPs) to be streamed as part of playing back the media file. Once this information is received, the playback logic 404 may configure the decoder to playback the selected media title and begin downloading the clips of the selected title at a particular bit rate. That is, the playback logic 404 may be begin downloading the sequential audio and video clip files, multiplex them, and once the first clip file is fully downloaded and multiplexed, send it to the decoder 446 for decoding and playback on the display device 432 and audio device 448. If the downloaded clips are smaller than the size specified when configuring the decoder 446, the playback logic may pad each clip as appropriate. This process repeats as subsequent clips are downloaded.
In one embodiment, the playback logic 404 may switch the bit rate of the video (or audio) being downloaded. In such a case, the playback logic may begin requesting clip files from a different encoding of the media title than the one then currently being downloaded. Further, as each encoding was constructed to include the same sequence of GOPs, and such that each GOP begins with an I-frame in an MPEG-2 packet having a continuity counter of 0, the playback engine 404 may seamlessly switch from one bit rate encoding to another at any GOP boundary. That is, to change the bit rate of streaming media playback, the playback engine simply stops multiplexing GOPs from one encoding and begins multiplexing GOPs from another. As noted, to ensure the continuity count remains correct, GOPs may be padded with video filler packets so as to end with a continuity count of 15 (or the largest continuity count value).
Decoder 446 refers broadly to a collection of hardware and/or software components within BD-player 402 that takes as input a transport stream contained in one or more AV stream files stored in local storage 406 and produces as output decompressed video images and audio data for display device 432 and audio device 448. Audio and video streams may be divided into packets (e.g., MPEG-2 packets) and encapsulated in one or more packets of a transport stream. By interleaving/multiplexing transport stream packets containing video data and audio data, audio and video elementary streams encoded at varying bit rates may be synchronized. For example, a transport stream may synchronize video encoded in an elementary stream at 2 Mbps with audio encoded in an elementary stream at 640 kbps. In one embodiment, the transport stream contained in an AV stream file stored in local storage 406 is a Moving Picture Experts Group-2 (MPEG-2) Transport Stream (ISO/IEe 13818-1) contained in a structure compliant with the Blu-ray specification referred to in the Blu-ray specification as a “BDAV MPEG-2 Transport Stream”.
Decoder 446 may include any combination of sub-components such as a buffer for queuing transport stream packets read from an AV stream file, a de-multiplexer for de-multiplexing the stream of transport stream packets into separate elementary audio and video streams, and an audio decoder and a video decoder for decompressing elementary audio and video streams respectively.
User input processing unit 444 processes input signals received from input device 430. An input signal processed by user input processing unit 444 may result in an event notification to a program or process executing instructions included in playback logic 404. Logic 404 may be configured to handle various types of event notifications from user input processing unit 444. For example, playback logic 404 may receive an event notification when a user uses input device 430 to initiate playback of an AV program or perform a seek function within an AV program. In response to receiving such an event notification, playback logic 404 may configure decoder 446 of player 202 to process the AV program at a particular bit rate by downloading and storing in local storage 406 the playlist information file and clip information files of the AV program.
FIG. 5 illustrates a method 500 for encoding a media file to allow for on-device multiplexing on a networked client device, according to one embodiment of the invention. As shown, the method 500 begins at step 505 where an encoding tool generates multiple encoded video files for a given media title (e.g., for a particular movie). For example, an encoding tool may sample a high-quality encoding (e.g., an H.264/AVC file) or sample raw audio/video data to create multiple encoded files, each with a specified bit rate.
As part of the encoding process, each video stream may be constructed to allow a client device to dynamically switch between different bit rates during streaming media playback. At step 515, the encoding tool identifies the position (by byte or packet offset) of insertion points in each GOP for audio multiplexing. For example, each GOP may represent two seconds of video playback and insertion points may be selected to subdivide each GOP into three relatively equal size chunks. Doing so subsequently results in a multiplexed stream alternating between two-thirds of second of video and audio data when the encoded audio and video files are streamed and multiplexed by the client device. At step 520, the encoding tool may pad the end of each GOP with video filler packets as appropriate such that each GOP ends with a packet having a continuity counter value of 15 (in the case of an MPEG-2 transport stream encoding). Doing so results in each GOP beginning with continuity counter value of 0. Thus, as the client device only switches video bit rates on a GOP boundary, the continuity counter remains correct when dynamically switching bit rates during streaming media playback.
In one embodiment, at step 525, the packets in an encoded video file may be aligned along a 6 Kb boundary (6128 bytes). Doing so allows for the video content to be encrypted using the AACS standard. As is known, with AACS, each aligned unit is independently encrypted using a CPS Unit Key. Note, rather than simply pad a portion of each GOP, one portion of a GOP may “borrow” data from a subsequent portion to minimize the amount of padding that is needed to create a 6128 byte AACS block. Additioanly, the end of each GOP may be padded include video filler packets to allow the last packet of the GOP to have a particular continuity counter value (e.g., 15). The resulting structure of each GOP and corresponding audio data is further illustrated in FIG. 8, discussed below. At step 530, the encoding tool may generate a file header describing the content of an encoded stream. The file header may include, among other things, a field indicating the size of the header itself and a byte offset where video data begins in the file. Further, the header may also include an index indicating a position (by byte or packet) for the beginning of each GOP and the position of each audio insertion point (to allow for on-device multiplexing). The index may also specify the size of each GOP (to allow for on-device padding). Steps 515-530 are performed to prepare each encoded video file for streaming. Once completed, the resulting video encodings may be stored on a media delivery system to be streamed to clients upon request.
At step 535, the encoding tool identifies the position (by byte or packet offset) for splitting each audio segment into chunks for multiplexing. As described above, each audio chunk may correspond to approximately two seconds of audio in the media file, and the insertion points may subdivide each chunk into approximately two-thirds of a second of audio. Again, this results in a multiplexed stream alternating between two-thirds of second of video and audio data when the encoded audio and video files are streamed and multiplexed by the client device. At step 540, an index is generated for the audio file being processed. The index may indicate, among other things, a byte or packet offset for each chunk of audio and each insertion point for multiplexing audio data with video data. At step 545, like the encoded video files, each portion of an audio file resulting from the identified insertion points may be may be padded so as to align along an encryption block boundary (e.g., 6128 bytes, allowing the audio content to be encrypted using the AACS standard). Note, rather than simply pad each portion of audio data with null packets, one portion of audio data may “borrow” packets from the subsequent portion to minimize the amount of padding included in a 6128 byte AACS block.
At step 550, the encoding tool may generate a file header describing the contents of the audio file. The header may include, among others, a field indicating the size of the header itself and a byte (or packet) offset where the audio data begins, and also include the index indicting the positions of the audio chunks and insertion points for multiplexing the audio encoding with the video encodings. At step 555, the encoded audio and video stream files may be stored on a media delivery system to be streamed to clients upon request.
FIG. 6 illustrates a method 600 for on-device multiplexing of streaming media content delivered to a networked client device, according to one embodiment of the invention. As shown, the method 600 begins at step 605 where a client device requests the file header for each available video and audio encoding of a selected media title (e.g., a particular movie). In one embodiment, the request may be two-fold, with a first request to identify the size of a given header and a second request to retrieve the complete header based on the identified size. Once retrieved, at step 610, the client device may store indices stored in the file headers. As noted above, the file header for each video may include an indication of the byte or packet offset of each video segment (i.e., each GOP) and the insertion points for multiplexing the audio corresponding to each video segment. Additionally, the index may indicate (or the client device may derive) a size for each chunk of video (or each GOP) in a given encoded video file. Similarly, the header of an encoded audio file may include an indication of the positions of points at which to multiplex the audio chunks with the video.
At step 615, the client device may configure a playback engine to receive a multiplexed transport stream. For example, in the case of a Blu-ray® disc player, playback logic may configure a playback engine to receive a BDAV MPEG-2 Transport Stream—which the client device will subsequently generate by multiplexing video and audio stream data received from the streaming media server. The profile for such a BDAV MPEG-2 Transport stream may have a profile derived from the information stored in the file headers requested at step 605 and indices stored at step 610. Specifically, the size of each clip file to download from the server may be derived from the collection of encoded video files. As each encoded video file stores the same sequence of GOPs (which may differ by packet number and byte size) the client device may configure the playback engine to receive the largest clip file stored in any of the encoded video files. The largest clip file is selected so that any clip file actually used may be padded if needed to match the size of the largest clip file. That is, as noted above, in the event that a clip file is streamed from one of the video encodings with a size less then the largest one, such a file may be padded so as to match the size used to configure the playback engine on the client device.
In the event that multiple audio files are available, then the sizes of the audio segments in the available audio encodings may be used to configure the playback engine in a similar manner. Otherwise, if the file is to be streamed and multiplexed by the client device using a single audio encoding and possibly multiple video bit-rate encodings, then the size of the audio segments indicated in the header of the selected audio encoding is used to configure the playback engine.
Once configured, at step 620, the client device may begin downloading the next (or initial) segments of audio and video streams and store the streamed data in a buffer as it is received from the streaming media server. At step 625, once a segment of video data is available (e.g., a complete GOP) and a corresponding segment of audio data is available, the client device may multiplex the audio and video streams received from the server based on the insertion points indicated in the indices stored at step 610. Additionally, if any GOP in the video stream is less than the configured size, such a GOP may be padded to match the size used to configure the playback engine on the client device. At step 630, the multiplexed segments of audio and video may be passed to the playback engine on the client device for decoding and playback to a user.
At step 635, unless the bit rate for streaming video (or optionally audio) data has changed, then the method 600 returns to step 620 and where the client device begins downloading the next segments of audio and video data for multiplexing. Otherwise, if the bit rate has changed, the client device may identify the end of a current GOP downloaded from the server at a current bit rate (step 640). At step 650, the client device identifies the video file which stores the next GOP encoded at the new bit rate. Thereafter, the method 600 returns to step 620 where the client device begins downloading audio data and downloading video data at the new bit rate. Data from the encoded video file having the new bit rate may then be multiplexed with the audio data along a GOP boundary and supplied to the playback engine for decoding and playback to the user.
While the client device (or the streaming media server) may elect to change the bit rate of video data streamed to the client for a variety of reasons, in one embodiment, the bit rate may be changed in response to changes in prevailing bandwidth conditions and the amount of streaming media then buffered on the client device. As another example, bit rates may be changed shortly after initiating playback, e.g., the client may first request video data at the lowest available encoded bit rate, allowing for a rapid start up of video playback. Subsequently, the client may then increase the bit rate as the prevailing bandwidth conditions allow to improve the video quality of video decoded and presented to a user.
FIG. 7 illustrates an example of multiplexing a video stream with an audio stream supplied to a playback engine, according to one embodiment of the invention. As shown, a first video stream 705 and a second video stream 710 each include sequential GOPs encoding a portion of a media title (labeled GOP1 through GOP4). And an audio stream 715 includes a sequence of audio clips corresponding to the GOPs in video streams 705 and 710 (labeled Audio Clip 1-Audio Clip 4). Illustratively, each GOP in video stream 705 and 710 and audio stream 715 includes hash marks (e.g., marks 750 and 755 in GOP1 and marks 770 and 775 in audio stream 715) indicating the positions stored in the file header associated with a respective video stream 705, 710 and audio stream 715 for multiplexing the audio and video data in these streams.
Additionally, FIG. 7 illustrates an example multiplexed stream 720 being constructed from the video streams 705, 710 and audio stream 715. As shown, the multiplexed stream 720 alternates between portions of video and audio data. For example, multiplexed stream 720 includes a first chunk 725 of video data taken from GOP1 followed by a first chunk 730 of audio data taken from Audio Clip 1. This pattern then repeats as the multiplexed stream 720 then includes a second chunk 760 of video data from GOP1 followed by a second chunk 765 of audio data from Audio Clip 1. Assume for this example, that the client device multiplexing video data from video stream 705 and audio data from audio stream 715 elects to change the bit rate of the video data being streamed from 1500 kbps (stream 705) to 1000 kbps (stream 710). As described above, the encoded video streams available from a server may be encoded to allow for a switch in bit rates along a GOP boundary.
Accordingly, following the second audio clip 765, the client device multiplexes the remaining portions of GOP1 and Audio Clip 1 into multiplexed stream 720. The client device then downloads GOP2 from video stream 710 and multiplexes a first chunk 735 of GOP2 into the multiplexed stream 720 followed by a first chunk 745 of audio data taken from Audio Clip 2. Note, in this example, as the first chunk 735 of GOP2 was retrieved from a lower-bit rate stream, it is smaller then the size of this portion of the video data specified to the playback engine during the configuration process. Accordingly, prior to multiplexing the first chunk 745 of audio data from Audio Clip 2 into multiplexed stream 720, the client device may add padding 740 as appropriate such that the size of the first chunk 735 of video data from GOP2 matches the configured size of this portion of video data. The client device continues multiplexing the streamed portions of audio and video data and supplying the resulting multiplexed stream 720 to the playback engine for decoding and playback to a user.
FIG. 8 further illustrates portions of audio and video data encoded in audio and video streams prior to being multiplexed on a client device, according to one embodiment of the invention. As shown, FIG. 8 includes a GOP 805 and a portion 810 of an audio file storing approximately 2 seconds of encoded audio. The GOP 805 generally corresponds to any of the GOPs in the video streams 705, 710 shown in FIG. 7. Similarly, audio portion 810 generally corresponds to any of the audio clips in audio stream 715 shown in FIG. 7.
In this example, GOP 805 includes three portions of video data. Each video part 8151-3 corresponds to one third of the GOP 805. Each video part 8151-3 may include a number of packets of video data (e.g., MPEG-2 transport stream packets) and end at an insertion point for multiplexing with audio portion 810, as identified during the encoding process. For example, video part 8151 of GOP 805 may correspond to the first chunk of GOP 1 shown in FIG. 7. And video parts 8152 and 8153 of GOP 805 may correspond to the second and third chunks of GOP 1 shown in FIG. 7. Similarly, audio part 8301 may generally correspond to the first chunk of audio stream 710 shown in FIG. 7.
Following each of the video parts 8151-3 is DRM (digital rights management) padding 8201-3. In one embodiment, DRM padding 820 is added to each of the video parts 8151-3 as needed in order to align a given part 805 along an encryption block boundary (e.g., a 6128 byte AACS block boundary). For example, the DRM padding 820 may simply be null packets added as needed. Alternatively, however, the DRM padding 820 may “borrow” data packets from the next portion of video data. Thus, the DRM padding 8201 following video part 8151 may include null packets, data packets borrowed from video part 8152, or both. Similarly, the DRM padding 8202 following video part 8152 may include null packets, data packets borrowed from part 8153, or both. However, part 8153 includes continuity counter (CC) padding 825 prior to DRM padding 8203. In this example, GOP 805 is padded with video filler packets as appropriate such that GOP 805 ends with a packet having a particular continuity counter such that the first video data packet in the next GOP will have a continuity counter value of 0. Following the CC padding 825 (if any) is DRM padding 8203, which consists of null padding packets used to align video part 8153 along an encryption block boundary.
Audio portion 810 includes DRM padding similar to that of GOP 805. That is, following each audio part 8301-3 is DRM padding 8351-3. Specifically, DRM padding 8351 following audio part 8301 includes null packets, data packets borrowed from audio part 8302, or both. And DRM padding 8352 following audio part 8302 includes null packets, packets borrowed from audio part 8303, or both. Lastly, DRM padding 8353 following audio part 8303 includes null padding packets. By padding each video part 8151-3 of GOP 805 and each part 8301-3 of audio portion 810, each of these segments of audio and video data fall along an encryption block boundary. Further, by padding the end of each GOP with CC padding 825, GOPs from different available video encoding may follow one another.
In sum, techniques are disclosed for multiplexing a dynamic bit-rate video stream with an audio stream received by a client device in a manner that allows the resulting multiplexed stream to be played back without disruption, despite dynamic changes in the bit rate of the video stream that may occur. Doing so allows, e.g., a BD-player to seamlessly change bit rates during playback, i.e., to change bit rates without requiring the BD-player to be reconfigured with changed size data or causing a noticeable interruption of smooth audio and video playback each time the streaming bit rates are changed. As video data is downloaded for playback, the size of the clip file (or the size of GOPs in the clip file) is compared with a corresponding clip information file. The clip information file may be used to configure the BD-Player prior to initiating playback of streaming AV data. Playback logic executing on the BD-Player may pad the clip file (or one or more GOPs in the clip file) such that the size of the clip file matches the configured size specified in the clip information file. Once padded as appropriate, the video data may be multiplexed with audio data and supplied to a playback engine for decoding and presentation to a viewer.
One embodiment of the invention may be implemented as a program product stored on computer-readable storage media within the client device. In this embodiment, the content client device may be embedded within a computing device such as a set top box or BD-player. An alternative embodiment may be implemented as a program product that is downloaded to a memory within a computer system, for example as executable instructions embedded within an Internet web site. In this embodiment, the client device comprises the computer system.
While the forgoing is directed to embodiments of the present invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof. For example, aspects of the present invention may be implemented in hardware or software or in a combination of hardware and software. One embodiment of the invention may be implemented as a program product for use with a computer system. The program(s) of the program product define functions of the embodiments (including the methods described herein) and can be contained on a variety of computer-readable storage media. Illustrative computer-readable storage media include, but are not limited to: (i) non-writable storage media (e.g., read-only memory devices within a computer such as CD-ROM disks readable by a CD-ROM drive, flash memory, ROM chips or any type of solid-state non-volatile semiconductor memory) on which information is permanently stored; and (ii) writable storage media (e.g., floppy disks within a diskette drive or hard-disk drive or any type of solid-state random-access semiconductor memory) on which alterable information is stored. Such computer-readable storage media, when carrying computer-readable instructions that direct the functions of the present invention, are embodiments of the present invention.
In view of the foregoing, the scope of the present invention is determined by the claims that follow.

## Claims

1. A computer-implemented method for encoding a media file, the method comprising:
providing a plurality of video encodings of the media file, wherein each video encoding in the plurality of video encodings encodes the media file at a different video bit rate than other video encodings in the plurality of video encodings and includes a plurality of portions of video data;
for each of the plurality of video encodings:
identifying, in each of the plurality of portions of video data, one or more insertion points within the respective portion of video data at which to multiplex a portion of audio data;
padding at least one portion of video data to be aligned to a continuity count boundary, and
storing, in the video encoding, a file header which includes an indication of positions of the plurality of insertion points in the video encoding;

providing at least one audio encoding of the media file, wherein the audio encoding includes a header indicating a plurality of audio segments, each corresponding to one of the plurality of portions of video data; and
storing the plurality of video encodings and the audio encoding on a media delivery system in order to be streamed to a client device upon request, wherein the client device is configured to generate a multiplexed stream by multiplexing streamed portions of video data with streamed portions of audio segments using the indication of positions of the plurality of insertion points in the file header of the respective video encoding.

2. The computer-implemented method of claim 1, wherein each of the plurality of video encodings includes a sequence of one or more groups of pictures (GOPs).

3. The computer-implemented method of claim 2, wherein each GOP is encapsulated in a sequence MPEG-2 transport stream packets, and wherein padding at least one portion of video data to be aligned to a continuity count boundary comprises padding the portion of video data with video filler packets such that each GOP begins with an MPEG-packet having a continuity count of 0 and ends with a packet having a continuity count of 15.

4. The computer-implemented method of claim 1, further comprising:
aligning at least one of the plurality of portions of video data to an encryption block boundary; and
aligning at least one of the plurality of audio segments to an encryption block boundary.

5. The computer-implemented method of claim 4, wherein aligning the at least one portion of video data comprises adding null padding packets to the portion of video data, borrowing packets from a subsequent portion of video data, or both; and
wherein aligning the at least one segment of audio data comprises adding null padding packets to the at least one segment of audio data, borrowing packets from a subsequent portion of video data, or both.

6. The computer-implemented method of claim 4, wherein the encryption block boundary is an AACS encryption block boundary.

7. The method of claim 1, further comprising:
receiving, from the client device, a request to stream the media file;
transmitting, to the client device, the file header for each of the plurality of video encodings;
transmitting, to the client device, the file header for the audio encoding;
in response to requests from the client device, streaming portions of video data from at least one of the video encodings to the client device and streaming audio segments form the audio encoding to the client device.

8. The computer-implemented method of claim 7, wherein the client device is configured to multiplex the streamed portions of video data with the streamed portions of audio segments to generate a multiplexed stream, and wherein the client device is further configured to present the multiplexed stream to a playback engine on the client device for decoding and playback.

9. The computer-implemented method of claim 8, wherein the client device is further configured to switch streaming portions of video data from a first one of the video encodings, to a second one of the video encodings.

10. The computer-implemented method of claim 9, wherein the client device is further configured to pad portions of video data streamed from the second one of the video encodings to match a size of a corresponding portion of video data in the first one of the video encodings prior to multiplexing the portions of video data streamed from the second one of the video encodings with the audio encoding.

11. A non-transitory computer-readable storage medium including instructions that, when executed by a processing unit, cause the processing unit to encode a media file by performing the steps of:
providing a plurality of video encodings of the media file, wherein each video encoding in the plurality of video encodings encodes the media file at a different video bit rate than other video encodings in the plurality of video encodings and includes a plurality of portions of video data;
for each of the plurality of video encodings:
identifying, in each of the plurality of portions of video data, one or more insertion points within the respective portion of video data at which to multiplex a portion of audio data;
padding at least one portion of video data to be aligned to a continuity count boundary, and
storing, in the video encoding, a file header which includes an indication of positions of the plurality of insertion points in the video encoding;

providing at least one audio encoding of the media file, wherein the audio encoding includes a header indicating a plurality of audio segments, each corresponding to one of the plurality of portions of video data; and
storing the plurality of video encodings and the audio encoding on a media delivery system in order to be streamed to a client device upon request, wherein the client device is configured to generate a multiplexed stream by multiplexing streamed portions of video data with streamed portions of audio segments using the indication of positions of the plurality of insertion points in the file header of the respective video encoding.

12. The computer-readable storage medium of claim 11, wherein each of the plurality of video encodings includes a sequence of one or more groups of pictures (GOPs).

13. The computer-readable storage medium of claim 12, wherein each GOP is encapsulated in a sequence MPEG-2 transport stream packets, and wherein padding at least one portion of video data to be aligned to a continuity count comprises padding the portion of video data with video filler packets such that each GOP begins with an MPEG-packet having a continuity count of 0 and ends with a packet having a continuity count of 15.

14. The computer-readable storage medium of claim 11, wherein the steps further comprise:
aligning at least one of the plurality of portions of video data to an encryption block boundary; and
aligning at least one of the plurality of audio segments to an encryption block boundary.

15. The computer-readable storage medium of claim 14, wherein aligning the at least one portion of video data comprises adding null padding packets to the portion of video data, borrowing packets from a subsequent portion of video data, or both; and
wherein aligning the at least one segment of audio data comprises adding null padding packets to the at least one segment of audio data, borrowing packets from a subsequent portion of video data, or both.

16. The computer-readable storage medium of claim 14, wherein the encryption block boundary is an AACS encryption block boundary.

17. The computer-readable storage medium of claim 11, wherein the steps further comprise:
receiving, from the client device, a request to stream the media file;
transmitting, to the client device, the file header for each of the plurality of video encodings;
transmitting, to the client device, the file header for the audio encoding;
in response to requests from the client device, streaming portions of video data from at least one of the video encodings to the client device and streaming audio segments form the audio encoding to the client device.

18. The computer-readable storage medium of claim 17, wherein the client device is configured to multiplex the streamed portions of video data with the streamed portions of audio segments to generate a multiplexed stream, and wherein the client device is further configured to present the multiplexed stream to a playback engine on the client device for decoding and playback.

19. The computer-readable storage medium of claim 18, wherein the client device is further configured to switch streaming portions of video data from a first one of the video encodings, to a second one of the video encodings.

20. The computer-readable storage medium of claim 19, wherein the client device is further configured to pad portions of video data streamed from the second one of the video encodings to match a size of a corresponding portion of video data in the first one of the video encodings prior to multiplexing the portions of video data streamed from the second one of the video encodings with the audio encoding.

21. A digital media content sever configured to encode a media file to allow on-device multiplexing of audio and video data and dynamic bit rate switching, the content server comprising:
a memory; and
a processing unit coupled to the memory and configured to store an encoding tool, the encoding tool configured to perform an operation, comprising:
providing a plurality of video encodings of the media file, wherein each video encoding in the plurality of video encodings encodes the media file at a different video bit rate than other video encodings in the plurality of video encodings and includes a plurality of portions of video data;
for each of the plurality of video encodings:
identifying, in each of the plurality of portions of video data, one or more insertion points within the respective portion of video data at which to multiplex a portion of audio data;
padding at least one portion of video data to be aligned to a continuity count boundary, and
storing, in the video encoding, a file header which includes an indication of positions of the plurality of insertion points in the video encoding;

providing at least one audio encoding of the media file, wherein the audio encoding includes a header indicating a plurality of audio segments, each corresponding to one of the plurality of portions of video data; and
storing the plurality of video encodings and the audio encoding on a media delivery system in order to be streamed to a client device upon request, wherein the client device is configured to generate a multiplexed stream by multiplexing streamed portions of video data with streamed portions of audio segments using the indication of positions of the plurality of insertion points in the file header of the respective video encoding.

22. The digital media content sever of claim 21, wherein each of the plurality of video encodings includes a sequence of one or more groups of pictures (GOPs).

23. The digital media content sever of claim 22, wherein each GOP is encapsulated in a sequence MPEG-2 transport stream packets, and wherein padding at least one portion of video data to be aligned to a continuity count boundary comprises padding the portion of video data with video filler packets such that each GOP begins with an MPEG-packet having a continuity count of 0 and ends with a packet having a continuity count of 15.

24. The digital media content sever of claim 21, wherein the steps further comprise:
aligning at least one of the plurality of portions of video data to an encryption block boundary; and
aligning at least one of the plurality of audio segments to an encryption block boundary.

25. The digital media content sever of claim 24, wherein aligning the at least one portion of video data comprises adding null padding packets to the portion of video data, borrowing packets from a subsequent portion of video data, or both; and
wherein aligning the at least one segment of audio data comprises adding null padding packets to the at least one segment of audio data, borrowing packets from a subsequent portion of video data, or both.

26. The digital media content sever of claim 24, wherein the encryption block boundary is an AACS encryption block boundary.

27. The digital media content sever of claim 21, wherein the steps further comprise:
receiving, from the client device, a request to stream the media file;
transmitting, to the client device, the file header for each of the plurality of video encodings;
transmitting, to the client device, the file header for the audio encoding;
in response to requests from the client device, streaming portions of video data from at least one of the video encodings to the client device and streaming audio segments form the audio encoding to the client device.

28. The digital media content sever of claim 27, wherein the client device is configured to multiplex the streamed portions of video data with the streamed portions of audio segments to generate a multiplexed stream, and wherein the client device is further configured to present the multiplexed stream to a playback engine on the client device for decoding and playback.

29. The digital media content sever of claim 28, wherein the client device is further configured to switch streaming portions of video data from a first one of the video encodings, to a second one of the video encodings.

30. The digital media content sever of claim 29, wherein the client device is further configured to pad portions of video data streamed from the second one of the video encodings to match a size of a corresponding portion of video data in the first one of the video encodings prior to multiplexing the portions of video data streamed from the second one of the video encodings with the audio encoding.

31. A computer-implemented method for multiplexing an audio stream and a video stream on a client device, the method comprising:
transmitting, to a streaming media server, a request to stream a media file stored on the streaming media server;
receiving, from the streaming media server, a first file header describing the content of each of a plurality of video encodings of the media file available from the streaming media server, wherein the first file header specifies one or more insertion points within each of the plurality of video encodings at which to insert a portion of audio data;
receiving, from the streaming media server, a second file header describing the content of at least one audio encodings of the media file available from the streaming media server;
transmitting, to the streaming media server, a request to download a first portion of video data from a first one of the plurality of video encodings and at least a first portion of audio data from the audio encoding;
receiving the requested first portion of video data and first portion of audio data; and
multiplexing, at the client device, the first portion of video data and first portion of audio based on the first file header and the second file header to generate a multiplexed stream for playback by a playback engine on the client device.

32. The method of claim 31, further comprising:
transmitting, to the streaming media server, a second request to download at second portion of video data from a second one of the plurality of video encodings and at least a second portion of audio data from the audio encoding;
receiving the requested second portion of video data and second portion of audio data; and
multiplexing the second portion of video data and second portion of audio for playback by the playback engine on the client device; and
adding the multiplexed second portion of video data and second portion of audio to the multiplexed stream, wherein the playback engine is configured to decode and playback the multiplexed stream.