WO2017113717A1 - 视频播放方法、视频播放器及电子装置 - Google Patents
视频播放方法、视频播放器及电子装置 Download PDFInfo
- Publication number
- WO2017113717A1 WO2017113717A1 PCT/CN2016/089236 CN2016089236W WO2017113717A1 WO 2017113717 A1 WO2017113717 A1 WO 2017113717A1 CN 2016089236 W CN2016089236 W CN 2016089236W WO 2017113717 A1 WO2017113717 A1 WO 2017113717A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- video
- piece
- data
- audio data
- request
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/437—Interfacing the upstream path of the transmission network, e.g. for transmitting client requests to a VOD server
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/60—Network streaming of media packets
- H04L65/61—Network streaming of media packets for supporting one-way streaming services, e.g. Internet radio
- H04L65/612—Network streaming of media packets for supporting one-way streaming services, e.g. Internet radio for unicast
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/4302—Content synchronisation processes, e.g. decoder synchronisation
- H04N21/4307—Synchronising 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/433—Content storage operation, e.g. storage operation in response to a pause request, caching operations
- H04N21/4333—Processing operations in response to a pause request
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/441—Acquiring end-user identification, e.g. using personal code sent by the remote control or by inserting a card
- H04N21/4415—Acquiring end-user identification, e.g. using personal code sent by the remote control or by inserting a card using biometric characteristics of the user, e.g. by voice recognition or fingerprint scanning
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/442—Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
- H04N21/44204—Monitoring of content usage, e.g. the number of times a movie has been viewed, copied or the amount which has been watched
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/83—Generation or processing of protective or descriptive data associated with content; Content structuring
- H04N21/845—Structuring of content, e.g. decomposing content into time segments
- H04N21/8456—Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/40—Support for services or applications
- H04L65/402—Support for services or applications wherein the services involve a main real-time session and one or more additional parallel non-real time sessions, e.g. downloading a file in a parallel FTP session, initiating an email or combinational services
- H04L65/4025—Support for services or applications wherein the services involve a main real-time session and one or more additional parallel non-real time sessions, e.g. downloading a file in a parallel FTP session, initiating an email or combinational services where none of the additional parallel sessions is real time or time sensitive, e.g. downloading a file in a parallel FTP session, initiating an email or combinational services
Definitions
- the embodiments of the present invention relate to the field of video playback technologies, and in particular, to a video playing method, a player, and an electronic device.
- the specification format of the video file is as shown in FIG. 1 , that is, the audio data and the video data in the original data moov box of the video file are stored in a segmented data format, so that the playback of the video file is smooth.
- HTTP HyperText Transfer Protocol
- the video data and the audio data are completely and independently stored in the original data moov box in the video file.
- the server can only transmit the video data separately or
- the player can only read video data or audio data first. Causes the user to appear when watching the video, only the image has no sound, or only the sound has no image.
- the technical problem to be solved by the embodiments of the present invention is to provide a video playing method to solve the problem that the sound and the picture are not synchronized due to the irregularity of the video file itself during the playing process.
- Another technical problem to be solved by the embodiments of the present invention is to provide a video player to solve the problem that the sound and the picture are not synchronized due to the irregularity of the video file itself during playback.
- Another technical problem to be solved by the embodiment of the present invention is to provide an electronic device to solve the broadcast.
- the embodiment of the present invention first provides a video playing method, including:
- S1 issuing a request for downloading a video file to the server
- S3 the main thread and the secondary thread are started, and the main thread and the secondary thread respectively send a request for downloading the first piece of video data and the first piece of audio data to the server;
- S4 receiving, by the server, the first piece of video data and the first piece of audio data returned according to the request for downloading the first piece of video data and the first piece of audio data for synchronous play;
- S5 repeatedly performing the S2-S4 step of reading the metadata header information and transmitting the request for downloading the next piece of video data and audio data, and sequentially downloading and playing the next piece of video data and audio data until receiving the instruction to stop downloading the video file or the The video file has been downloaded.
- the embodiment of the present invention further provides a video player, including:
- a requesting module configured to send a request to the server to download a video file
- a playing module configured to read metadata header information of the video file and parse the metadata header information to obtain a starting displacement and a data block size of the first piece of video data, a starting displacement of the first piece of audio data, and a data block
- the main thread and the secondary thread are opened, and the main thread and the secondary thread respectively send a request for downloading the first piece of video data and the first piece of audio data to the server; and receiving the server according to the downloading the first piece of video data and the first
- the first piece of video data and the first piece of audio data returned by the request of one piece of audio data are synchronously played; the metadata head information is repeatedly read and the request for downloading the next piece of video data and audio data is sent, and the next paragraph is sequentially downloaded and played.
- the video data and audio data are not received until the instruction to stop downloading the video file is received or the video file has been downloaded.
- an embodiment of the present invention further provides an electronic device, including the video player as described above.
- the embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium can store a program, and the program can implement all the steps of a video playing method provided by the embodiment of the present invention.
- the present invention has the following beneficial effects: the video playing method, device and power provided in the embodiments of the present invention
- the sub-device performs segmental downloading of video data and audio data by turning on dual-threading, synchronously playing and automatically downloading and playing the next piece of video data and audio data, thereby avoiding the video file format being irregular during video playback.
- the resulting sound and image are out of sync, which enhances the user experience.
- FIG. 1 is a specification of a video file format storage manner provided by the prior art.
- FIG. 2 is a schematic manner of storing a non-standard video file format provided by the prior art.
- FIG. 3 is a schematic flowchart diagram of a video playing method according to Embodiment 1 of the present invention.
- FIG. 4 is a schematic structural diagram of a video player according to Embodiment 2 of the present invention.
- FIG. 5 is a schematic structural diagram of an electronic device according to Embodiment 3 of the present invention.
- FIG. 3 is a schematic flowchart of a video playing method according to Embodiment 1 of the present invention. The method may be performed by a video player of an electronic device, where the video player may be implemented by software and/or hardware, and may be integrated into an electronic device. .
- the electronic device can be any electronic device such as a mobile phone, a tablet computer, an IPAD, or a notebook computer.
- the method of this embodiment includes the following steps:
- Step S1 Send a request for downloading a video file to the server.
- the video files include, but are not limited to, MP4 files.
- the user can send a download request to the server by searching the web address of the video file to be downloaded input on the page; or the user inputs the keyword input by the search page to obtain at least one network address for the user to select, when the user selects and After clicking on one of the network addresses, a download request is sent to the server.
- the server stores network resources such as video files, documents, and images.
- Step S2 Read metadata header information of the video file and parse the metadata header information to obtain a starting displacement and a data block size of the first segment of video data, a starting displacement of the first segment of audio data, and a data block size.
- Each video file includes metadata header information
- the metadata header information includes a moov box field
- the moov box field includes an audio stco and a video stco field
- the super-start displacement of the first piece of audio data can be obtained by parsing the audio stco field.
- the data block size; by analyzing the video stco field, the super-start displacement and the data block size of the first piece of video data can be obtained.
- Step S3 The main thread and the secondary thread are started, and the main thread and the secondary thread respectively send a request for downloading the first piece of video data and the first piece of audio data to the server.
- the embodiment of the present invention starts two threads of the main thread and the secondary thread, and the main thread and the secondary thread simultaneously send a request for downloading the first piece of video data and the first piece of audio data to the server.
- the request sent by the main thread to the server to download the first piece of video data includes a starting displacement and a data block size according to the first piece of video data.
- the request sent by the secondary thread to the server to download the first piece of audio data includes a starting displacement and a data block size of the first piece of audio data.
- S4 Receive the first piece of video data and the first piece of audio data returned by the server according to the request for downloading the first piece of video data and the first piece of audio data for synchronous play.
- the server after receiving the request for downloading the first piece of video data and the first piece of audio data, the server returns the first piece of video data and the first piece of audio data to the main thread and the secondary thread, respectively, the main thread and the second thread.
- the thread respectively transmits the first piece of video data and the first piece of audio data to the video player for the same Step play.
- S5 Repeatly executing the S2-S4 step to sequentially download and play the next piece of video data and audio data until an instruction to stop downloading the video file is received or the video file has been downloaded.
- the method in this embodiment repeatedly performs the S2-S4 step to start reading the metadata header information of the video file to obtain the initial displacement and the data block size of the second segment of the video data, the initial displacement of the second segment of the audio data, and the data block size. And then sending a request for downloading the second piece of video data and the second piece of audio data to the server; and receiving the second piece of video data returned by the server according to the request for downloading the second piece of video data and the second piece of audio data And the second piece of audio data for simultaneous playback.
- the S2-S4 step is repeatedly executed when playing the second piece of video data and the second piece of audio data to implement downloading and playing of the third piece of video data and audio data. , so repeatedly, until an instruction to stop downloading the video file is received or the video file has been downloaded.
- the technical solution of the embodiment of the present invention is to send a request for downloading a video file to a server, read metadata header information of the video file, and parse the metadata header information to obtain a starting displacement and a data block size of the first piece of video data.
- the video data and the audio data are downloaded in a segmented manner by opening the dual thread, the synchronous playback is performed and the next video data and audio data are automatically downloaded and played, thereby avoiding the video file format being irregular in the video playback process.
- FIG. 4 is a schematic structural diagram of a video player according to Embodiment 2 of the present invention.
- the video player of this embodiment specifically includes: a requesting module 40 and a playing module 41.
- the requesting module 40 is configured to send a request for downloading a video file to the server.
- the user can send a download request to the server by searching the web address of the video file to be downloaded, or the keyword input by the user through the search page to obtain at least one network address for the user to select, when the user selects and clicks on one of the networks. After the address, a download request is sent to the server.
- the video files include, but are not limited to, MP4 files.
- the server stores network resources such as video files, documents, and images.
- the playing module 41 is configured to read metadata header information of the video file and parse the metadata header information to obtain a starting displacement of the first piece of video data, a data block size, and a starting displacement of the first piece of audio data. And the data block size; the main thread and the secondary thread are started, and the main thread and the secondary thread respectively send a request for downloading the first piece of video data and the first piece of audio data to the server; and receiving the first video according to the downloading by the server
- the first piece of video data and the first piece of audio data returned by the request of the data and the first piece of audio data are synchronously played; the metadata head information is repeatedly read and the request for downloading the next piece of video data and audio data is sent and downloaded in sequence The next piece of video data and audio data is played until an instruction to stop downloading the video file is received or the video file has been downloaded.
- the video player of the embodiment begins to read metadata header information of the video file to obtain a starting displacement of the second segment of video data, a data block size, a starting displacement of the second segment of audio data, and a data block size; and then to the server And sending a request for downloading the second piece of video data and the second piece of audio data respectively; and receiving the second piece of video data and the second segment returned by the server according to the request for downloading the second piece of video data and the second piece of audio data Audio data for simultaneous playback.
- the above steps are repeatedly performed when playing the second piece of video data and the second piece of audio data to implement downloading and playing of the third piece of video data and audio data, Repeat until an instruction to stop downloading the video file is received or the video file has been downloaded.
- the method further includes:
- the determining module 42 is configured to stop playing the video file if receiving an instruction to stop downloading the video file, or downloading the audio data and the video data.
- the video player provided by the technical solution of the embodiment, wherein the request module 40 is used to issue a request for downloading a video file to the server, and the playback module 41 reads the metadata header information of the video file and parses the metadata header information to obtain the first The starting displacement of a piece of video data and the block size, the first piece of audio The initial displacement of the data and the data block size; the main thread and the secondary thread are started, and the main thread and the secondary thread respectively send a request for downloading the first piece of video data and the first piece of audio data to the server; receiving the server according to the Downloading the first piece of video data and the first piece of audio data and returning the first piece of video data and the first piece of audio data for synchronous play; repeatedly reading the metadata header information and transmitting and downloading the next piece of video data and audio data The next piece of video data and audio data is requested and sequentially downloaded and played until an instruction to stop downloading the video file is received or the video file has been downloaded.
- the embodiment of the present invention enables dual-threaded segmentation to download video data and audio data, synchronous playback and automatic download and playback of the next segment of video data and audio data, thereby avoiding the video file format during video playback.
- FIG. 5 is a schematic structural diagram of an electronic device according to Embodiment 3 of the present invention.
- the third embodiment of the present invention provides an electronic device, which includes the video player 500 according to the embodiment of the present invention, and can implement the video playing method in the embodiment of the present invention to synchronize the sound and picture of the video file. Play.
- the electronic device may specifically be any type of electronic device such as a mobile phone, a tablet computer, an IPAD, or a notebook computer.
- the electronic device of the embodiment of the present invention may send a request for downloading a video file to a server; read metadata header information of the video file, and parse the metadata header information to obtain a starting displacement and a data block size of the first segment of the video data.
- the above product can perform the method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
- the embodiment of the invention further provides a computer storage medium, wherein the computer storage medium can be stored There are programs that, when executed, may implement some or all of the steps in the various implementations of the video playback method provided by the embodiment shown in FIG.
Landscapes
- Engineering & Computer Science (AREA)
- Signal Processing (AREA)
- Multimedia (AREA)
- Computer Networks & Wireless Communication (AREA)
- Computer Security & Cryptography (AREA)
- Databases & Information Systems (AREA)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- General Health & Medical Sciences (AREA)
- Human Computer Interaction (AREA)
- Theoretical Computer Science (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
- Information Transfer Between Computers (AREA)
Abstract
本发明实施例公开了一种视频播放方法、视频播放器及电子装置,该方法包括:通过向服务器发出下载视频文件的请求;读取视频文件的元数据头信息并解析所述元数据头信息以获取第一段视频数据的起始位移及数据块大小、第一段音频数据的起始位移及数据块大小;开启主线程和次线程,所述主线程及次线程分别向服务器发出下载第一段视频数据和第一段音频数据的请求;接收所述服务器依据所述下载第一段视频数据和第一段音频数据的请求返回的第一段视频数据和第一段音频数据以进行同步播放;依次下载并播放下一段视频数据及音频数据。从而解决了播放过程中由于视频文件本身的不规范导致的声音与图片不同步的问题。
Description
本申请要求于2015年12月30日提交中国专利局、申请号为201511015418.0、发明名称为“视频播放方法、播放器及电子装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本发明实施例涉及视频播放技术领域,尤其涉及一种视频播放方法、播放器及电子装置。
随着科学技术的发展,信息传播越来越快,多媒体技术发展日益更新,视频成为信息传播的重要途径,越来越多的用户选择观看视频来获取各种信息。
通常,我们通过超文本传输协议(HyperText Transfer Protocol,HTTP)观看网络视频。所述视频文件的规范格式如图1所示,即视频文件的原始数据moov box中的音频数据及视频数据以分段数据格式存储,这样能保证视频文件的播放流畅。
发明人在实现本发明的过程中发现,然而,在实际播放过程中,还可能会遇到一些由于视频文件本身的不规范导致的播放问题。如图2所示,该视频格式文件中,视频数据和音频数据完全独立分开存放于视频文件中的原始数据moov box中,在实时传输视频文件的过程中,服务器只能单独先传输视频数据或者音频数据,播放器端也只能先读取到视频数据或者音频数据。造成用户在观看视频时会出现,只有图像没有声音,或只有声音没有图像的现象。
发明内容
本发明实施例要解决的技术问题在于,提出一种视频播放方法,以解决播放过程中由于视频文件本身的不规范导致的声音与图片不同步的问题。
本发明实施例另一个要解决的技术问题在于,提出一种视频播放器,以解决播放过程中由于视频文件本身的不规范导致的声音与图片不同步的问题。
本发明实施例又一个要解决的技术问题在于,提出一种电子装置,以解决播
放过程中由于视频文件本身的不规范导致的声音与图片不同步的问题。
为解决上述技术问题,本发明实施例首先提供一种视频播放方法,包括:
S1:向服务器发出下载视频文件的请求;
S2:读取视频文件的元数据头信息并解析所述元数据头信息以获取第一段视频数据的起始位移及数据块大小、第一段音频数据的起始位移及数据块大小;
S3:开启主线程和次线程,所述主线程及次线程分别向服务器发出下载第一段视频数据和第一段音频数据的请求;
S4:接收所述服务器依据所述下载第一段视频数据和第一段音频数据的请求返回的第一段视频数据和第一段音频数据以进行同步播放;及
S5:重复执行S2-S4步骤读取元数据头信息及发送下载下一段视频数据及音频数据的请求并依次下载并播放下一段视频数据及音频数据直到接收到停止下载视频文件的指令或所述视频文件已下载完毕。
另一方面,本发明实施例还提供了一种视频播放器,包括:
请求模块,用于向服务器发出下载视频文件的请求;
播放模块,用于读取视频文件的元数据头信息并解析所述元数据头信息以获取第一段视频数据的起始位移及数据块大小、第一段音频数据的起始位移及数据块大小;开启主线程和次线程,所述主线程及次线程分别向服务器发出下载第一段视频数据和第一段音频数据的请求;接收所述服务器依据所述下载第一段视频数据和第一段音频数据的请求返回的第一段视频数据和第一段音频数据以进行同步播放;重复读取元数据头信息及发送下载下一段视频数据及音频数据的请求并依次下载并播放下一段视频数据及音频数据直到接收到停止下载视频文件的指令或所述视频文件已下载完毕。
又一方面,本发明实施例还提供了一种电子装置,包括如上所述的视频播放器。
又一方面,本发明实施例还提供一种计算机存储介质,其中,该计算机存储介质可存储有程序,该程序执行时可实现本发明实施例提供的一种视频播放方法的全部步骤。
本发明具有如下有益效果:本发明实施例中提供的视频播放方法、装置及电
子装置,通过开启双线程进行分段式下载视频数据及音频数据,进行同步播放并自动进行下一段视频数据及音频数据的下载及播放,从而避免了在视频播放过程中由于视频文件格式不规范导致的声音和图片不同步的问题,从而提升了用户的使用体验。
图1为现有技术提供的一种规范的视频文件格式存储方式。
图2为现有技术提供的一种不规范的视频文件格式存储方式。
图3为本发明实施例一提供的一种视频播放方法的流程示意图。
图4为本发明实施例二提供的一种视频播放器的结构示意图。
图5为本发明实施例三提供的一种电子装置的结构示意图。
下面结合附图并通过具体实施方式来进一步说明本发明的技术方案。可以理解的是,此处所描述的具体实施例仅仅用于解释本发明,而非对本发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本发明相关的部分而非全部结构。
在更加详细地讨论示例性实施例之前应当提到的是,一些示例性实施例被描述成作为流程图描绘的处理或方法。虽然流程图将各项步骤描述成顺序的处理,但是其中的许多步骤可以被并行地、并发地或者同时实施。此外,各项步骤的顺序可以被重新安排。当其步骤完成时所述处理可以被终止,但是还可以具有未包括在附图中的附加步骤。所述处理可以对应于方法、函数、规程、子例程、子程序等等。
实施例一
图3为本发明实施例一提供的一种视频播放方法流程示意图,该方法可以由电子装置的视频播放器执行,其中该视频播放器可由软件和/或硬件实现,一般可集成在电子装置中。
所述电子装置可以是手机、平板电脑、IPAD或笔记本电脑等任一电子设备。
参见图3,本实施例的方法包括如下步骤:
步骤S1、向服务器发出下载视频文件的请求。
具体的,当需要下载一视频文件,用户可以点击相关网络地址以向所述服务器发出下载请求。所述视频文件包括但不限于,MP4文件。
优选的,用户可通过搜索页面输入的待下载的视频文件的网络地址以向服务器发出下载请求;或者,用户通过搜索页面输入的关键词以获取至少一网络地址以供用户选择,当用户选择并点击其中一网络地址后,则向服务器发出下载请求。
所述服务器存储着网络资源,比如视频文件、文档和图像等。
步骤S2、读取视频文件的元数据头信息并解析所述元数据头信息以获取第一段视频数据的起始位移及数据块大小、第一段音频数据的起始位移及数据块大小。
每一视频文件包括元数据头信息,所述元数据头信息包括moov box字段,所述moov box字段包括audio stco以及video stco字段,通过解析audio stco字段可获取第一段音频数据的超始位移及数据块大小;通过解析video stco字段可获取第一段视频数据的超始位移及数据块大小。
步骤S3、开启主线程和次线程,所述主线程及次线程分别向服务器发出下载第一段视频数据和第一段音频数据的请求。
为了加快下载速度,本发明实施例开启主线程及次线程两个线程,并且主线程及次线程同时向服务器分别发出下载第一段视频数据及第一段音频数据的请求。
进一步的,所述主线程向服务器发出的下载第一段视频数据的请求包括视第一段视频数据的起始位移和数据块大小。
所述次线程向服务器发出的下载第一段音频数据的请求包括第一段音频数据的起始位移和数据块大小。
S4:接收所述服务器依据所述下载第一段视频数据和第一段音频数据的请求返回的第一段视频数据和第一段音频数据以进行同步播放。
具体的,所述服务器接收到下载第一段视频数据和第一段音频数据的请求后,分别向主线程和次线程返回第一段视频数据及第一段音频数据,所述主线程和次线程分别将第一段视频数据及第一段音频数据传送给视频播放器以进行同
步播放。
S5:重复执行S2-S4步骤依次下载并播放下一段视频数据及音频数据直到接收到停止下载视频文件的指令或所述视频文件已下载完毕。
具体的,当第一段视频数据及第一段音频数据传送入视频播放器进行播放时,当前主线程及次线程释放出来了。本实施例的方法重复执行S2-S4步骤开始读取视频文件的元数据头信息以获取第二段视频数据的起始位移及数据块大小、第二段音频数据的起始位移及数据块大小;接着向服务器分别发出下载第二段视频数据及第二段音频数据的请示;并接收所述服务器依据所述下载第二段视频数据和第二段音频数据的请求返回的第二段视频数据和第二段音频数据以进行同步播放。
优选的,为了使所述视频文件的下载及播放流畅,在播放第二段视频数据及第二段音频数据时又重复执行S2-S4步骤以实现第三段视频数据及音频数据的下载及播放,如此反复,直到接收到停止下载视频文件的指令或所述视频文件已下载完毕。
本发明实施例的技术方案,通过向服务器发出下载视频文件的请求;读取视频文件的元数据头信息并解析所述元数据头信息以获取第一段视频数据的起始位移及数据块大小、第一段音频数据的起始位移及数据块大小;开启主线程和次线程,所述主线程及次线程分别向服务器发出下载第一段视频数据和第一段音频数据的请求;接收所述服务器依据所述下载第一段视频数据和第一段音频数据的请求返回的第一段视频数据和第一段音频数据以进行同步播放;依次下载并播放下一段视频数据及音频数据直到接收到停止下载视频文件的指令或所述视频文件已下载完毕。由于通过开启双线程进行分段式下载视频数据及音频数据,进行同步播放并自动进行下一段视频数据及音频数据的下载及播放,从而避免了在视频播放过程中由于视频文件格式不规范导致的声音和图片不同步的问题,从而提升了用户的使用体验。
实施例二
图4为本发明实施例二提供的一种视频播放器的结构示意图。
本实施例的视频播放器具体包括:请求模块40及播放模块41。
其中,所述请求模块40,用于向服务器发出下载视频文件的请求。优选的,
用户可通过搜索页面输入的待下载的视频文件的网络地址以向服务器发出下载请求;或用户通过搜索页面输入的关键词以获取至少一网络地址以供用户选择,当用户选择并点击其中一网络地址后,则向服务器发出下载请求。
所述视频文件包括但不限于,MP4文件。
所述服务器存储着网络资源,比如视频文件、文档和图像等。
所述播放模块41,用于读取视频文件的元数据头信息并解析所述元数据头信息以获取第一段视频数据的起始位移及数据块大小、第一段音频数据的起始位移及数据块大小;开启主线程和次线程,所述主线程及次线程分别向服务器发出下载第一段视频数据和第一段音频数据的请求;接收所述服务器依据所述下载第一段视频数据和第一段音频数据的请求返回的第一段视频数据和第一段音频数据以进行同步播放;重复读取元数据头信息及发送下载下一段视频数据及音频数据的请求并依次下载并播放下一段视频数据及音频数据直到接收到停止下载视频文件的指令或所述视频文件已下载完毕。
具体的,当第一段视频数据及第一段音频数据传送入视频播放器进行播放时,当前主线程及次线程即被释放。本实施例的视频播放器开始读取视频文件的元数据头信息以获取第二段视频数据的起始位移及数据块大小、第二段音频数据的起始位移及数据块大小;接着向服务器分别发出下载第二段视频数据及第二段音频数据的请示;并接收所述服务器依据所述下载第二段视频数据和第二段音频数据的请求返回的第二段视频数据和第二段音频数据以进行同步播放。
优选的,为了使所述视频文件的下载及播放流畅,在播放第二段视频数据及第二段音频数据时又重复执行上述步骤以实现第三段视频数据及音频数据的下载及播放,如此反复,直到接收到停止下载视频文件的指令或所述视频文件已下载完毕。
优选的,上述方案基础上,还包括:
判断模块42,用于若接收到停止下载视频文件的指令,或音频数据及视频数据下载完毕,则停止播放视频文件。
本实施例的技术方案提供的视频播放器,其中利用请求模块40向服务器发出下载视频文件的请求,利用播放模块41读取视频文件的元数据头信息并解析所述元数据头信息以获取第一段视频数据的起始位移及数据块大小、第一段音频
数据的起始位移及数据块大小;开启主线程和次线程,所述主线程及次线程分别向服务器发出下载第一段视频数据和第一段音频数据的请求;接收所述服务器依据所述下载第一段视频数据和第一段音频数据的请求返回的第一段视频数据和第一段音频数据以进行同步播放;重复读取元数据头信息及发送下载下一段视频数据及音频数据的请求并依次下载并播放下一段视频数据及音频数据直到接收到停止下载视频文件的指令或所述视频文件已下载完毕。由于本发明实施例开启双线程进行分段式下载视频数据及音频数据,进行同步播放并自动进行下一段视频数据及音频数据的下载及播放,从而避免了在视频播放过程中由于视频文件格式不规范导致的声音和图片不同步的问题,从而提升了用户的使用体验。
实施例三
图5为本发明实施例三提供的一种电子装置的结构示意图。
本实施例三提供了一种电子装置,该电子装置包括本发明实施例中所述的视频播放器500,可以通过执行本发明实施例中的视频播放方法以实现视频文件的声音和图片的同步播放。
所述电子装置具体可以是手机、平板电脑、IPAD或笔记本电脑等任一种电子设备。
本发明实施例的电子装置可以通过向服务器发出下载视频文件的请求;读取视频文件的元数据头信息并解析所述元数据头信息以获取第一段视频数据的起始位移及数据块大小、第一段音频数据的起始位移及数据块大小;开启主线程和次线程,所述主线程及次线程分别向服务器发出下载第一段视频数据和第一段音频数据的请求;接收所述服务器依据所述下载第一段视频数据和第一段音频数据的请求返回的第一段视频数据和第一段音频数据以进行同步播放;依次下载并播放下一段视频数据及音频数据直到接收到停止下载视频文件的指令或所述视频文件已下载完毕。采用本发明的电子装置,可以解决在视频播放过程中由于视频文件格式不规范导致的声音和图片不同步的问题,从而提升了用户的使用体验。
上述产品可执行本发明任意实施例所提供的方法,具备执行方法相应的功能模块和有益效果。未在本实施例中详尽描述的技术细节,可参见本发明任意实施例所提供的方法。
本发明实施例还提供一种计算机存储介质,其中,该计算机存储介质可存储
有程序,该程序执行时可实现图3所示实施例提供的视频播放方法的各实现方式中的部分或全部步骤。
注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。
Claims (11)
- 一种视频播放方法,其特征在于,包括:S1:向服务器发出下载视频文件的请求;S2:读取视频文件的元数据头信息并解析所述元数据头信息以获取第一段视频数据的起始位移及数据块大小、第一段音频数据的起始位移及数据块大小;S3:开启主线程和次线程,所述主线程及次线程分别向服务器发出下载第一段视频数据和第一段音频数据的请求;S4:接收所述服务器依据所述下载第一段视频数据和第一段音频数据的请求返回的第一段视频数据和第一段音频数据以进行同步播放;及S5:重复执行S2-S4步骤读取元数据头信息及发送下载下一段视频数据及音频数据的请求并依次下载并播放下一段视频数据及音频数据直到接收到停止下载视频文件的指令或所述视频文件已下载完毕。
- 根据权利要求1所述的方法,其特征在于,所述主线程向服务器发出的下载第一段视频数据的请求包括第一段视频数据起始位移和数据块大小,所述次线程向服务器发出的下载第一段音频数据的请求包括第一段音频数据起始位移和数据块大小。
- 根据权利要求1所述的方法,其特征在于,所述视频文件是MP4文件。
- 根据权利要求1所述的方法,其特征在于,所述步骤S1具体包括:接收用户通过搜索页面输入的待下载的视频文件的网络地址,向服务器发出下载请求;或接收用户通过搜索页面输入的关键词以获取至少一网络地址以供用户选择,当接收到用户选择后向服务器发出下载请求。
- 一种视频播放器,其配置于电子装置中,其特征在于,包括:请求模块,用于向服务器发出下载视频文件的请求;播放模块,用于读取视频文件的元数据头信息并解析所述元数据头信息以获取第一段视频数据的起始位移及数据块大小、第一段音频数据的起始位 移及数据块大小;开启主线程和次线程,所述主线程及次线程分别向服务器发出下载第一段视频数据和第一段音频数据的请求;接收所述服务器依据所述下载第一段视频数据和第一段音频数据的请求返回的第一段视频数据和第一段音频数据以进行同步播放;重复读取元数据头信息及发送下载下一段视频数据及音频数据的请求并依次下载并播放下一段视频数据及音频数据直到接收到停止下载视频文件的指令或所述视频文件已下载完毕。
- 根据权利要求5所述的视频播放器,其特征在于,所述视频播放器还包括停止模块:若接收到停止下载视频文件的指令,或音频数据及视频数据下载完毕,则停止播放视频文件。
- 根据权利要求5所述的视频播放器,其特征在于,所述主线程向服务器发出的下载第一段视频数据的请求包括第一段视频数据起始位移和数据块大小,所述次线程向服务器发出的下载第一段音频数据的请求包括第一段音频数据起始位移和数据块大小。
- 根据权利要求5所述的视频播放器,其特征在于,所述请求模块接收用户通过搜索页面输入的待下载的视频文件的网络地址,向服务器发出下载请求;或者接收用户通过搜索页面输入的关键词以获取至少一网络地址以供用户选择,当接收到用户选择后向服务器发出下载请求。
- 根据权利要求5所述的视频播放器,其特征在于,所述视频文件是MP4文件。
- 一种电子装置,其特征在于,包括权利要求5-9任一项所述的视频播放器。
- 一种计算机存储介质,其特征在于,所述计算机存储介质可存储有程序,所述程序执行时可实现包括权利要求1-4任一项所述的视频播放方法。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US15/242,138 US20170195384A1 (en) | 2015-12-30 | 2016-08-19 | Video Playing Method and Electronic Device |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201511015418.0 | 2015-12-30 | ||
CN201511015418.0A CN105898501A (zh) | 2015-12-30 | 2015-12-30 | 视频播放方法、视频播放器及电子装置 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US15/242,138 Continuation US20170195384A1 (en) | 2015-12-30 | 2016-08-19 | Video Playing Method and Electronic Device |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2017113717A1 true WO2017113717A1 (zh) | 2017-07-06 |
Family
ID=57002189
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2016/089236 WO2017113717A1 (zh) | 2015-12-30 | 2016-07-07 | 视频播放方法、视频播放器及电子装置 |
Country Status (3)
Country | Link |
---|---|
US (1) | US20170195384A1 (zh) |
CN (1) | CN105898501A (zh) |
WO (1) | WO2017113717A1 (zh) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110290396A (zh) * | 2019-05-31 | 2019-09-27 | 广州市百果园信息技术有限公司 | 一种视频处理的方法、装置、系统、设备和存储介质 |
CN114339326A (zh) * | 2021-12-10 | 2022-04-12 | 北京拼响天空文化科技有限公司 | 基于视频播放的声画同步方法、装置和系统 |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108462892B (zh) * | 2018-03-26 | 2019-08-06 | 百度在线网络技术(北京)有限公司 | 图像和音频同步播放的处理方法及设备 |
CN109344026A (zh) * | 2018-07-27 | 2019-02-15 | 阿里巴巴集团控股有限公司 | 数据监控方法、装置、电子设备及计算机可读存储介质 |
CN111641864B (zh) * | 2019-03-01 | 2022-05-20 | 腾讯科技(深圳)有限公司 | 一种视频信息获取方法、装置及设备 |
CN112399199A (zh) * | 2020-11-05 | 2021-02-23 | 聚好看科技股份有限公司 | 课程视频播放方法、服务器及显示设备 |
CN114845169B (zh) * | 2022-04-29 | 2023-07-25 | 东风汽车有限公司东风日产乘用车公司 | 播放控制方法、播放控制装置、播放终端以及存储介质 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050097558A1 (en) * | 2003-10-31 | 2005-05-05 | De Bonet Jeremy S. | System and method for a symmetric architecture for multimedia players |
CN101193311A (zh) * | 2006-12-21 | 2008-06-04 | 腾讯科技(深圳)有限公司 | 一种p2p系统中音视频数据的同步方法 |
CN101610161A (zh) * | 2008-06-17 | 2009-12-23 | 爱动摩杰(北京)科技有限公司 | 一种在网络会议中音频传输实时性的保证方法 |
CN102761776A (zh) * | 2012-08-01 | 2012-10-31 | 重庆大学 | 基于SVC的P2PVoD系统的视音频同步方法 |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1298157C (zh) * | 2004-11-30 | 2007-01-31 | 北京中星微电子有限公司 | Ip网络会议视音频同步的方法 |
JP2010503257A (ja) * | 2006-09-01 | 2010-01-28 | パクバイト ソフトウエア プロプライアタリー リミティド | データネットワーク上においてデータファイルを伝送する方法及びシステム |
CN101127989A (zh) * | 2007-09-11 | 2008-02-20 | 中兴通讯股份有限公司 | 一种支持手机超文本传输流媒体业务的方法 |
CN101217638B (zh) * | 2007-12-28 | 2012-10-24 | 深圳市迅雷网络技术有限公司 | 视频文件分段下载的方法、系统及装置 |
CN101621524A (zh) * | 2009-07-29 | 2010-01-06 | 深圳市五巨科技有限公司 | 一种移动终端视频数据的接收与播放的系统和方法 |
US8925003B2 (en) * | 2013-03-08 | 2014-12-30 | Silicon Image, Inc. | Mechanism for facilitating synchronization of audio and video between multiple media devices |
CN103391454B (zh) * | 2013-07-12 | 2016-12-28 | 三星电子(中国)研发中心 | 一种多线程下载方法和装置 |
CN104661058B (zh) * | 2013-11-20 | 2018-01-16 | 深圳市云帆世纪科技有限公司 | Mp4视频点播的数据流传输方法、客户端及点播系统 |
-
2015
- 2015-12-30 CN CN201511015418.0A patent/CN105898501A/zh active Pending
-
2016
- 2016-07-07 WO PCT/CN2016/089236 patent/WO2017113717A1/zh active Application Filing
- 2016-08-19 US US15/242,138 patent/US20170195384A1/en not_active Abandoned
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050097558A1 (en) * | 2003-10-31 | 2005-05-05 | De Bonet Jeremy S. | System and method for a symmetric architecture for multimedia players |
CN101193311A (zh) * | 2006-12-21 | 2008-06-04 | 腾讯科技(深圳)有限公司 | 一种p2p系统中音视频数据的同步方法 |
CN101610161A (zh) * | 2008-06-17 | 2009-12-23 | 爱动摩杰(北京)科技有限公司 | 一种在网络会议中音频传输实时性的保证方法 |
CN102761776A (zh) * | 2012-08-01 | 2012-10-31 | 重庆大学 | 基于SVC的P2PVoD系统的视音频同步方法 |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110290396A (zh) * | 2019-05-31 | 2019-09-27 | 广州市百果园信息技术有限公司 | 一种视频处理的方法、装置、系统、设备和存储介质 |
CN110290396B (zh) * | 2019-05-31 | 2024-04-09 | 广州市百果园信息技术有限公司 | 一种视频处理的方法、装置、系统、设备和存储介质 |
CN114339326A (zh) * | 2021-12-10 | 2022-04-12 | 北京拼响天空文化科技有限公司 | 基于视频播放的声画同步方法、装置和系统 |
CN114339326B (zh) * | 2021-12-10 | 2023-06-27 | 北京拼响天空文化科技有限公司 | 基于视频播放的声画同步方法、装置和系统 |
Also Published As
Publication number | Publication date |
---|---|
US20170195384A1 (en) | 2017-07-06 |
CN105898501A (zh) | 2016-08-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2017113717A1 (zh) | 视频播放方法、视频播放器及电子装置 | |
US11816310B1 (en) | Multi-view audio and video interactive playback | |
US9852762B2 (en) | User interface for video preview creation | |
US10448082B2 (en) | Information exchanging method and device, audio terminal and computer-readable storage medium | |
US9936260B2 (en) | Content reproduction method and apparatus in IPTV terminal | |
CA3037307C (en) | Methods and systems for instantaneous asynchronous media sharing | |
WO2017113705A1 (zh) | 提高起播速度的方法、视频播放器及电子装置 | |
US20140052770A1 (en) | System and method for managing media content using a dynamic playlist | |
WO2019047878A1 (zh) | 语音操控终端的方法、终端、服务器和存储介质 | |
US9055193B2 (en) | System and method of a remote conference | |
WO2016015419A1 (zh) | 流媒体的播放方法与播放装置 | |
WO2015070796A1 (zh) | 智能电视向移动通信终端推送资源的方法和装置 | |
US20130242189A1 (en) | Method and system for providing synchronized playback of media streams and corresponding closed captions | |
EP3100267B1 (en) | Method for improving offline content playback | |
TW201330603A (zh) | 數位內容版本交換方法及所用委託機裝置 | |
US20120246240A1 (en) | Providing Context Information Relating To Media Content That Is Being Presented | |
WO2017071642A1 (zh) | 媒体播放方法、装置和计算机存储介质 | |
EP2749009B1 (en) | Home network media transport negotiation | |
JP5899718B2 (ja) | 情報処理システム、情報処理装置及び情報処理プログラム | |
WO2024036979A9 (zh) | 一种多媒体资源播放方法及相关装置 | |
US20230205808A1 (en) | Presentation systems and methods | |
Wittner | HTML5 in the Norwegian Higher Education Institutions | |
JP2024510181A (ja) | メディア再生中のプリロールおよびミッドロールコンテンツをサポートするmpeg dashのための方法および装置 | |
TW201528791A (zh) | 播放即時串流媒體之方法及可播放即時串流媒體之區域網路系統 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16880517 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 16880517 Country of ref document: EP Kind code of ref document: A1 |