[go: up one dir, main page]

CN118264839A - Method, device, medium and equipment for synchronously playing multiple live streams - Google Patents

Method, device, medium and equipment for synchronously playing multiple live streams Download PDF

Info

Publication number
CN118264839A
CN118264839A CN202410353686.6A CN202410353686A CN118264839A CN 118264839 A CN118264839 A CN 118264839A CN 202410353686 A CN202410353686 A CN 202410353686A CN 118264839 A CN118264839 A CN 118264839A
Authority
CN
China
Prior art keywords
live stream
live
synchronization information
frame
path
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410353686.6A
Other languages
Chinese (zh)
Inventor
陈昭杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202410353686.6A priority Critical patent/CN118264839A/en
Publication of CN118264839A publication Critical patent/CN118264839A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/4302Content synchronisation processes, e.g. decoder synchronisation
    • H04N21/4305Synchronising client clock from received content stream, e.g. locking decoder clock with encoder clock, extraction of the PCR packets
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2187Live feed
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/242Synchronization processes, e.g. processing of PCR [Program Clock References]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/4302Content synchronisation processes, e.g. decoder synchronisation
    • H04N21/4307Synchronising the rendering of multiple content streams or additional data on devices, e.g. synchronisation of audio on a mobile phone with the video output on the TV screen
    • H04N21/43072Synchronising the rendering of multiple content streams or additional data on devices, e.g. synchronisation of audio on a mobile phone with the video output on the TV screen of multiple content streams on the same device

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The embodiment of the disclosure provides a method, a device, a medium and equipment for synchronously playing a multi-path live stream. One embodiment of the method comprises the following steps: acquiring at least two paths of live streams, wherein key frames of each path of live stream carry synchronous information, and the synchronous information corresponds to the actual acquisition time of the frames; determining the synchronous information of non-key frames corresponding to the key frames of each path of live stream based on the synchronous information in the key frames of each path of live stream and the display time stamp PTS of each frame; and controlling the playing of each path of live stream based on the synchronous information of the currently played video frames of each path of live stream. According to the embodiment of the disclosure, synchronous playing of the multi-path live stream can be realized by carrying the synchronous information in the key frame.

Description

多路直播流同步播放的方法、装置、介质和设备Method, device, medium and equipment for synchronously playing multiple live streams

技术领域Technical Field

本公开实施例涉及视频处理技术领域,尤其涉及一种多路直播流同步播放的方法、装置、介质和设备。The embodiments of the present disclosure relate to the field of video processing technology, and in particular to a method, device, medium and equipment for synchronously playing multiple live streams.

背景技术Background technique

随着计算机技术和互联网技术的迅速发展,视频、直播等逐渐融入了人们的日常生活,并悄然改变着人们的生产、生活方式。实践中,在演唱会、赛事等直播中,可能存在同时播放多路直播流的场景,例如,赛事直播中同时播放赛事内容以及解说内容,或者演唱会中同时播放多个机位的内容。在这类场景下,需要多路直播内容能够保持同步,但是播放过程中每一路直播出现卡顿等问题的时机并不一样,不加干涉的情况下基本无法保证多路直播内容总是保持同步。这会造成极差的用户体验,甚至可能会酿成重大不良后果。With the rapid development of computer technology and Internet technology, videos and live broadcasts have gradually been integrated into people's daily lives, and are quietly changing people's production and lifestyles. In practice, in live broadcasts of concerts and events, there may be scenarios where multiple live streams are played simultaneously. For example, in live broadcasts of events, the event content and commentary content are played simultaneously, or in concerts, the content of multiple cameras is played simultaneously. In such scenarios, multiple live broadcasts need to be able to maintain synchronization, but the timing of freezes and other problems in each live broadcast during playback is different. Without interference, it is basically impossible to ensure that multiple live broadcasts are always synchronized. This will result in a very poor user experience and may even lead to major adverse consequences.

发明内容Summary of the invention

本公开的实施例描述了一种多路直播流同步播放的方法和装置,可以通过在关键帧中携带同步信息,实现多路直播流的同步播放。The embodiments of the present disclosure describe a method and device for synchronous playback of multiple live streams, which can achieve synchronous playback of multiple live streams by carrying synchronization information in key frames.

根据第一方面,提供了一种多路直播流同步播放的方法,上述方法包括:获取至少两路直播流,其中,各路直播流的关键帧中携带有同步信息,该同步信息对应于该帧的实际采集时间;基于各路直播流关键帧中的同步信息和各帧的显示时间戳PTS,确定各路直播流的与上述关键帧对应的非关键帧的同步信息;基于各路直播流的当前播放的视频帧的同步信息,控制对各路直播流的播放。According to a first aspect, a method for synchronously playing multiple live streams is provided, the method comprising: obtaining at least two live streams, wherein a key frame of each live stream carries synchronization information, and the synchronization information corresponds to an actual acquisition time of the frame; based on the synchronization information in the key frame of each live stream and a display timestamp PTS of each frame, determining the synchronization information of non-key frames of each live stream corresponding to the key frame; based on the synchronization information of a currently played video frame of each live stream, controlling the playback of each live stream.

在一个实施例中,上述方法还包括:在读取关键帧时,缓存关键帧的同步信息和显示时间戳PTS的映射关系;以及,上述基于各路直播流关键帧中的同步信息和各帧的显示时间戳PTS,确定各路直播流的与上述关键帧对应的非关键帧视频帧的同步信息,包括:在读取非关键帧时,基于缓存的映射关系、非关键帧的显示时间戳PTS计算非关键帧的同步信息。由此,实现了基于预先缓存的关键帧的同步信息和显示时间戳PTS的映射关系,确定各个非关键帧的同步信息。In one embodiment, the method further includes: when reading a key frame, caching the mapping relationship between the synchronization information of the key frame and the display timestamp PTS; and the method of determining the synchronization information of the non-key frame video frames corresponding to the key frame of each live stream based on the synchronization information in the key frame of each live stream and the display timestamp PTS of each frame includes: when reading a non-key frame, calculating the synchronization information of the non-key frame based on the cached mapping relationship and the display timestamp PTS of the non-key frame. Thus, the synchronization information of each non-key frame is determined based on the mapping relationship between the pre-cached key frame synchronization information and the display timestamp PTS.

在一个实施例中,上述至少两路直播流包括第一直播流和第二直播流,上述第一直播流被设置为主直播流,上述第二直播流被设置为从直播流;以及,上述基于各路直播流的当前播放的视频帧的同步信息,控制对各路直播流的播放,包括:基于上述主直播流和上述从直播流当前播放的视频帧的同步信息,控制对上述从直播流的播放,以与上述主直播流的播放同步。由此,通过控制从直播流的播放,实现从直播流与主直播流的同步播放。In one embodiment, the at least two live streams include a first live stream and a second live stream, the first live stream is set as a master live stream, and the second live stream is set as a slave live stream; and the controlling the playing of each live stream based on the synchronization information of the currently played video frames of each live stream includes: based on the synchronization information of the currently played video frames of the master live stream and the slave live stream, controlling the playing of the slave live stream to be synchronized with the playing of the master live stream. Thus, by controlling the playing of the slave live stream, the synchronous playing of the slave live stream and the master live stream is achieved.

在一个实施例中,播放上述主直播流的播放器实例为主播放器实例,播放上述从直播流的播放器实例为从播放器实例;以及,上述基于上述主直播流和上述从直播流当前播放的视频帧的同步信息,控制对上述从直播流的播放,以与上述主直播流的播放同步,包括:在上述从播放器实例所要播放的下一个视频帧的第一同步信息晚于上述主播放器实例当前播放的视频帧的第二同步信息、且上述第一同步信息和上述第二同步信息的第一差值小于或等于预设的第一阈值时,上述从播放器实例增大播放速度;在上述第一同步信息早于上述第二同步信息、且上述第一同步信息和上述第二同步信息的第二差值小于或者等于预设的第二阈值时,上述从播放器实例减小播放速度。由此,实现了在第一同步信息与第二同步信息之间差距较小的情况下,主直播流和从直播流的播放同步。In one embodiment, the player instance that plays the main live stream is a main player instance, and the player instance that plays the slave live stream is a slave player instance; and, based on the synchronization information of the main live stream and the video frame currently played by the slave live stream, the playback of the slave live stream is controlled to be synchronized with the playback of the main live stream, including: when the first synchronization information of the next video frame to be played by the slave player instance is later than the second synchronization information of the video frame currently played by the main player instance, and the first difference between the first synchronization information and the second synchronization information is less than or equal to the preset first threshold, the slave player instance increases the playback speed; when the first synchronization information is earlier than the second synchronization information, and the second difference between the first synchronization information and the second synchronization information is less than or equal to the preset second threshold, the slave player instance reduces the playback speed. In this way, the playback synchronization of the main live stream and the slave live stream is achieved when the gap between the first synchronization information and the second synchronization information is small.

