CN113992956A - Method for fast switching network audio and video - Google Patents

Method for fast switching network audio and video Download PDF

Info

Publication number
CN113992956A
CN113992956A CN202111042657.0A CN202111042657A CN113992956A CN 113992956 A CN113992956 A CN 113992956A CN 202111042657 A CN202111042657 A CN 202111042657A CN 113992956 A CN113992956 A CN 113992956A
Authority
CN
China
Prior art keywords
audio
video
module
switching
data
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
CN202111042657.0A
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.)
Hangzhou Arcvideo Technology Co ltd
Original Assignee
Hangzhou Arcvideo 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 Hangzhou Arcvideo Technology Co ltd filed Critical Hangzhou Arcvideo Technology Co ltd
Priority to CN202111042657.0A priority Critical patent/CN113992956A/en
Publication of CN113992956A publication Critical patent/CN113992956A/en
Pending legal-status Critical Current

Links

Images

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/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
    • 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/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4331Caching operations, e.g. of an advertisement for later insertion during playback
    • 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/45Management operations performed by the client for facilitating the reception of or the interaction with the content or administrating data related to the end-user or to the client device itself, e.g. learning user preferences for recommending movies, resolving scheduling conflicts
    • H04N21/458Scheduling content for creating a personalised stream, e.g. by combining a locally stored advertisement with an incoming stream; Updating operations, e.g. for OS modules ; time-related management operations
    • H04N21/4586Content update operation triggered locally, e.g. by comparing the version of software modules in a DVB carousel to the version stored locally
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/81Monomedia components thereof
    • H04N21/8166Monomedia components thereof involving executable data, e.g. software
    • H04N21/8193Monomedia components thereof involving executable data, e.g. software dedicated tools, e.g. video decoder software or IPMP tool

Landscapes

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

Abstract

The invention relates to the audio and video playing related technical field, and discloses a method for quickly switching network audio and video, which comprises the steps of setting audio and video information to a cache module, caching the acquired audio and video information by the cache module, and generating a corresponding handle; the playing module acquires the corresponding handle from the cache module, acquires the corresponding audio and video data through the handle and plays the audio and video data; and the playing module acquires a new handle corresponding to the audio and video, plays the audio and video data and completes audio and video switching. According to the invention, the downloading module is independent from the playing module, the player instance does not need to be frequently created and released, the decoding module and the rendering module only need to be reset under specific conditions, other modules do not need to be reset, the time loss and the system resource overhead in the switching process are greatly saved, the video content after switching can be seen more quickly, and the user experience is improved.

Description

Method for fast switching network audio and video
Technical Field
The invention relates to the technical field related to audio and video playing, in particular to a method for quickly switching network audio and video applied to short video.
Background
Under conventional player implementation, when a user is watching a video, if switching to a next player, it is usually necessary to first turn off a downloading module, a decoding module, a rendering module, etc. which release resources occupied by the previous player, and then allocate a new player instance to receive new video stream data.
After the user switches the video, the player is required to stop the previous playing, the downloading module, the decoding module, the audio and video synchronization module and the rendering module are required to be released completely, then the player instance is created again, a new video source address is required, and all instances such as the downloading module, the decoding module, the audio and video synchronization module and the rendering module are created again.
For example, in the prior art, patent application numbers are: CN201910586778.8, patent name: a method for implementing fast switching of players between different video streams; the player instance created by the technology can download data, which causes frequent creation and release of the player instance and occupies more system resources, so that the method is not suitable for some scenes requiring fast switching of video content, such as short video applications.
Disclosure of Invention
Aiming at the problems that the frequency of switching the audio and video is high, the occupied resource loss is still large in the switching process, the audio and video switching is not smooth, and the user experience is poor in the prior art, the invention provides a method for quickly switching the network audio and video, which is characterized in that a downloading module is separated from a playing module and is transformed into a cache module to support the downloading of multiple paths of videos, so that the switching of the audio and video can be completed without creating a new player example after the videos are switched.
In order to solve the technical problem, the invention is solved by the following technical scheme:
a method for fast switching network audio and video comprises a playing module and a cache module with downloading function, the method comprises,
the method comprises the steps of audio and video caching, wherein audio and video information is set to a caching module, the caching module caches the acquired audio and video information and generates a corresponding handle;
playing the audio and video, wherein the playing module acquires a corresponding handle from the cache module, acquires corresponding audio and video data through the handle and then plays the audio and video data;
and switching the audio and video, wherein the playing module acquires a handle corresponding to the new audio and video, acquires corresponding audio and video data through the handle, and then plays the audio and video data to complete audio and video switching.
The downloading module is stripped from the player and placed in the cache module, the downloading of multiple audio and video sources is supported, the player instance can be switched to new audio and video without being created again, and rapid switching is achieved.
Preferably, the audio and video information comprises an audio and video source, an audio parameter, a video parameter, the number n of audios and videos which can be played, and the number m of audios and videos which are simultaneously cached, wherein m < ═ n.
Preferably, the method for buffering the audio-video information comprises,
setting the size of a data block, namely setting different audio and video sources for a cache module, wherein the size of the data block to be loaded is buf [ i ] (0< ═ i < n) n and is the number of audios and videos in a list;
caching data blocks, wherein the caching module requests the server for data with the buf [ i ] size according to different audio and video sources and caches the data to a local temporary file;
and changing the playable list, and changing the audio and video source needing to be cached by the cache module.
Preferably, the alteration of the audio-visual source address comprises deletion of an audio-visual source and addition of an audio-visual source; when the user needs to update the audio and video information after switching the audio and video, the cache module deletes the audio and video source in the audio and video information and adds a new audio and video source.
Preferably, the method for playing the audio-video information comprises,
initializing a player example, namely initializing the player example when a user plays audio and video;
the handle is transmitted and the audio and video data are read, the cache module transmits the handle corresponding to the audio and video to the playing module, and the playing module reads the audio and video data;
decoding the audio and video, wherein the playing module reads the cached audio and video data according to the obtained handle and decodes the audio and video;
synchronizing the audio and video, and synchronizing the decoded audio and video by the playing module;
and rendering the audio and video, wherein the playing module renders the synchronized audio and video.
Preferably, the switching method of the audio-video information comprises,
step 1, transmitting handles and reading audio and video data, wherein the cache module transmits the handles corresponding to the audio and video to a playing module, and the playing module reads the audio and video data;
step 2, judging whether an audio and video decoder needs to be reset or not;
step 3, decoding the audio and video, wherein the playing module decodes the audio and video judged in the step 2;
step 4, synchronizing the audio and video, wherein the playing module synchronizes the audio and video decoded in the step 3;
step 5, rendering the audio and video, wherein the playing module renders the synchronized audio and video; and for the rendered audio and video, switching the video and repeating the step 1.
Preferably, the judgment of whether the audio-video decoder is reset or not,
if the audio parameter and the video parameter before switching are matched with the audio parameter and the video parameter after switching, resetting the audio and video decoder, and then entering an audio and video decoding state;
otherwise, directly entering into the audio and video decoding state.
The audio related parameters comprise coding format, sampling rate and channel number; the video related parameters comprise coding format, width and height and code rate.
Preferably, the method further comprises a request for switching the data after the video, and the caching module continuously requests the pre-cached data from the server.
Preferably, the storage mode of the local temporary file is streaming storage; can be read by the playing module without being downloaded in its entirety.
Due to the adoption of the technical scheme, the invention has the remarkable technical effects that: the invention adds the initialization of the cache module at the beginning, does not need to change the player example and frequently create and release the player example when switching the audio and video, only needs to reset the decoding module and the rendering module under specific conditions, does not need to reset other modules, greatly saves the time loss and the system resource overhead in the switching process, can more quickly see the switched video content, thereby improving the user experience.
Drawings
FIG. 1 is a flow chart of the present invention.
Fig. 2 is a flow chart of playing video according to the present invention.
Fig. 3 is a switching video flow of the present invention.
Fig. 4 is a flow of playing a video according to a conventional method.
Fig. 5 is a switching video flow of a conventional method.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples.
Example 1
A method for fast switching network audio and video can be known from the attached figures 4 and 5, wherein a playing module comprises a data reading module, a decoding module, an audio and video synchronization module and a rendering module; before the cache module caches the audio and video, the cache module needs to request a server to download the audio and video, and the playing speed of the audio and video needing to be browsed quickly is slow, so that quick switching cannot be performed; the user experience is poor.
Example 2
On the basis of the embodiment 1, different from the embodiment 1, the embodiment includes a playing module and a cache module with a downloading function, and the method includes,
the method comprises the steps of audio and video caching, wherein audio and video information is set to a caching module, the caching module caches the acquired audio and video information and generates a corresponding handle;
playing the audio and video, wherein the playing module acquires a corresponding handle from the cache module, acquires corresponding audio and video data through the handle and then plays the audio and video data;
and switching the audio and video, wherein the playing module acquires a handle corresponding to the new audio and video, acquires corresponding audio and video data through the handle, and then plays the audio and video data to complete audio and video switching.
The downloading module is stripped from the player and placed in the cache module, the downloading of multiple audio and video sources is supported, the player instance can be switched to new audio and video without being created again, and rapid switching is achieved.
The audio and video information comprises an audio and video source, an audio parameter, a video parameter, the number n of audios and videos which can be played in a list and the number m of audios and videos which are simultaneously cached, wherein m is equal to n.
The method for caching the audio-video information comprises the following steps,
setting the size of a data block, namely setting different audio and video sources for a cache module, wherein the size of the data block to be loaded is buf [ i ] (0< ═ i < n) n and is the number of audios and videos in a list;
caching data blocks, wherein the caching module requests the server for data with the buf [ i ] size according to different audio and video sources and caches the data to a local temporary file;
and changing the playable list, and changing the audio and video source needing to be cached by the cache module.
The change of the audio/video source address comprises the deletion of an audio/video source and the addition of the audio/video source; when the user needs to update the audio and video information after switching the audio and video, the cache module deletes the audio and video source in the audio and video information and adds a new audio and video source.
The method for playing the audio-video information comprises the following steps,
initializing a player example, namely initializing the player example when a user plays audio and video;
the handle is transmitted and the audio and video data are read, the cache module transmits the handle corresponding to the audio and video to the playing module, and the playing module reads the audio and video data;
decoding the audio and video, wherein the playing module reads the cached audio and video data according to the obtained handle and decodes the audio and video;
synchronizing the audio and video, and synchronizing the decoded audio and video by the playing module;
and rendering the audio and video, wherein the playing module renders the synchronized audio and video.
The playing of the new video can be started after the decoding state is entered, and the whole player example does not need to be reset and wait for the new network request time.
The switching method of the audio-video information comprises the following steps,
step 1, transmitting handles and reading audio and video data, wherein the cache module transmits the handles corresponding to the audio and video to a playing module, and the playing module reads the audio and video data;
step 2, judging whether an audio and video decoder needs to be reset or not;
step 3, decoding the audio and video, wherein the playing module decodes the audio and video judged in the step 2;
step 4, synchronizing the audio and video, wherein the playing module synchronizes the audio and video decoded in the step 3;
step 5, rendering the audio and video, wherein the playing module renders the synchronized audio and video; and for the rendered audio and video, switching the video and repeating the step 1.
Judging whether the decoder of the audio and video is reset or not,
if the audio parameter and the video parameter before switching are matched with the audio parameter and the video parameter after switching, resetting the audio and video decoder, and then entering an audio and video decoding state;
otherwise, directly entering into the audio and video decoding state. The audio related parameters comprise coding format, sampling rate and channel number; the video related parameters comprise coding format, width and height and code rate.
If the audio and video stream information in the video list needing to be watched is consistent, the decoding module can be directly multiplexed, and time consumption for switching the audio and video can be saved.
The storage mode of the local temporary file is streaming storage; can be read by the playing module without being downloaded in its entirety.
Example 3
On the basis of the above embodiment, this embodiment further includes a request for switching data after video, and the cache module continues to request the server for the pre-cached data. The cache module will continue to request the server for the data after the data is pre-cached, so as to ensure the continuity of video playing.
Example 4
On the basis of the above embodiment, the embodiment simultaneously caches m videos, the selection method of the m videos is not limited, when playing the video i, m videos which are the i to i + m videos are pre-cached, and when playing the video source i +1, m audio and video sources which are the i +1 to i +1+ m videos are pre-cached; the cache module can add a new audio and video source at any time or delete the previous audio and video source; when a user switches k (0< i < n) audios and videos, the list of the cached audios and videos needs to be updated timely, the audio and video sources in front of the video list and the content cached before are deleted, and new audio and video sources are added.
Example 5
On the basis of the foregoing embodiment, in this embodiment, a list of starting caching by the caching module is preset as list, the number of videos in the list is n-10, the duration of data to be cached for each video is preset as 5 seconds, the number of threads for caching simultaneously is preset as m-4, and a threshold k for triggering updating of the caching list is preset as 6.
After the cache module is started, 4 parallel threads are started in the background by an application program, and when the serial number of a played video is i, data of i-i +4 th videos are cached; for example, when the first video is currently played, the video source servers 1 to 4 respectively request for 5 seconds of video data and cache the video data in the local temporary file, and so on.
And starting to play the video list in the step 2 at the playing module, acquiring a handle of corresponding cache data from the cache module aiming at the video i to be played, setting the handle into the playing module, acquiring the corresponding cache data from the cache module by the playing module according to the corresponding handle, and then decoding and playing.
The playing module switches videos, switches the videos to be played to the videos j, acquires cache data handles corresponding to the videos j from the cache module, sets the cache data handles to the playing module, judges whether the decoding module and the rendering module need to be reset or not according to the front and back video stream information, and then acquires corresponding cache data from the cache module according to the handles of the videos j, and decodes and renders the cache data.
When the video is switched to a certain number, the cache list needs to be updated, when the video is switched to the 6 th by a user, the address of the 1 st video stream is deleted from the cache list, meanwhile, the temporary file originally cached in the local is also deleted, so that the situation that too much storage space is not occupied is ensured, and the address of the 11 th video stream is added into the cache list.