在一个实施例中,上述基于上述主直播流和上述从直播流当前播放的视频帧的同步信息,控制对上述从直播流的播放,以与上述主直播流的播放同步,还包括:在上述第一同步信息晚于上述第二同步信息、且上述第一差值大于上述第一阈值,或者在上述第一同步信息早于上述第二同步信息、且上述第二差值大于上述第二阈值的情况下,上述从播放器实例重新拉取从直播流。由此,可以在主播放器实例和从播放器实例之间的播放差距较大时,快速实现同步。In one embodiment, the above-mentioned control of playing the above-mentioned slave live stream based on the synchronization information of the video frames currently played by the above-mentioned main live stream and the above-mentioned slave live stream to synchronize with the playing of the above-mentioned main live stream also includes: when the above-mentioned first synchronization information is later than the above-mentioned second synchronization information, and the above-mentioned first difference is greater than the above-mentioned first threshold, or when the above-mentioned first synchronization information is earlier than the above-mentioned second synchronization information, and the above-mentioned second difference is greater than the above-mentioned second threshold, the above-mentioned slave player instance re-pulls the slave live stream. In this way, when the playing gap between the main player instance and the slave player instance is large, synchronization can be quickly achieved.

在一个实施例中,上述重新拉取从直播流,包括:基于上述第一同步信息和第二同步信息的差值,重新拉取从直播流。由此,可以使重新拉取的从直播流更加准确。In one embodiment, the above-mentioned re-pulling the slave live stream includes: re-pulling the slave live stream based on the difference between the above-mentioned first synchronization information and the second synchronization information, thereby making the re-pulled slave live stream more accurate.

在一个实施例中,各路直播流的同步信息位于补充增强信息SEI中;以及,各路直播流的关键帧中的同步信息是基于时码发生器生成的时间码或者NTP服务器生成的UTC时间戳确定的。由此,可以将各路直播流的各视频帧的同步信息写入各视频帧的SEI中。In one embodiment, the synchronization information of each live stream is located in the supplemental enhancement information SEI; and the synchronization information in the key frame of each live stream is determined based on the time code generated by the time code generator or the UTC timestamp generated by the NTP server. Thus, the synchronization information of each video frame of each live stream can be written into the SEI of each video frame.

根据第二方面,提供了一种多路直播流同步播放的方法,上述方法由导播台执行,其中,上述方法包括:获取至少两路直播流,其中,各路直播流携带有各帧的实际采集时间;基于各路直播流中各帧的实际采集时间,确定各路直播流的同步信息;将各路直播流的同步信息写入各路直播流的关键帧中,以用于进行上述至少两路直播流的同步播放。According to the second aspect, a method for synchronous playback of multiple live streams is provided, which is executed by a director station, wherein the method includes: obtaining at least two live streams, wherein each live stream carries the actual acquisition time of each frame; based on the actual acquisition time of each frame in each live stream, determining the synchronization information of each live stream; writing the synchronization information of each live stream into the key frame of each live stream, so as to perform synchronous playback of the at least two live streams.

根据第三方面,提供了一种多路直播流同步播放的装置,包括:获取单元,配置为,获取至少两路直播流,其中,各路直播流的关键帧中携带有同步信息,该同步信息对应于该帧的实际采集时间;确定单元,配置为,基于各路直播流关键帧中的同步信息和各帧的显示时间戳PTS,确定各路直播流的与上述关键帧对应的非关键帧的同步信息;控制单元,配置为,基于各路直播流的当前播放的视频帧的同步信息,控制对各路直播流的播放。According to a third aspect, a device for synchronous playback of multiple live streams is provided, comprising: an acquisition unit, configured to acquire at least two live streams, wherein a key frame of each live stream carries synchronization information, and the synchronization information corresponds to an actual acquisition time of the frame; a determination unit, configured to determine, based on the synchronization information in the key frames of each live stream and a display timestamp PTS of each frame, synchronization information of non-key frames of each live stream corresponding to the above key frames; and a control unit, configured to control playback of each live stream based on the synchronization information of a currently played video frame of each live stream.

根据第四方面,提供了一种多路直播流同步播放的装置,部署于导播台,其中,上述装置包括:直播流获取单元,配置为,获取至少两路直播流,其中,各路直播流携带有各帧的实际采集时间;同步信息确定单元,配置为,基于各路直播流中各帧的实际采集时间,确定各路直播流的同步信息;同步播放单元,配置为,将各路直播流的同步信息写入各路直播流的关键帧中,以用于进行上述至少两路直播流的同步播放。According to a fourth aspect, a device for synchronous playback of multiple live streams is provided, which is deployed on a director's station, wherein the device includes: a live stream acquisition unit, configured to acquire at least two live streams, wherein each live stream carries the actual acquisition time of each frame; a synchronization information determination unit, configured to determine the synchronization information of each live stream based on the actual acquisition time of each frame in each live stream; and a synchronous playback unit, configured to write the synchronization information of each live stream into a key frame of each live stream, for synchronous playback of the at least two live streams.

根据第五方面,提供了一种计算机程序产品,包括计算机程序,上述计算机程序被处理器执行时实现如第一方面或第二方面中任一项上述的方法。According to a fifth aspect, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method as described in any one of the first aspect or the second aspect is implemented.

根据第六方面,提供了一种计算机可读存储介质,其上存储有计算机程序,当上述计算机程序在计算机中执行时,令上述计算机执行第一方面或第二方面中任一项上述的方法。According to the sixth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute any one of the methods in the first aspect or the second aspect.

根据第七方面,提供了一种电子设备,包括存储器和处理器,上述存储器中存储有可执行代码,上述处理器执行上述可执行代码时,实现第一方面或第二方面中任一项上述的方法。According to the seventh aspect, an electronic device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method of any one of the first aspect or the second aspect is implemented.

根据本公开实施例提供的多路直播流同步播放的方法和装置,首先可以获取至少两路直播流,各路直播流的关键帧中携带有同步信息,该同步信息可以对应于该帧的实际采集时间。然后,基于各路直播流关键帧中的同步信息和各帧的显示时间戳PTS,可以确定各路直播流的与关键帧对应的非关键帧的同步信息。最后,基于各路直播流的当前播放的视频帧的同步信息,可以控制对各路直播流的播放。由此,可以通过在关键帧中携带同步信息,实现多路直播流的同步播放。According to the method and device for synchronous playback of multiple live streams provided by the embodiments of the present disclosure, at least two live streams can be obtained first, and the key frames of each live stream carry synchronization information, and the synchronization information can correspond to the actual acquisition time of the frame. Then, based on the synchronization information in the key frames of each live stream and the display timestamp PTS of each frame, the synchronization information of the non-key frames corresponding to the key frames of each live stream can be determined. Finally, based on the synchronization information of the currently played video frames of each live stream, the playback of each live stream can be controlled. Therefore, the synchronous playback of multiple live streams can be achieved by carrying synchronization information in the key frames.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1示出了本公开实施例可以应用于其中的一个应用场景的示意图;FIG1 is a schematic diagram showing an application scenario in which an embodiment of the present disclosure can be applied;

图2示出了根据一个实施例的多路直播流同步播放的方法的流程示意图;FIG2 is a schematic diagram showing a flow chart of a method for synchronously playing multiple live streams according to an embodiment;

图3示出了在GOP的I帧中写入SEI信息的示意图;FIG3 is a schematic diagram showing a method of writing SEI information into an I frame of a GOP;

图4示出了根据又一个实施例的多路直播流同步播放的方法的流程示意图;FIG4 is a schematic flow chart showing a method for synchronously playing multiple live streams according to yet another embodiment;

图5示出了用于确定关键帧对应的非关键帧的同步信息的一个例子的示意图;FIG5 is a schematic diagram showing an example of determining synchronization information of non-key frames corresponding to key frames;

图6示出了根据一个实施例的多路直播流同步播放的装置的示意性框图;FIG6 shows a schematic block diagram of an apparatus for synchronously playing multiple live streams according to an embodiment;

图7示出了根据又一个实施例的多路直播流同步播放的装置的示意性框图;FIG7 shows a schematic block diagram of an apparatus for synchronously playing multiple live streams according to yet another embodiment;

图8示出了适于用来实现本申请实施例的电子设备的结构示意图。FIG8 shows a schematic structural diagram of an electronic device suitable for implementing an embodiment of the present application.

具体实施方式Detailed ways

可以理解的是,在使用本公开各实施例公开的技术方案之前,均应当依据相关法律法规通过恰当的方式对本公开所涉及个人信息的类型、使用范围、使用场景等告知用户并获得用户的授权。It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

例如,在响应于接收到用户的主动请求时,向用户发送提示信息,以明确地提示用户,其请求执行的操作将需要获取和使用到用户的个人信息。从而,使得用户可以根据提示信息来自主地选择是否向执行本公开技术方案的操作的电子设备、应用程序、服务器或存储介质等软件或硬件提供个人信息。For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

作为一种可选的但非限定性的实现方式,响应于接收到用户的主动请求,向用户发送提示信息的方式例如可以是弹窗的方式,弹窗中可以以文字的方式呈现提示信息。此外,弹窗中还可以承载供用户选择“同意”或者“不同意”向电子设备提供个人信息的选择控件。As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

可以理解的是,上述通知和获取用户授权过程仅是示意性的,不对本公开的实现方式构成限定,其它满足相关法律法规的方式也可应用于本公开的实现方式中。It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.

下面结合附图和实施例,对本公开提供的技术方案做进一步的详细描述。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。需要说明的是,在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合。The technical solution provided by the present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant inventions, rather than to limit the inventions. It should also be noted that, for ease of description, only the parts related to the relevant inventions are shown in the accompanying drawings. It should be noted that, in the absence of conflict, the embodiments of the present disclosure and the features in the embodiments can be combined with each other.

如前所述,在同时播放多路直播流的场景中,如果不对多路直播内容进行同步,会造成极差的用户体验。在一些实现方式中,为了实现前述场景中同时播放多路直播的要求,可以对视频编码或者封装做出一定要求。例如,可以采用MV-HEVC(Multiview HighEfficiency Video Coding,多视图高效视频编码)实现多视图同步播放,但是这种方式要求解码器可以支持MV-HEVC编码,而且MV-HEVC目前并未被广泛支持。As mentioned above, in the scenario of playing multiple live streams at the same time, if the multiple live content is not synchronized, it will cause a very poor user experience. In some implementations, in order to achieve the requirement of playing multiple live streams at the same time in the aforementioned scenario, certain requirements can be made for video encoding or packaging. For example, MV-HEVC (Multiview High Efficiency Video Coding) can be used to achieve multi-view synchronous playback, but this method requires the decoder to support MV-HEVC encoding, and MV-HEVC is not currently widely supported.

为此,本公开实施例提供了一种多路直播流同步播放的方法,可以不依赖于特定编码、封装等实现多路直播流的同步播放。图1示出了本公开实施例可以应用于其中的一个应用场景的示意图。如图1所示,在图1所示的场景中,首先可以将直播流1、直播流2、……直播流n,共n路直播流输入导播台101,其中,各路直播流携带有各帧的实际采集时间。导播台101可以基于各路直播流中各帧的实际采集时间,确定各路直播流的同步信息。之后,导播台101可以将各路直播流的同步信息写入各路直播流的关键帧中,从而得直播流1’、直播流2’、……直播流n’。这里,关键帧可以是指I帧,即,内部编码帧(Intra Coded Picture)。用户端的播放器102可以通过CDN(Content Delivery Network,内容分发网络)拉取直播流1’、直播流2’、……直播流n’。播放器102可以基于各路直播流关键帧中的同步信息和各帧的显示时间戳PTS(Presentation Time Stamp),确定各路直播流的与关键帧对应的非关键帧的同步信息。最后,播放器102可以基于各路直播流的当前播放的视频帧的同步信息,控制对各路直播流的播放,从而实现n路直播流的同步播放。由此,通过在关键帧中携带同步信息,实现多路直播流的同步播放。To this end, the embodiment of the present disclosure provides a method for synchronous playback of multiple live streams, which can achieve synchronous playback of multiple live streams without relying on specific encoding, encapsulation, etc. FIG. 1 shows a schematic diagram of an application scenario in which the embodiment of the present disclosure can be applied. As shown in FIG. 1, in the scenario shown in FIG. 1, first, live stream 1, live stream 2, ... live stream n, a total of n live streams can be input into the director station 101, wherein each live stream carries the actual acquisition time of each frame. The director station 101 can determine the synchronization information of each live stream based on the actual acquisition time of each frame in each live stream. Afterwards, the director station 101 can write the synchronization information of each live stream into the key frame of each live stream, thereby obtaining live stream 1', live stream 2', ... live stream n'. Here, the key frame can refer to an I frame, that is, an intra coded frame (Intra Coded Picture). The player 102 at the user end can pull live stream 1', live stream 2', ... live stream n' through CDN (Content Delivery Network). The player 102 can determine the synchronization information of the non-key frames corresponding to the key frames of each live stream based on the synchronization information in the key frames of each live stream and the presentation time stamp PTS (Presentation Time Stamp) of each frame. Finally, the player 102 can control the playback of each live stream based on the synchronization information of the currently played video frame of each live stream, thereby achieving synchronous playback of n live streams. Therefore, by carrying synchronization information in key frames, synchronous playback of multiple live streams is achieved.

继续参见图2,图2示出了根据一个实施例的多路直播流同步播放的方法的流程示意图。该方法可以通过导播台执行,这里,导播台可以是本地导播台,也可以是云端导播台。2, which shows a schematic flow chart of a method for synchronously playing multiple live streams according to an embodiment. The method can be executed by a director station, where the director station can be a local director station or a cloud director station.

如图2所示,该多路直播流同步播放的方法,可以包括以下步骤201-步骤203,具体的:As shown in FIG. 2 , the method for synchronously playing multiple live streams may include the following steps 201 to 203, specifically:

步骤201,获取至少两路直播流。Step 201, obtaining at least two live streams.

在本实施例中,通过设备采集或者转播得到的若干路直播流可以输入到导播台,各路直播流可以携带有各视频帧的实际采集时间。In this embodiment, several live streams acquired or rebroadcasted by a device may be input into a director's station, and each live stream may carry the actual acquisition time of each video frame.

作为一个示例,在可以使用时码发生器(Time Code Generator)的场景中,可以将多路直播流对应的多台视频采集设备接入同一个时码发生器,该时码发生器可以提供精确的时间码(time code)信号,这些时间码信号可以被多台视频采集设备接收并使用。这里,时间码可以是视频采集设备在采集图像信号的时候,针对每一幅图像记录的时间编码。As an example, in a scenario where a time code generator can be used, multiple video capture devices corresponding to multiple live streams can be connected to the same time code generator, which can provide accurate time code signals that can be received and used by multiple video capture devices. Here, the time code can be the time code recorded by the video capture device for each image when capturing image signals.

作为另一个示例,在不可以使用时码发生器的场景中,还可以将多路直播流对应的推流设备接入同一局域网,并在该局域网建立NTP(Network Time Protocol,网络时间协议)服务器。NTP服务器通过与国际标准时间源进行同步,可以为局域网内的推流设备提供准确的UTC(Coordinated Universal Time,协调世界时间)时间戳,对局域网内的推流设备进行统一授时。As another example, in a scenario where a time code generator cannot be used, the streaming devices corresponding to multiple live streams can be connected to the same local area network, and an NTP (Network Time Protocol) server can be established in the local area network. The NTP server can provide accurate UTC (Coordinated Universal Time) timestamps for streaming devices in the local area network by synchronizing with the international standard time source, and uniformly synchronize the time for streaming devices in the local area network.

步骤202,基于各路直播流中各帧的实际采集时间,确定各路直播流的同步信息。Step 202: Determine the synchronization information of each live stream based on the actual acquisition time of each frame in each live stream.

在本实施例中,导播台可以对各路直播流进行同步,具体而言,可以基于各路直播流中各帧的实际采集时间,确定各路直播流的同步信息。举例来说,导播台可以根据各路直播流的时间码或者UTC时间戳,生成同步信息。例如,可以对时间码和UTC时间戳的格式进行转换,转换为预定格式,并将格式转换后得到的信息作为同步信息。此外,导播也可以通过导播台观察各路直播流之间的差异,并根据差异给各路直播流加上相应时延。由此,导播台可以根据导播针对各路直播流所加的相应时延,调整各路直播流的同步信息,完成初步同步。In this embodiment, the director station can synchronize the various live streams. Specifically, the synchronization information of each live stream can be determined based on the actual acquisition time of each frame in each live stream. For example, the director station can generate synchronization information based on the time code or UTC timestamp of each live stream. For example, the format of the time code and the UTC timestamp can be converted to a predetermined format, and the information obtained after the format conversion is used as synchronization information. In addition, the director can also observe the differences between the various live streams through the director station, and add corresponding delays to each live stream according to the differences. As a result, the director station can adjust the synchronization information of each live stream according to the corresponding delay added by the director to each live stream, and complete the preliminary synchronization.

步骤203,将各路直播流的同步信息写入各路直播流的关键帧中,以用于进行至少两路直播流的同步播放。Step 203: write the synchronization information of each live stream into the key frame of each live stream, so as to perform synchronous playback of at least two live streams.