Claims (9)

1. A method for fast switching network audio and video comprises a playing module and a cache module with a downloading function, which is characterized in that the method comprises,
the method comprises the steps of audio and video caching, wherein audio and video information is set to a caching module, the caching module caches the acquired audio and video information and generates a corresponding handle;
playing the audio and video, wherein the playing module acquires a corresponding handle from the cache module, acquires corresponding audio and video data through the handle and then plays the audio and video data;
and switching the audio and video, wherein the playing module acquires a handle corresponding to the new audio and video, acquires corresponding audio and video data through the handle, and then plays the audio and video data to complete audio and video switching.
2. The method according to claim 1, wherein the audio/video information includes audio/video source, audio parameter, video parameter, number n of audios/videos that can be played, and number m of audios/videos that are simultaneously buffered, where m < ═ n.
3. The method for fast switching between network audios and videos according to claim 1, wherein the method for buffering the audio and video information comprises,
setting the size of a data block, namely setting different audio and video sources for a cache module, wherein the size of the data block to be loaded is buf [ i ] (0< ═ i < n) n and is the number of audios and videos in a list;
caching data blocks, wherein the caching module requests the server for data with the buf [ i ] size according to different audio and video sources and caches the data to a local temporary file;
and changing the playable list, and changing the audio and video source needing to be cached by the cache module.
4. The method according to claim 3, wherein the modification of the audio/video source address comprises deletion of an audio/video source and addition of an audio/video source; when the user needs to update the audio and video information after switching the audio and video, the cache module deletes the audio and video source in the audio and video information and adds a new audio and video source.
5. The method for fast switching between network audios and videos according to claim 1, wherein the playing method of the audio and video information comprises,
initializing a player example, namely initializing the player example when a user plays audio and video;
the handle is transmitted and the audio and video data are read, the cache module transmits the handle corresponding to the audio and video to the playing module, and the playing module reads the audio and video data;
decoding the audio and video, wherein the playing module reads the cached audio and video data according to the obtained handle and decodes the audio and video;
synchronizing the audio and video, and synchronizing the decoded audio and video by the playing module;
and rendering the audio and video, wherein the playing module renders the synchronized audio and video.
6. The method for fast switching between network audios and videos as claimed in claim 1, wherein the method for switching between audio and video information comprises,
step 1, transmitting handles and reading audio and video data, wherein the cache module transmits the handles corresponding to the audio and video to a playing module, and the playing module reads the audio and video data;
step 2, judging whether an audio and video decoder needs to be reset or not;
step 3, decoding the audio and video, wherein the playing module decodes the audio and video judged in the step 2;
step 4, synchronizing the audio and video, wherein the playing module synchronizes the audio and video decoded in the step 3;
step 5, rendering the audio and video, wherein the playing module renders the synchronized audio and video; and for the rendered audio and video, switching the video and repeating the step 1.
7. The method according to claim 6, wherein the judgment of whether the audio/video decoder is reset or not,
if the audio parameter and the video parameter before switching are matched with the audio parameter and the video parameter after switching, resetting the audio and video decoder, and then entering an audio and video decoding state;
otherwise, directly entering into the audio and video decoding state.
8. The method for fast switching between network audios and videos according to claim 1, further comprising a request for switching the post-video data, wherein the cache module continues to request the pre-cached data from the server.
9. The method for fast switching between network audios and videos according to claim 3, wherein the storage mode of the local temporary file is streaming storage.
CN202111042657.0A 2021-09-07 2021-09-07 Method for fast switching network audio and video Pending CN113992956A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111042657.0A CN113992956A (en) 2021-09-07 2021-09-07 Method for fast switching network audio and video

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111042657.0A CN113992956A (en) 2021-09-07 2021-09-07 Method for fast switching network audio and video