在本实施例中,导播台可以将各路直播流的各视频帧的同步信息写入各视频帧的SEI(Supplemental Enhancement Information,补充增强信息)中,得到同步SEI。这里,SEI是插入到音视频流中以传达额外信息的文本数据,可以与相关音视频内容精准同步,经过传输链路到达客户端。实践中,为了尽可能避免后续转码等环节对同步SEI序列的破坏(例如,转码过程中,如果存在帧率变化,可能会导致同步SEI与视频帧一一对应的关系被破坏,进而导致同步SEI时序异常),在导播台写入同步SEI时,可以仅将同步SEI写入关键帧中,以用于进行多路直播流的同步播放。In this embodiment, the director can write the synchronization information of each video frame of each live stream into the SEI (Supplemental Enhancement Information) of each video frame to obtain a synchronization SEI. Here, SEI is text data inserted into the audio and video stream to convey additional information, which can be accurately synchronized with the relevant audio and video content and reach the client through the transmission link. In practice, in order to avoid the destruction of the synchronization SEI sequence in subsequent transcoding and other links as much as possible (for example, during the transcoding process, if there is a change in frame rate, the one-to-one correspondence between the synchronization SEI and the video frame may be destroyed, which in turn causes the synchronization SEI timing abnormality), when the director writes the synchronization SEI, the synchronization SEI can be written only into the key frame for synchronous playback of multiple live streams.

作为示例,关键帧可以是指一个GOP(Group of Pictures,画面组)中的I帧,即,内部编码帧(Intra Coded Picture)。这里,GOP可以表示一组连续的画面。在MPEG(MovingPicture Experts Group,动态图像专家组)编码中,GOP是一个基本的存取单位,由连续的画面帧组成,这些帧可以包括I帧、P帧和B帧。其中,I帧可以表示内部编码帧,可以理解为一个完整的画面。P帧可以用表示前向预测帧,记录的是相对于I帧的变化,表示跟前一帧的差别。B帧可以表示双向内插帧,表示前后帧的差别。如图3所示,图3示出了在GOP的I帧中写入SEI信息的示意图。在图3所示的例子中,视频中的图像需要经过采集、编码、导播和转码等处理。在导播台写入同步SEI时,仅将同步SEI写入I帧中。可以理解,由于页面有限,图3所示的例子中仅示出了GOP N和GOP N+1两个GOP。实践中,视频中包括的GOP数量远远大于两个。As an example, a key frame may refer to an I frame in a GOP (Group of Pictures), that is, an intra coded frame (Intra Coded Picture). Here, GOP may represent a group of continuous pictures. In MPEG (Moving Picture Experts Group) encoding, GOP is a basic access unit, consisting of continuous picture frames, which may include I frames, P frames and B frames. Among them, I frame may represent an intra coded frame, which can be understood as a complete picture. P frame may be used to represent a forward prediction frame, which records the change relative to the I frame and represents the difference with the previous frame. B frame may represent a bidirectional interpolation frame, which represents the difference between the previous and next frames. As shown in FIG. 3, FIG. 3 shows a schematic diagram of writing SEI information in the I frame of GOP. In the example shown in FIG. 3, the image in the video needs to be processed by acquisition, encoding, directing and transcoding. When the director writes the synchronization SEI, the synchronization SEI is only written in the I frame. It can be understood that due to limited pages, only two GOPs, GOP N and GOP N+1, are shown in the example shown in FIG. In practice, the number of GOPs included in a video is much greater than two.

通过图2所描述方法,在关键帧中写入了同步信息的多路直播流,基于关键帧中写入的同步信息,多路直播流可以在客户端进行同步播放。Through the method described in FIG. 2 , multiple live streams with synchronization information written into key frames can be played synchronously on the client based on the synchronization information written into the key frames.

请参见图4,图4示出了根据又一个实施例的多路直播流同步播放的方法的流程示意图。该方法可以通过客户端执行。如图4所示,该多路直播流同步播放的方法,可以包括以下步骤401-步骤403,具体的:Please refer to Figure 4, which shows a schematic flow chart of a method for synchronously playing multiple live streams according to another embodiment. The method can be executed by a client. As shown in Figure 4, the method for synchronously playing multiple live streams can include the following steps 401-403, specifically:

步骤401,获取至少两路直播流。Step 401, obtaining at least two live streams.

在本实施例中,客户端可以通过网络拉取至少两路直播流,其中,各路直播流的关键帧中携带有同步信息,该同步信息对应于该关键帧的实际采集时间。这里,各路直播流的关键帧中携带的同步信息,可以是通过图2中所描述的方法写入的。各路直播流的同步信息可以位于补充增强信息SEI中。各路直播流的关键帧中的同步信息可以是,基于时码发生器生成的时间码、或者NTP服务器生成的UTC时间戳确定的。In this embodiment, the client can pull at least two live streams through the network, wherein the key frame of each live stream carries synchronization information, and the synchronization information corresponds to the actual acquisition time of the key frame. Here, the synchronization information carried in the key frame of each live stream can be written by the method described in Figure 2. The synchronization information of each live stream can be located in the supplementary enhancement information SEI. The synchronization information in the key frame of each live stream can be determined based on the time code generated by the time code generator or the UTC timestamp generated by the NTP server.

步骤402,基于各路直播流关键帧中的同步信息和各帧的显示时间戳PTS,确定各路直播流的与关键帧对应的非关键帧的同步信息。Step 402: Based on the synchronization information in the key frames of each live stream and the display timestamp PTS of each frame, the synchronization information of the non-key frames corresponding to the key frames of each live stream is determined.

在本实施例中,由于在向直播流写入同步信息的时候,为了避免转码等可能引入的同步SEI乱序问题,仅在直播流的I帧中写入了同步SEI。而为了实现帧级同步,需要对关键帧对应的非关键帧的同步信息进行确定。这里,与某一个关键帧对应的非关键帧,可以是指与该关键帧位于同一个GOP的非关键帧。举例来说,假设某一个GOP中依次包括I帧、P帧、B帧、B帧和B帧,则该GOP中与关键帧(即,I帧)对的非关键帧为P帧、B帧、B帧和B帧。本例中,可以基于各路直播流的关键帧中的同步信息和各帧的显示时间戳PTS,确定各路直播流的与关键帧对应的非关键帧的同步信息。In this embodiment, when writing synchronization information to the live stream, in order to avoid the synchronization SEI disorder problem that may be introduced by transcoding, the synchronization SEI is only written in the I frame of the live stream. In order to achieve frame-level synchronization, it is necessary to determine the synchronization information of the non-key frames corresponding to the key frames. Here, the non-key frame corresponding to a certain key frame may refer to a non-key frame in the same GOP as the key frame. For example, assuming that a certain GOP includes I frames, P frames, B frames, B frames and B frames in sequence, then the non-key frames corresponding to the key frames (i.e., I frames) in the GOP are P frames, B frames, B frames and B frames. In this example, the synchronization information of the non-key frames corresponding to the key frames of each live stream can be determined based on the synchronization information in the key frames of each live stream and the display timestamp PTS of each frame.

在一些实现方式中,当客户端用于播放直播流的播放器实例在读取关键帧时,可以缓存关键帧的同步信息和显示时间戳PTS的映射关系。该映射关系可以是指关键帧的同步信息与显示时间戳PTS的对应关系。基于此,上述步骤402可以具体如下进行:在读取非关键帧时,基于缓存的映射关系、非关键帧的显示时间戳PTS,计算非关键帧的同步信息。In some implementations, when a player instance used by a client to play a live stream reads a key frame, a mapping relationship between the synchronization information of the key frame and the display timestamp PTS can be cached. The mapping relationship can refer to the corresponding relationship between the synchronization information of the key frame and the display timestamp PTS. Based on this, the above step 402 can be specifically performed as follows: when reading a non-key frame, the synchronization information of the non-key frame is calculated based on the cached mapping relationship and the display timestamp PTS of the non-key frame.

举例来说,假设某一个I帧属于GOP N,该I帧对应的同步信息为T,该I帧对应的显示时间戳PTS为t,则播放器实例在读取到该I帧时,可以缓存T和t的对应关系。在读取该I帧对应的某一个非关键帧时,可以根据T和t的对应关系、该非关键帧的显示时间戳PTS,计算非关键帧的同步信息。例如,可以通过如下公式计算非关键帧的同步信息T’:For example, assuming that an I frame belongs to GOP N, the synchronization information corresponding to the I frame is T, and the display timestamp PTS corresponding to the I frame is t, then when the player instance reads the I frame, it can cache the correspondence between T and t. When reading a non-key frame corresponding to the I frame, the synchronization information of the non-key frame can be calculated based on the correspondence between T and t and the display timestamp PTS of the non-key frame. For example, the synchronization information T' of the non-key frame can be calculated using the following formula:

T’=T+(t’-t)。T’=T+(t’-t).

其中,t’可以表示非关键帧的显示时间戳PTS。如图5所示,图5示出了用于确定关键帧对应的非关键帧的同步信息的一个例子的示意图。在图5所示的例子中,包括GOP N和GOP N+1两个GOP,各个GOP中的非关键帧可以根据其对应的关键帧的映射关系,确定同步信息。可以理解,图5中显示的GOP的数量、各GOP中包含的帧数、以及各帧对应的同步信息和显示时间戳PTS等等,仅仅是示意性的,而对视频中GOP的数量、各GOP中包含的帧数、以及各帧对应的同步信息和显示时间戳PTS等的限定。Among them, t' can represent the display timestamp PTS of the non-key frame. As shown in Figure 5, Figure 5 shows a schematic diagram of an example for determining the synchronization information of the non-key frame corresponding to the key frame. In the example shown in Figure 5, two GOPs, GOP N and GOP N+1, are included. The non-key frames in each GOP can determine the synchronization information according to the mapping relationship between the key frames corresponding to them. It can be understood that the number of GOPs shown in Figure 5, the number of frames contained in each GOP, and the synchronization information and display timestamp PTS corresponding to each frame, etc., are only schematic, and the number of GOPs in the video, the number of frames contained in each GOP, and the synchronization information and display timestamp PTS corresponding to each frame are limited.

实践中,关键帧的同步信息和显示时间戳PTS的映射关系的获取时间先于非关键帧的获取时间,而由于缓存的存在,使得播放器实例中可能同时缓存了多组映射关系。例如,在获取GOP N时,可能已经缓存了GOP N+1和GOP N+2的数据,这使得GOP N+1和GOP N+2中关键帧的映射关系已经被获取。因此,在计算GOP N中的某一个非关键帧的同步信息时,需要寻找该非关键帧对应的关键帧。举例来说,可以在已缓存的映射关系中,将显示时间戳PTS小于该非关键帧的显示时间戳PTS的所有映射关系作为目标映射关系,将全部目标映射关系中的、显示时间戳PTS最大的映射关系对应的关键帧,作为该非关键帧对应的关键帧。In practice, the acquisition time of the mapping relationship between the synchronization information of the key frame and the display timestamp PTS is earlier than the acquisition time of the non-key frame, and due to the existence of the cache, multiple sets of mapping relationships may be cached in the player instance at the same time. For example, when obtaining GOP N, the data of GOP N+1 and GOP N+2 may have been cached, so that the mapping relationship of the key frames in GOP N+1 and GOP N+2 has been obtained. Therefore, when calculating the synchronization information of a non-key frame in GOP N, it is necessary to find the key frame corresponding to the non-key frame. For example, in the cached mapping relationships, all mapping relationships with a display timestamp PTS less than the display timestamp PTS of the non-key frame can be used as the target mapping relationship, and the key frame corresponding to the mapping relationship with the largest display timestamp PTS among all the target mapping relationships can be used as the key frame corresponding to the non-key frame.

通过本实现方式,可以基于预先缓存的关键帧的同步信息和显示时间戳PTS的映射关系,确定各个非关键帧的同步信息。Through this implementation, the synchronization information of each non-key frame can be determined based on the mapping relationship between the synchronization information of the pre-cached key frame and the display timestamp PTS.

步骤403,基于各路直播流的当前播放的视频帧的同步信息,控制对各路直播流的播放。Step 403: Control the playback of each live stream based on the synchronization information of the currently played video frame of each live stream.

在本实施例中,如果需要在同一个界面中同时播放多路直播流,通常需要使用多个播放器实例,每个播放器实例可以独立地加载和播放一路直播流,从而实现在同一个界面上同时展示多路直播流的效果。为了实现多路直播流的同步,可以基于各路直播流的当前播放的视频帧的同步信息,控制对各路直播流的播放。举例来说,可以将多路直播流注册到同一同步组,并选取多路直播流中的一路作为主直播流,其他路直播流通过调整播放速度与主直播流同步。In this embodiment, if multiple live streams need to be played simultaneously in the same interface, multiple player instances are usually required, and each player instance can independently load and play one live stream, thereby achieving the effect of displaying multiple live streams simultaneously on the same interface. In order to achieve synchronization of multiple live streams, the playback of each live stream can be controlled based on the synchronization information of the currently played video frame of each live stream. For example, multiple live streams can be registered to the same synchronization group, and one of the multiple live streams is selected as the main live stream, and the other live streams are synchronized with the main live stream by adjusting the playback speed.

举例来说,假设至少两路直播流中包括第一直播流和第二直播流,其中,第一直播流被设置为主直播流,第二直播流被设置为从直播流。基于此,上述步骤403可以具体包括:基于主直播流和从直播流当前播放的视频帧的同步信息,控制对从直播流的播放,以与主直播流的播放同步。For example, assuming that at least two live streams include a first live stream and a second live stream, wherein the first live stream is set as a master live stream and the second live stream is set as a slave live stream. Based on this, the above step 403 may specifically include: based on synchronization information of video frames currently played by the master live stream and the slave live stream, controlling the playback of the slave live stream to be synchronized with the playback of the master live stream.

在本例中,主直播流的播放进度作为从直播流的播放进度的参考,其自身不进行播放速度的调节。由此,通过控制从直播流的播放,实现从直播流与主直播流的同步播放。In this example, the playback progress of the main live stream is used as a reference for the playback progress of the slave live stream, and the playback speed is not adjusted by itself. Thus, by controlling the playback of the slave live stream, the synchronous playback of the slave live stream and the main live stream is achieved.

在一些实现方式中,假设播放主直播流的播放器实例为主播放器实例,播放从直播流的播放器实例为从播放器实例,则上述基于主直播流和从直播流当前播放的视频帧的同步信息,控制对从直播流的播放,可以具体包括以下情况a),b)和c),具体的:In some implementations, assuming that the player instance playing the main live stream is the main player instance, and the player instance playing the slave live stream is the slave player instance, then the above-mentioned control of the playback of the slave live stream based on the synchronization information of the video frames currently played by the main live stream and the slave live stream may specifically include the following cases a), b) and c), specifically:

a),在从播放器实例所要播放的下一个视频帧的第一同步信息晚于主播放器实例当前播放的视频帧的第二同步信息、且第一同步信息和第二同步信息的第一差值小于或者等于第一阈值时,从播放器实例增大播放速度。a) When the first synchronization information of the next video frame to be played by the slave player instance is later than the second synchronization information of the video frame currently played by the main player instance, and the first difference between the first synchronization information and the second synchronization information is less than or equal to a first threshold, the slave player instance increases the playback speed.

例如,假设主播放器实例当前播放的视频帧的同步信息为10s(秒),从播放器实例即将播放的下一个视频帧的同步信息为8s,则从播放器实例的播放进度晚于主播放器实例的播放进度。这里,播放进度,可以是指播放器实例某一时刻播放的那一帧对应的同步信息。比如,主播放器实例当前播放的视频帧的同步信息为10s,则主播放器实例的当前播放进度为10s。如果两者之间的播放进度差值小于或者等于预设的追赶阈值,则可以增大从播放器实例的播放速度。比如,按预设比例增大播放速度。又比如,按两者之间的播放进度差值的大小增大播放速度,差值越大增大的播放速度的量越大。这里,追赶阈值可以是人工设置的一个值。For example, assuming that the synchronization information of the video frame currently played by the main player instance is 10s (seconds), and the synchronization information of the next video frame to be played by the slave player instance is 8s, the playback progress of the slave player instance is later than the playback progress of the main player instance. Here, the playback progress may refer to the synchronization information corresponding to the frame played by the player instance at a certain moment. For example, if the synchronization information of the video frame currently played by the main player instance is 10s, then the current playback progress of the main player instance is 10s. If the playback progress difference between the two is less than or equal to the preset catch-up threshold, the playback speed of the slave player instance can be increased. For example, the playback speed is increased according to a preset ratio. For another example, the playback speed is increased according to the size of the playback progress difference between the two, and the larger the difference, the greater the increase in the playback speed. Here, the catch-up threshold may be a manually set value.

b),在第一同步信息早于第二同步信息、且第一同步信息和第二同步信息的第二差值小于或者等于预设的第二阈值时,从播放器实例减小播放速度。b) when the first synchronization information is earlier than the second synchronization information and a second difference between the first synchronization information and the second synchronization information is less than or equal to a preset second threshold, reducing the playback speed from the player instance.