Publications (1)

Publication Number Publication Date
CN113992956A true CN113992956A (en) 2022-01-28

Family

ID=79735401

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111042657.0A Pending CN113992956A (en) 2021-09-07 2021-09-07 Method for fast switching network audio and video

Country Status (1)

Country Link
CN (1) CN113992956A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024022317A1 (en) * 2022-07-26 2024-02-01 京东方科技集团股份有限公司 Video stream processing method and apparatus, storage medium, and electronic device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024022317A1 (en) * 2022-07-26 2024-02-01 京东方科技集团股份有限公司 Video stream processing method and apparatus, storage medium, and electronic device

Similar Documents

Publication Publication Date Title
US20220182720A1 (en) Reception apparatus, reception method, and program
CN109714634B (en) Decoding synchronization method, device and equipment for live data stream
CN101917391B (en) Method for playing network video and system for playing network video
US11582497B2 (en) Methods, systems, processors and computer code for providing video clips
CN101868793B (en) A kind of peer playback devices and method of operating thereof
JP4393591B2 (en) Object-oriented audio-visual terminal and bitstream structure
JP2014511580A (en) Apparatus and method for storing and playing back content in multimedia streaming system
JP2013038766A (en) Transmitter, transmitter control method, control program, and recording medium
CN104202684A (en) Segmental network video seamless playing method and device
KR20030056548A (en) Method for controlling a terminal of MPEG-4 system
CN107920258B (en) Data processing method and device
CN107517411B (en) Video playing method based on GSstreamer frame
CN109218763A (en) A kind of method and smart television of streaming media video switching
CN111372099A (en) Low-delay HLS live broadcast implementation method
WO2012151217A1 (en) L-cut stream startup
CN110662116A (en) Web player based on WebAssembly technology and playing method
CN107690093B (en) Video playing method and device
CN103763609A (en) HLS protocol-based channel switching method and apparatus
CN112104885B (en) System and method for accelerating M3U8 initial playing speed in live broadcasting
JP2003510982A (en) A viable system for video on demand
CN113992956A (en) Method for fast switching network audio and video
KR20110044493A (en) Method and apparatus for storing data in digital broadcasting system providing video on demand service
JP4782938B2 (en) Data broadcasting equipment
CN115643426B (en) Universal video playing method and system for space application field
JP2004104704A (en) Video reproducing apparatus, video reproducing method, and program

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