例如,假设主播放器实例当前播放的视频帧的同步信息为10s,从播放器实例即将播放的下一个视频帧的同步信息为12s,则从播放器实例的播放进度早于主播放器实例的播放进度。如果两者之间的播放进度差值小于或者等于慢放阈值,则可以减小从播放器实例的播放速度。比如,按预设比例减小播放速度。又比如,按两者之间的播放进度差值的大小减小播放速度,差值越大减小的播放速度的量越大。For example, assuming that the synchronization information of the video frame currently played by the main player instance is 10s, and the synchronization information of the next video frame to be played by the slave player instance is 12s, the playback progress of the slave player instance is earlier than that of the main player instance. If the difference in playback progress between the two is less than or equal to the slow-motion threshold, the playback speed of the slave player instance can be reduced. For example, the playback speed can be reduced according to a preset ratio. For another example, the playback speed can be reduced according to the size of the difference in playback progress between the two. The larger the difference, the greater the reduction in playback speed.

由以上描述可知,通过a)和b)实现了在第一同步信息与第二同步信息之间播放差距较小的情况下,主直播流和从直播流的播放同步。From the above description, it can be seen that a) and b) achieve synchronization of playback of the main live stream and the slave live stream when the playback gap between the first synchronization information and the second synchronization information is small.

c),在第一同步信息晚于第二同步信息、且第一差值大于第一阈值的情况下,或者,在第一同步信息早于第二同步信息、且第二差值大于第二阈值的情况下,从播放器实例重新拉取从直播流。c) When the first synchronization information is later than the second synchronization information and the first difference is greater than the first threshold, or when the first synchronization information is earlier than the second synchronization information and the second difference is greater than the second threshold, re-pull the live stream from the player instance.

这里,当从播放器实例和主播放器实例之间的播放进度差值大于追赶阈值或者慢放阈值时,从播放器实例可以通过重新拉取从直播流的方式,实现快速同步。例如,可以重新从网络拉取最新的从直播流。又例如,可以根据主播放器实例当前播放的视频帧的第二同步信息拉取从直播流,比如,拉取从直播流中同步信息位于第二同步信息之后的视频帧。通过本实现方式,可以在主播放器实例和从播放器实例之间的播放差距较大时,快速实现同步。Here, when the difference in playback progress between the slave player instance and the master player instance is greater than the catch-up threshold or the slow-motion threshold, the slave player instance can achieve fast synchronization by re-pulling the slave live stream. For example, the latest slave live stream can be re-pulled from the network. For another example, the slave live stream can be pulled based on the second synchronization information of the video frame currently played by the master player instance, for example, the video frame whose synchronization information in the slave live stream is after the second synchronization information is pulled. Through this implementation method, synchronization can be quickly achieved when the playback gap between the master player instance and the slave player instance is large.

在一些实现方式中,从播放器实例重新拉取到的从直播流的同步信息可能会过于靠后,比如,假设主播放器实例当前播放的视频帧的同步信息为10s,而从播放器实例重新拉取到的从直播流的视频帧的同步信息为15s。显然,从播放器实例拉取的直播流的同步信息过于靠后,直接播放会造成与主直播流的不同步。为了避免从播放器拉取到的从直播流的同步信息过于靠后,可以基于第一同步信息和第二同步信息的差值,重新拉取从直播流。例如,如果第一同步信息晚于第二同步信息、且两者之间的时间差值t1大于第一阈值,则从播放器实例向后偏移t1重新拉取从直播流。又例如,如果第一同步信息早于第二同步信息、且两者之间的时间差值t2大于第二阈值,则从播放器向前偏移t2重新拉取从直播流。通过本实现方式,可以在主播放器实例和从播放器实例之间的播放差距较大时,实现快速同步,且可以使从播放器实例重新拉取的从直播流更加准确。In some implementations, the synchronization information of the slave live stream re-pulled from the player instance may be too late. For example, assume that the synchronization information of the video frame currently played by the main player instance is 10s, and the synchronization information of the video frame of the slave live stream re-pulled from the player instance is 15s. Obviously, the synchronization information of the live stream pulled from the player instance is too late, and direct playback will cause it to be out of sync with the main live stream. In order to avoid the synchronization information of the slave live stream pulled from the player being too late, the slave live stream can be re-pulled based on the difference between the first synchronization information and the second synchronization information. For example, if the first synchronization information is later than the second synchronization information, and the time difference t1 between the two is greater than the first threshold, the slave live stream is re-pulled by offsetting t1 backward from the player instance. For another example, if the first synchronization information is earlier than the second synchronization information, and the time difference t2 between the two is greater than the second threshold, the slave live stream is re-pulled by offsetting t2 forward from the player. Through this implementation, fast synchronization can be achieved when the playback gap between the master player instance and the slave player instance is large, and the slave live stream re-pulled from the slave player instance can be made more accurate.

回顾以上过程,在本公开的上述实施例中,首先可以获取至少两路直播流,各路直播流的关键帧中携带有同步信息,该同步信息可以对应于该帧的实际采集时间。然后,基于各路直播流关键帧中的同步信息和各帧的显示时间戳PTS,可以确定各路直播流的与关键帧对应的非关键帧的同步信息。最后,基于各路直播流的当前播放的视频帧的同步信息,可以控制对各路直播流的播放。由此,可以通过在关键帧中携带同步信息,实现多路直播流的同步播放。Reviewing the above process, in the above embodiment of the present disclosure, at least two live streams can be obtained first, and the key frames of each live stream carry synchronization information, which can correspond to the actual acquisition time of the frame. Then, based on the synchronization information in the key frames of each live stream and the display timestamp PTS of each frame, the synchronization information of the non-key frames corresponding to the key frames of each live stream can be determined. Finally, based on the synchronization information of the currently played video frames of each live stream, the playback of each live stream can be controlled. Therefore, by carrying synchronization information in the key frames, the synchronous playback of multiple live streams can be achieved.

根据另一方面的实施例,提供了一种多路直播流同步播放的装置。上述多路直播流同步播放的装置可以部署于客户端。According to another embodiment, a device for synchronously playing multiple live streams is provided. The device for synchronously playing multiple live streams can be deployed on a client.

图6示出了根据一个实施例的多路直播流同步播放的装置的示意性框图。图6所示装置用于执行图4所示方法。如图6所示,该多路直播流同步播放的装置600包括:获取单元601,配置为,获取至少两路直播流,其中,各路直播流的关键帧中携带有同步信息,该同步信息对应于该帧的实际采集时间;确定单元602,配置为,基于各路直播流关键帧中的同步信息和各帧的显示时间戳PTS,确定各路直播流的与上述关键帧对应的非关键帧的同步信息;控制单元603,配置为,基于各路直播流的当前播放的视频帧的同步信息,控制对各路直播流的播放。FIG6 shows a schematic block diagram of an apparatus for synchronously playing multiple live streams according to an embodiment. The apparatus shown in FIG6 is used to execute the method shown in FIG4. As shown in FIG6, the apparatus 600 for synchronously playing multiple live streams includes: an acquisition unit 601, configured to acquire at least two live streams, wherein the key frames of each live stream carry synchronization information, and the synchronization information corresponds to the actual acquisition time of the frame; a determination unit 602, configured to determine the synchronization information of the non-key frames corresponding to the above key frames of each live stream based on the synchronization information in the key frames of each live stream and the display timestamp PTS of each frame; and a control unit 603, configured to control the playback of each live stream based on the synchronization information of the currently played video frame of each live stream.

在本实施例的一些可选的实现方式中,上述装置600还包括:缓存单元(图中未示出),配置为,在读取关键帧时,缓存关键帧的同步信息和显示时间戳PTS的映射关系;以及,确定单元602进一步配置为:在读取非关键帧时,基于缓存的映射关系、非关键帧的显示时间戳PTS计算非关键帧的同步信息。In some optional implementations of this embodiment, the above-mentioned device 600 also includes: a cache unit (not shown in the figure), configured to cache the mapping relationship between the synchronization information of the key frame and the display timestamp PTS when reading the key frame; and the determination unit 602 is further configured to: when reading the non-key frame, calculate the synchronization information of the non-key frame based on the cached mapping relationship and the display timestamp PTS of the non-key frame.

在本实施例的一些可选的实现方式中,上述至少两路直播流包括第一直播流和第二直播流,上述第一直播流被设置为主直播流,上述第二直播流被设置为从直播流;以及,控制单元603包括:播放控制单元(图中未示出),配置为,基于上述主直播流和上述从直播流当前播放的视频帧的同步信息,控制对上述从直播流的播放,以与上述主直播流的播放同步。In some optional implementations of this embodiment, the at least two live streams include a first live stream and a second live stream, the first live stream is set as a main live stream, and the second live stream is set as a slave live stream; and the control unit 603 includes: a playback control unit (not shown in the figure), configured to control the playback of the slave live stream based on synchronization information of the main live stream and the video frames currently played by the slave live stream, so as to be synchronized with the playback of the main live stream.

在本实施例的一些可选的实现方式中,播放上述主直播流的播放器实例为主播放器实例,播放上述从直播流的播放器实例为从播放器实例;以及,上述播放控制单元进一步配置为:在上述从播放器实例所要播放的下一个视频帧的第一同步信息晚于上述主播放器实例当前播放的视频帧的第二同步信息、且上述第一同步信息和上述第二同步信息的第一差值小于或等于预设的第一阈值时,上述从播放器实例增大播放速度;在上述第一同步信息早于上述第二同步信息、且上述第一同步信息和上述第二同步信息的第二差值小于或者等于预设的第二阈值时,上述从播放器实例减小播放速度。In some optional implementations of the present embodiment, the player instance that plays the main live stream is a master player instance, and the player instance that plays the slave live stream is a slave player instance; and the playback control unit is further configured as: when the first synchronization information of the next video frame to be played by the slave player instance is later than the second synchronization information of the video frame currently played by the main player instance, and the first difference between the first synchronization information and the second synchronization information is less than or equal to a preset first threshold, the slave player instance increases the playback speed; when the first synchronization information is earlier than the second synchronization information, and the second difference between the first synchronization information and the second synchronization information is less than or equal to a preset second threshold, the slave player instance reduces the playback speed.

在本实施例的一些可选的实现方式中,上述播放控制单元还进一步配置为:在上述第一同步信息晚于上述第二同步信息、且上述第一差值大于上述第一阈值,或者在上述第一同步信息早于上述第二同步信息、且上述第二差值大于上述第二阈值的情况下,上述从播放器实例重新拉取从直播流。In some optional implementations of the present embodiment, the playback control unit is further configured to: when the first synchronization information is later than the second synchronization information and the first difference is greater than the first threshold, or when the first synchronization information is earlier than the second synchronization information and the second difference is greater than the second threshold, the live stream is re-pulled from the player instance.

在本实施例的一些可选的实现方式中,上述重新拉取从直播流,包括:基于上述第一同步信息和第二同步信息的差值,重新拉取从直播流。In some optional implementations of this embodiment, the above-mentioned re-pulling the slave live stream includes: re-pulling the slave live stream based on the difference between the above-mentioned first synchronization information and the second synchronization information.

在本实施例的一些可选的实现方式中,各路直播流的同步信息位于补充增强信息SEI中;以及,各路直播流的关键帧中的同步信息是基于时码发生器生成的时间码或者NTP服务器生成的UTC时间戳确定的。In some optional implementations of this embodiment, the synchronization information of each live stream is located in the supplemental enhancement information SEI; and the synchronization information in the key frame of each live stream is determined based on the time code generated by the time code generator or the UTC timestamp generated by the NTP server.

根据另一方面的实施例,提供了又一种多路直播流同步播放的装置。上述多路直播流同步播放的装置可以部署于导播台。According to another embodiment, another device for synchronously playing multiple live streams is provided. The device for synchronously playing multiple live streams can be deployed in a director station.

图7示出了根据又一个实施例的多路直播流同步播放的装置的示意性框图。图7所示装置用于执行图2所示方法。如图7所示,该多路直播流同步播放的装置700包括:直播流获取单元701,配置为,获取至少两路直播流,其中,各路直播流携带有各帧的实际采集时间;同步信息确定单元702,配置为,基于各路直播流中各帧的实际采集时间,确定各路直播流的同步信息;同步播放单元703,配置为,将各路直播流的同步信息写入各路直播流的关键帧中,以用于进行上述至少两路直播流的同步播放。FIG7 shows a schematic block diagram of an apparatus for synchronously playing multiple live streams according to another embodiment. The apparatus shown in FIG7 is used to execute the method shown in FIG2. As shown in FIG7, the apparatus 700 for synchronously playing multiple live streams includes: a live stream acquisition unit 701, configured to acquire at least two live streams, wherein each live stream carries the actual acquisition time of each frame; a synchronization information determination unit 702, configured to determine the synchronization information of each live stream based on the actual acquisition time of each frame in each live stream; and a synchronous playback unit 703, configured to write the synchronization information of each live stream into the key frame of each live stream, so as to perform the synchronous playback of the at least two live streams.

上述装置实施例与方法实施例相对应,具体说明可以参见方法实施例部分的描述,此处不再赘述。装置实施例是基于对应的方法实施例得到,与对应的方法实施例具有同样的技术效果,具体说明可参见对应的方法实施例。The above device embodiments correspond to the method embodiments. For specific descriptions, please refer to the description of the method embodiments, which will not be repeated here. The device embodiments are obtained based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments. For specific descriptions, please refer to the corresponding method embodiments.

根据另一方面的实施例,还提供一种计算机可读存储介质,其上存储有计算机程序,当上述计算机程序在计算机中执行时,令计算机执行图2或4所描述的方法。According to another aspect of the embodiment, a computer-readable storage medium is further provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method described in FIG. 2 or 4 .

根据再一方面的实施例,还提供一种电子设备,包括存储器和处理器,其特征在于,上述存储器中存储有可执行代码,上述处理器执行上述可执行代码时,实现图2或4所描述的方法。According to yet another embodiment, there is further provided an electronic device, including a memory and a processor, wherein executable code is stored in the memory, and when the processor executes the executable code, the method described in FIG. 2 or 4 is implemented.

上述内容对本公开的特定实施例进行了描述,其他实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行,并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要按照示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的,或者可能是有利的。The foregoing describes specific embodiments of the present disclosure, and other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims may be performed in an order different from that in the embodiments, and the desired results may still be achieved. In addition, the processes depicted in the accompanying drawings do not necessarily have to be performed in the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible, or may be advantageous.

下面参考图8,其示出了适于用来实现本申请实施例的电子设备800的结构示意图。图8示出的电子设备仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。Referring to Fig. 8, a schematic diagram of the structure of an electronic device 800 suitable for implementing the embodiments of the present application is shown. The electronic device shown in Fig. 8 is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

如图8所示,电子设备800可以包括处理装置(例如中央处理器、图形处理器等)801,其可以根据存储在只读存储器(ROM)802中的程序或者从存储装置808加载到随机访问存储器(RAM)803中的程序而执行各种适当的动作和处理。在RAM803中,还存储有电子设备800操作所需的各种程序和数据。处理装置801、ROM802以及RAM803通过总线804彼此相连。输入/输出(I/O)接口805也连接至总线804。As shown in Figure 8, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.

通常,以下装置可以连接至I/O接口805:包括例如触摸屏、触摸板、键盘、鼠标等的输入装置806;包括例如液晶显示器(LCD,Liquid Crystal Di splay)、扬声器、振动器等的输出装置807;包括例如磁带、硬盘等的存储装置808;以及通信装置809。通信装置809可以允许电子设备800与其他设备进行无线或有线通信以交换数据。虽然图8示出了具有各种装置的电子设备800,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。图8中示出的每个方框可以代表一个装置,也可以根据需要代表多个装置。Typically, the following devices can be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, a touchpad, a keyboard, a mouse, etc.; output devices 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 808 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 809. The communication device 809 can allow the electronic device 800 to communicate with other devices wirelessly or by wire to exchange data. Although FIG. 8 shows an electronic device 800 with various devices, it should be understood that it is not required to implement or have all the devices shown. More or fewer devices may be implemented or provided alternatively. Each box shown in FIG. 8 may represent one device, or may represent multiple devices as needed.

特别地,根据本申请的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本申请的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置809从网络上被下载和安装,或者从存储装置808被安装,或者从ROM802被安装。在该计算机程序被处理装置801执行时,执行本申请的实施例的方法中限定的上述功能。In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 809, or installed from the storage device 808, or installed from the ROM 802. When the computer program is executed by the processing device 801, the above-mentioned functions defined in the method of the embodiment of the present application are executed.

本公开实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行本公开所提供的所述方法。The embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method provided by the present disclosure.

需要说明的是,本公开的实施例所述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开的实施例中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开的实施例中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(Radio Frequency,射频)等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium described in the embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the embodiments of the present disclosure, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:获取至少两路直播流,其中,各路直播流的关键帧中携带有同步信息,该同步信息对应于该帧的实际采集时间;基于各路直播流关键帧中的同步信息和各帧的显示时间戳PTS,确定各路直播流的与上述关键帧对应的非关键帧的同步信息;基于各路直播流的当前播放的视频帧的同步信息,控制对各路直播流的播放。The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains at least two live streams, wherein the key frames of each live stream carry synchronization information, and the synchronization information corresponds to the actual acquisition time of the frame; based on the synchronization information in the key frames of each live stream and the display timestamp PTS of each frame, determines the synchronization information of the non-key frames of each live stream corresponding to the key frames; based on the synchronization information of the currently played video frames of each live stream, controls the playback of each live stream.

可以以一种或多种程序设计语言或其组合来编写用于执行本公开实施例的操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或电子设备上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing the operations of the disclosed embodiments may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or electronic device. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

本公开中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于存储介质和计算设备实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in the present disclosure is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the storage medium and computing device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

本领域技术人员应该可以意识到,在上述一个或多个示例中,本发明实施例所描述的功能可以用硬件、软件、固件或它们的任意组合来实现。当使用软件实现时,可以将这些功能存储在计算机可读介质中或者作为计算机可读介质上的一个或多个指令或代码进行传输。Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present invention can be implemented by hardware, software, firmware, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

以上所述的具体实施方式,对本发明实施例的目的、技术方案和有益效果进行了进一步的详细说明。所应理解的是,以上所述仅为本发明实施例的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的技术方案的基础之上所做的任何修改、等同替换、改进等,均应包括在本发明的保护范围之内。The specific implementation methods described above further describe the purpose, technical solutions and beneficial effects of the embodiments of the present invention in detail. It should be understood that the above description is only a specific implementation method of the embodiments of the present invention and is not intended to limit the scope of protection of the present invention. Any modification, equivalent replacement, improvement, etc. made on the basis of the technical solution of the present invention shall be included in the scope of protection of the present invention.

Claims (12)

1. A method for synchronously playing multiple live streams, the method comprising:
Acquiring at least two paths of live streams, wherein key frames of each path of live stream carry synchronous information, and the synchronous information corresponds to the actual acquisition time of the frames;
Determining the synchronous information of non-key frames corresponding to the key frames of each path of live stream based on the synchronous information in the key frames of each path of live stream and the display time stamp PTS of each frame;
and controlling the playing of each path of live stream based on the synchronous information of the currently played video frames of each path of live stream.
2. The method of claim 1, wherein the method further comprises:
when a key frame is read, the mapping relation between the synchronous information of the key frame and the display time stamp PTS is cached; and
The determining the synchronization information of the video frames of the non-key frames of each live stream corresponding to the key frames based on the synchronization information in the key frames of each live stream and the display time stamp PTS of each frame comprises the following steps:
when the non-key frame is read, the synchronous information of the non-key frame is calculated based on the cached mapping relation and the display time stamp PTS of the non-key frame.
3. The method of claim 1, wherein the at least two live streams include a first live stream and a second live stream, the first live stream being set as a master live stream and the second live stream being set as a slave live stream; and controlling playing of each path of live stream based on the synchronization information of the currently played video frame of each path of live stream, including:
And controlling the playing of the slave live stream based on the synchronous information of the video frames currently played by the master live stream and the slave live stream so as to be synchronous with the playing of the master live stream.
4. A method according to claim 3, wherein the player instance playing the master live stream is a master player instance and the player instance playing the slave live stream is a slave player instance; and controlling playing of the slave live stream based on the synchronization information of the video frames currently played by the master live stream and the slave live stream so as to synchronize with the playing of the master live stream, wherein the method comprises the following steps:
When the first synchronization information of the next video frame to be played by the slave player instance is later than the second synchronization information of the video frame currently played by the master player instance, and the first difference value between the first synchronization information and the second synchronization information is smaller than or equal to a preset first threshold value, the slave player instance increases the playing speed;
And when the first synchronization information is earlier than the second synchronization information and the second difference value between the first synchronization information and the second synchronization information is smaller than or equal to a preset second threshold value, the slave player instance reduces the playing speed.
5. The method of claim 4, wherein the controlling the playing of the slave live stream to synchronize with the playing of the master live stream based on synchronization information of video frames currently played by the master live stream and the slave live stream, further comprises:
The slave player instance re-pulls the slave live stream if the first synchronization information is later than the second synchronization information and the first difference is greater than the first threshold, or if the first synchronization information is earlier than the second synchronization information and the second difference is greater than the second threshold.
6. The method of claim 5, wherein the re-pulling the slave live stream comprises:
And re-pulling the slave live stream based on the difference value of the first synchronization information and the second synchronization information.
7. The method of claim 1, wherein the synchronization information of each live stream is located in supplemental enhancement information SEI; and the synchronization information in the key frames of each live stream is determined based on the time code generated by the time code generator or the UTC time stamp generated by the NTP server.
8. A method of synchronized playback of a multi-channel live stream, the method performed by a director, wherein the method comprises:
acquiring at least two paths of live broadcast streams, wherein each path of live broadcast stream carries the actual acquisition time of each frame;
determining synchronous information of each path of live broadcast stream based on actual acquisition time of each frame in each path of live broadcast stream;
and writing the synchronous information of each path of live broadcast stream into the key frames of each path of live broadcast stream so as to synchronously play the at least two paths of live broadcast streams.
9. A device for synchronously playing multiple live streams, comprising:
the acquisition unit is configured to acquire at least two paths of live streams, wherein key frames of each path of live stream carry synchronous information, and the synchronous information corresponds to the actual acquisition time of the frames;
A determining unit configured to determine synchronization information of non-key frames corresponding to key frames of each live stream based on synchronization information in key frames of each live stream and display time stamps PTS of each frame;
and the control unit is configured to control the playing of each path of live stream based on the synchronous information of the currently played video frames of each path of live stream.
10. A device for synchronously playing multiple paths of live streams, deployed on a broadcast guiding station, wherein the device comprises:
the live broadcast stream acquisition unit is configured to acquire at least two paths of live broadcast streams, wherein each path of live broadcast stream carries the actual acquisition time of each frame;
the synchronization information determining unit is configured to determine synchronization information of each path of live stream based on actual acquisition time of each frame in each path of live stream;
And the synchronous playing unit is configured to write the synchronous information of each path of live stream into the key frames of each path of live stream so as to be used for synchronously playing the at least two paths of live streams.
11. A computer readable storage medium having stored thereon a computer program which, when executed in a computer, causes the computer to perform the method of any of claims 1-8.
12. An electronic device comprising a memory having executable code stored therein and a processor, which when executing the executable code, implements the method of any of claims 1-8.
CN202410353686.6A 2024-03-26 2024-03-26 Method, device, medium and equipment for synchronously playing multiple live streams Pending CN118264839A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410353686.6A CN118264839A (en) 2024-03-26 2024-03-26 Method, device, medium and equipment for synchronously playing multiple live streams

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410353686.6A CN118264839A (en) 2024-03-26 2024-03-26 Method, device, medium and equipment for synchronously playing multiple live streams

Publications (1)

Publication Number Publication Date
CN118264839A true CN118264839A (en) 2024-06-28

Family

ID=91606232

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410353686.6A Pending CN118264839A (en) 2024-03-26 2024-03-26 Method, device, medium and equipment for synchronously playing multiple live streams

Country Status (1)

Country Link
CN (1) CN118264839A (en)

Similar Documents

Publication Publication Date Title
KR101932793B1 (en) Distributed control of synchronized content
KR102469142B1 (en) Dynamic playback of transition frames while transitioning between media stream playbacks
JP6737922B2 (en) Transmission method, reception method, transmission device, and reception device
JP5903924B2 (en) Receiving apparatus and subtitle processing method
WO2017107578A1 (en) Streaming media and caption instant synchronization displaying and matching processing method, device and system
US10856018B2 (en) Clock synchronization techniques including modification of sample rate conversion
WO2020056877A1 (en) Method and device for adjusting timestamp of live broadcast video
WO2011153868A1 (en) Channel switching method, apparatus and system
JP2015515208A (en) Buffer management method for synchronization of correlated media presentations
WO2019170073A1 (en) Media playback
WO2021082642A1 (en) Video playing control method and system
JP2009284282A (en) Content server, information processing apparatus, network device, content distribution method, information processing method, and content distribution system
CN111182322B (en) Director control method and device, electronic equipment and storage medium
JP4294933B2 (en) Multimedia content editing apparatus and multimedia content reproducing apparatus
CN114079813A (en) Picture synchronization method, encoding method, video playback device and video encoding device
CN112929713B (en) Data synchronization method, device, terminal and storage medium
US20240107087A1 (en) Server, terminal and non-transitory computer-readable medium
JP4735666B2 (en) Content server, information processing apparatus, network device, content distribution method, information processing method, and content distribution system
JP7365212B2 (en) Video playback device, video playback system, and video playback method
CN118264839A (en) Method, device, medium and equipment for synchronously playing multiple live streams
CN115484483B (en) Streaming media audio and video synchronization method, terminal equipment, control device and medium
CN116599944A (en) Method, device, medium and equipment for synchronizing multipath media streams
JP7275212B2 (en) Transmission method, reception method, transmission device and reception device
CN115665493A (en) Large-screen splicing device, splicer, playback control method and system supporting recording and broadcasting
WO2010146780A1 (en) Playback device and content playback method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination