CN117768674A - Video playing method and device, electronic equipment and storage medium - Google Patents

Video playing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117768674A
CN117768674A CN202311501370.9A CN202311501370A CN117768674A CN 117768674 A CN117768674 A CN 117768674A CN 202311501370 A CN202311501370 A CN 202311501370A CN 117768674 A CN117768674 A CN 117768674A
Authority
CN
China
Prior art keywords
file
video
video file
resolution
initial
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
CN202311501370.9A
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 Zhongdian Feihua Communication Co Ltd
Original Assignee
Beijing Zhongdian Feihua Communication 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 Zhongdian Feihua Communication Co Ltd filed Critical Beijing Zhongdian Feihua Communication Co Ltd
Priority to CN202311501370.9A priority Critical patent/CN117768674A/en
Publication of CN117768674A publication Critical patent/CN117768674A/en
Pending legal-status Critical Current

Links

Abstract

The disclosure provides a video playing method, a video playing device, electronic equipment and a storage medium, wherein the video playing method comprises the following steps: acquiring a video file, and analyzing and processing the video file to obtain the initial resolution of the video file; slicing the video file according to a preset time length based on the initial resolution to obtain at least one initial transport stream file; encrypting the initial transport stream file to obtain an encrypted transport stream file, generating an index file based on the encrypted transport stream file, and storing the index file; and determining that a playing instruction is received, analyzing the index file and playing the index file. The video loading method and device can improve video safety while improving video loading efficiency.

Description

Video playing method and device, electronic equipment and storage medium
Technical Field
The disclosure relates to the field of video processing, and in particular, to a video playing method, a device, an electronic device and a storage medium.
Background
At present, the MP4 format is usually adopted for playing the video, when the video duration is longer, the key frame elements of the MP4 are usually quite large, the playing can be started after a long time is needed to be loaded, and the buffer loading is quite long under the condition of poor network speed, so that users are not tolerant.
Meanwhile, when the current video is played, any user can directly edit the video after downloading, so that the original video is tampered, and the security is low.
In view of this, how to improve video security while improving video loading efficiency has become an important solution.
Disclosure of Invention
In view of the above, the disclosure is directed to a video playing method, apparatus, electronic device and storage medium for solving or partially solving the above-mentioned problems.
Based on the above object, a first aspect of the present disclosure provides a video playing method, the method including:
acquiring a video file, and analyzing and processing the video file to obtain the initial resolution of the video file;
slicing the video file according to a preset time length based on the initial resolution to obtain at least one initial transport stream file;
encrypting the initial transport stream file to obtain an encrypted transport stream file, generating an index file based on the encrypted transport stream file, and storing the index file;
and determining that a playing instruction is received, analyzing the index file and playing the index file.
Based on the same inventive concept, a second aspect of the present disclosure proposes a video playing device, including:
the video analysis module is configured to acquire a video file, analyze the video file and obtain the initial resolution of the video file;
the slice processing module is configured to slice the video file according to the preset time length based on the initial resolution to obtain at least one initial transport stream file;
the index file generation module is configured to encrypt the initial transport stream file to obtain an encrypted transport stream file, generate an index file based on the encrypted transport stream file, and store the index file;
and the analysis playing module is configured to determine that a playing instruction is received, analyze the index file and play the index file.
Based on the same inventive concept, a third aspect of the present disclosure proposes an electronic device comprising a memory, a processor and a computer program stored on the memory and executable by the processor, the processor implementing the video playing method as described above when executing the computer program.
Based on the same inventive concept, a fourth aspect of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the video playback method as described above.
From the foregoing, it can be seen that the present disclosure provides a video playing method, apparatus, electronic device and storage medium, which analyze and process an obtained video file to obtain an initial resolution of the video file, so as to perform subsequent slicing processing on the video file according to the initial resolution. And slicing the video file according to the preset time length to obtain at least one initial transport stream file. By slicing the video file, each obtained initial transport stream file is of a preset time length, and only one section of initial transport stream file is loaded each time when the video file is played later, so that the problem of overlong loading time caused by overlong video is avoided. And carrying out encryption processing on the initial transport stream file to obtain an encrypted transport stream file, and generating an index file based on the encrypted transport stream file. By encrypting the initial transport stream file and then playing, the decryption party is required to play and edit the initial transport stream file, so that the safety of video playing is improved. After receiving the playing instruction, the index file is analyzed and played, and automatic decryption is performed during playing, so that other users cannot play even though the index file is downloaded, the safety is enhanced, and the original video file is prevented from being tampered.
Drawings
In order to more clearly illustrate the technical solutions of the present disclosure or related art, the drawings required for the embodiments or related art description will be briefly described below, and it is apparent that the drawings in the following description are only embodiments of the present disclosure, and other drawings may be obtained according to these drawings without inventive effort to those of ordinary skill in the art.
Fig. 1 is a flowchart of a video playing method according to an embodiment of the disclosure;
fig. 2 is a block diagram of a video playing device according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
For the purposes of promoting an understanding of the principles and advantages of the disclosure, reference will now be made to the embodiments illustrated in the drawings and specific language will be used to describe the same.
It should be noted that unless otherwise defined, technical or scientific terms used in the embodiments of the present disclosure should be given the ordinary meaning as understood by one of ordinary skill in the art to which the present disclosure pertains. The terms "first," "second," and the like, as used in embodiments of the present disclosure, do not denote any order, quantity, or importance, but rather are used to distinguish one element from another. The word "comprising" or "comprises", and the like, means that elements or items preceding the word are included in the element or item listed after the word and equivalents thereof, but does not exclude other elements or items. The terms "connected" or "connected," and the like, are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", etc. are used merely to indicate relative positional relationships, which may also be changed when the absolute position of the object to be described is changed.
The terms referred to in this disclosure are explained as follows:
TS file: TS (Transport Stream) is a packaged format.
m3u8 file: the M3U8 file refers to an M3U file in UTF-8 coding format. M3U8 is an index file, typically an audio/video file is divided into a plurality of small files, and then the address and playing order of each file are recorded through M3U 8.
MP4: MP4 (Moving Picture Experts Group 4) is a set of compression coding standards for audio and video information.
HLS: HTTP Live Streaming is a streaming media transmission technology based on HTTP protocol, which can realize the distribution of video and audio contents in real time or on demand. The core idea of HLS is to segment a complete media file into small segments, each of which typically has a duration of a few seconds, and then describe the information of the segments, such as URL, duration, code rate, etc., by means of an index file (playlist). The client can request and play the corresponding fragments according to the index file, so that smooth media play is realized. The HLS has the advantage that it utilizes the broad support and efficient caching mechanism of the HTTP protocol, can adapt to different network environments and terminal devices, and provides a high quality and low latency user experience. HLS also supports Adaptive Bitrate (ABR) techniques, i.e. dynamically adjusting video quality according to changes in network bandwidth and device performance, thereby avoiding the phenomenon of jamming or blurring. HLS also supports encryption and Digital Rights Management (DRM) techniques, protecting the security and copyrights of media content.
AES: advanced encryption standard (Advanced Encryption Standard, AES), also known as Rijndael encryption, is a block encryption standard adopted by the federal government in the united states.
FFMPEG: FFMPEG is an open source multimedia processing framework that provides a series of tools and libraries that can be used to encode, decode, convert, record, play, edit, and analyze audio-video data in a variety of formats. The FFMPEG has a very wide application range, from desktop applications, mobile applications, network applications, to streaming media servers, video conference systems, video monitoring systems, and the like, and can be utilized to realize multimedia functions.
VOD: VOD (Video On Demand) is also called interactive television on demand system.
h.264: h.264, also part ten of MPEG-4, is a highly compressed digital Video codec standard proposed by the Joint Video Team (JVT, joint Video Team) consisting of the ITU-T Video Coding Experts Group (VCEG) and the ISO/IEC Moving Picture Experts Group (MPEG) Joint.
265: efficient Video Coding (HEVC), also known as h.265 and MPEG-H part 2, is a video compression standard, which is one of several potential successors to AVC (h.264 or MPEG-4 part 10) that is widely used.
DivX: divX is a digital video format supporting video of the MPEG-4, h.264 and latest h.265 standards, with resolutions up to 4K ultra high definition.
mpeg4: the MPEG-4 standard is mainly applied to Video telephone (Video Phone), video Email (Video Email), electronic News (Electronic News) and the like, and has low transmission rate requirement, and resolution of 176X144 between 4800 and 64000 bits/sec.
aac: advanced audio coding (Advanced Audio Coding, AAC), MPEG-2 based audio coding techniques.
Based on the above description, this embodiment proposes a video playing method, as shown in fig. 1, where the method includes:
step 101, obtaining a video file, and analyzing and processing the video file to obtain the initial resolution of the video file.
In implementation, a video file uploaded by a user is acquired, wherein the format of the video file is MP4 format. The manner in which the user uploads the video file includes at least one of: uploading is carried out through uploading system files and uploading large files in blocks or in batches.
In this embodiment, the method is applied to a video on demand platform. After a user successfully uploads a video file to a video-on-demand platform, the video-on-demand platform acquires the video file, and analyzes and processes the video file to obtain the initial resolution of the video file. In this embodiment, the video file is parsed by FFMPEG framework commands.
The uploading function in the video on demand platform is divided into selecting videos, starting batch uploading and stopping all uploading. The uploading function adopts a dropwonejs plug-in, and the slice uploading function is utilized, so that slice uploading can be performed during uploading, and the rear end can be synthesized after all the slices are uploaded. But it is not recommended to upload large files using web pages, and it is recommended to upload video files using scp command lines.
FFMPEG is an open source multimedia processing framework that provides a series of tools and libraries that can be used to encode, decode, convert, record, play, edit, and analyze audio-video data in a variety of formats. The FFMPEG has a very wide application range, from desktop applications, mobile applications, network applications, to streaming media servers, video conference systems, video monitoring systems, and the like, and can be utilized to realize multimedia functions.
Step 102, slicing the video file according to a preset time length based on the initial resolution to obtain at least one initial transport stream file.
In the implementation, a preset time length is acquired, and slicing processing is performed on the video file according to the acquired initial resolution and the preset time length.
For example, the preset time length is 10 seconds, and the overall time length of the video file is 1 minute, then slicing the video file according to the preset time length to obtain six initial transport stream files, where the time length corresponding to each initial transport stream file is 10 seconds.
And 103, carrying out encryption processing on the initial transport stream file to obtain an encrypted transport stream file, generating an index file based on the encrypted transport stream file, and storing the index file.
In specific implementation, the initial transport stream file is encrypted to obtain an encrypted transport stream file. In this embodiment, an AES-128 algorithm is used to encrypt the initial transport stream file. Generating an index file according to the encrypted transmission stream file obtained after encryption, and storing the index file into a database for calling and playing during playing.
Step 104, determining that a play instruction is received, analyzing the index file and playing the index file.
When receiving a playing instruction sent by a user uploading the video file, the method obtains the index file and automatically analyzes the index file.
Illustratively, when the video on demand platform acquires a video file, the identification of the uploading user of the video file is acquired at the same time. When a playing instruction is received, judging the identification information corresponding to the playing instruction, and comparing the identification information with the identification of the uploading user. And when the identification information is consistent with the identification of the uploading user, acquiring the index file, automatically decrypting the index file, and playing the video stream corresponding to the index file.
Through the scheme, the acquired video file is analyzed and processed to obtain the initial resolution of the video file, so that the video file is subjected to slicing processing according to the initial resolution. And slicing the video file according to the preset time length to obtain at least one initial transport stream file. By slicing the video file, each obtained initial transport stream file is of a preset time length, and only one section of initial transport stream file is loaded each time when the video file is played later, so that the problem of overlong loading time caused by overlong video is avoided. And carrying out encryption processing on the initial transport stream file to obtain an encrypted transport stream file, and generating an index file based on the encrypted transport stream file. By encrypting the initial transport stream file and then playing, the decryption party is required to play and edit the initial transport stream file, so that the safety of video playing is improved. After receiving the playing instruction, the index file is analyzed and played, and automatic decryption is performed during playing, so that other users cannot play even though the index file is downloaded, the safety is enhanced, and the original video file is prevented from being tampered.
In some embodiments, step 102 specifically includes:
step 1021, determining whether a historical transmission stream file corresponding to the video file exists in the database.
In the implementation process, files stored in a database are acquired, and whether a historical transmission stream file corresponding to the video file exists or not is judged. The video file may have been sliced prior to this time. After each slicing, the slicing is stored, wherein the stored contents are the time length of slicing in the video file and the corresponding slicing address.
Illustratively, the overall length of time for the video file is 2 hours, the last time the video file of the first 1 hour, 30 minutes, was sliced. Therefore, the historical transmission stream file is stored in the database, and the corresponding time length of the historical transmission stream file is 1 hour and 30 minutes.
Step 1022, determining that there is a historical transmission stream file corresponding to the video file, obtaining a historical time length corresponding to the historical transmission stream file, and slicing the video file according to a preset time length based on the historical time length and the initial resolution.
When the implementation is carried out, when the historical transmission stream file corresponding to the video file is stored in the database, the video file is indicated to have undergone slicing processing before the time, and then the video file is indicated to have undergone compression transcoding processing. And acquiring a history time length corresponding to the history transmission stream, and slicing the rest video files which are not sliced according to a preset time length based on the history time length and the initial resolution.
In one embodiment, the database is stored in the form of a historical time length of a historical data stream file.
Illustratively, the overall length of time that the database stores the historical data stream file is 1 hour and 20 minutes, indicating that the first 1 hour and 20 minutes of the video file has been sliced.
In another embodiment, the form stored in the database may be the number of historical transport stream files and the length of time for each segment of historical transport stream files. Multiplying the number of the historical transmission stream files and the time length of each section of the historical transmission stream files, wherein the product is also the time length of the video files which are already sliced.
For example, the number of the obtained historical data stream files is 480, and the time length of each section of the historical data stream file is 10 seconds, and then the number of the historical data stream files is multiplied by the time length of each section of the historical data stream file, so that the time length of the video file which is already sliced is 1 hour and 20 minutes.
Or,
step 1023, determining that no historical transmission stream file corresponding to the video file exists, performing transcoding processing on the video file to obtain a transcoded video file, and performing slicing processing on the transcoded video file according to a preset time length.
In the specific implementation, the historical transmission stream file corresponding to the video file does not exist in the database, transcoding processing is needed to be performed on the video file, and slicing processing is performed according to a preset time length after the transcoded video file is obtained.
In this embodiment, a dynamic code rate is adopted to perform transcoding in a floating code rate interval, so as to ensure minimum loss of video definition.
Illustratively, three sharpness choices, 480P,720P, and 1080P, are provided altogether, and the corresponding bitrate interval with the smallest loss is defaulted, ensuring adequate expressivity of the video after transcoding.
By the scheme, whether the video file is subjected to slicing processing or not is judged. When the video file subjected to slicing is sliced, only the part which is not subjected to slicing is required to be sliced, slicing is not required from the beginning, repeated slicing operation is avoided, and resource waste is reduced. When the video file is sliced for the first time, compression transcoding processing is performed first, and then slicing processing is performed on the transcoded video file.
In some embodiments, step 1022 specifically includes:
step 1022A, obtaining the overall time length of the video file.
Step 1022B, determining the video file to be sliced according to the overall time length and the historical time length.
Step 1022C, determining that the initial resolution is less than or equal to a first preset resolution threshold, and slicing the video file to be sliced according to a preset time length.
In the specific implementation, the whole time length of the video file is obtained, and the difference calculation is carried out on the whole time length and the historical time length to obtain the residual time length. And acquiring the video file to be sliced corresponding to the residual time length.
And judging the size relation between the initial resolution and a first preset resolution threshold, and judging the coding format of the video file when the initial resolution is smaller than or equal to the first preset resolution threshold.
And when the coding format of the video file is determined to be h264 coding, slicing the video file to be sliced according to a preset time length.
And when the coding format of the video file is not h264 coding, performing coding conversion on the video file to be sliced, and converting the coding format of the video file to be sliced from other coding formats into h.264 coding. And after the coding format is converted, slicing the video file to be sliced after the coding conversion according to the preset time length. Wherein the other encoding formats include at least one of: 265, AVC, divX or mpeg4.
In some embodiments, step 1022 specifically includes:
step 1022A, obtaining the overall time length of the video file.
Step 1022B, determining the video file to be sliced according to the overall time length and the historical time length.
In the specific implementation, the whole time length of the video file is obtained, and the difference calculation is carried out on the whole time length and the historical time length to obtain the residual time length. And acquiring the video file to be sliced corresponding to the residual time length.
Step 1022C, determining that the initial resolution is greater than a first preset resolution threshold, and performing resolution conversion on the video file to be sliced to obtain a first video file, where the resolution of the first video file is the first preset resolution threshold.
When the initial resolution is larger than a first preset resolution threshold, the video file to be sliced needs to be subjected to resolution conversion, so that the resolution of the video file is reduced to the first preset resolution threshold, and the first video file is obtained.
For example, the initial resolution is 1080P, and the first preset resolution threshold is 720P, the resolution of the video file to be sliced needs to be reduced from 1080P to 720P, so as to obtain a first video file, where the resolution of the first video file is 720P.
And step 1022D, performing transcoding processing on the first video file according to the first preset resolution threshold to obtain a second video file.
In step 1022E, slicing is performed on the second video file according to the preset time length.
And in implementation, transcoding the first video file according to the first preset resolution threshold. In this embodiment, the transcoding process performs compression transcoding on the video to the maximum extent through libx264 video coding and aac audio coding. And obtaining a second video file after transcoding, and slicing the second video file according to a preset time length.
In some embodiments, step 1023 specifically includes:
step 10231, determining the magnitudes of the initial resolution and the second preset resolution threshold.
In particular, there is no historical transport stream file corresponding to the video file in the database, indicating that the video file has not undergone slicing. Firstly, the size relation between the initial resolution and a second preset resolution threshold is judged, so that how to transcode the video file can be determined based on the size relation.
Step 10232, determining that the initial resolution is greater than the second preset resolution threshold, and performing resolution conversion on the video file to obtain a third video file, where the resolution of the third video file is the second preset resolution threshold.
Step 10233, performing transcoding processing on the third video file according to the second preset resolution threshold to obtain a transcoded video file.
When the initial resolution is larger than a second preset resolution threshold, converting the resolution of the video file so that the resolution of the video file is reduced, and obtaining a third video file with the resolution being the second preset resolution threshold. And transcoding the third video file according to the second preset resolution threshold value to obtain a transcoded video file.
For example, if the initial resolution is 720P and the second preset resolution threshold is 480P, the resolution of the video file needs to be reduced from 720P to 480P, so as to obtain a third video file, where the resolution of the third video file is 480P. And transcoding the video file according to a second preset resolution threshold 480P to obtain a transcoded video file.
In some embodiments, step 1023 specifically includes:
step 1023A, determining the magnitudes of the initial resolution and the second preset resolution threshold.
Step 1023B, determining that the initial resolution is less than or equal to the second preset resolution threshold, and performing transcoding processing on the video file according to the initial resolution to obtain a transcoded video file.
In particular, there is no historical transport stream file corresponding to the video file in the database, indicating that the video file has not undergone slicing. Firstly, the size relation between the initial resolution and a second preset resolution threshold is judged. And when the initial resolution is determined to be smaller than or equal to a second preset resolution threshold, transcoding is conducted according to the initial resolution.
Illustratively, the initial resolution is 360P, and the second preset resolution threshold is 480P, and the transcoding process is performed on the video file according to the initial resolution 360P, so as to obtain a transcoded video file.
In some embodiments, step 104 specifically includes:
step 1041, downloading the corresponding encrypted transport stream file based on the index file to obtain a downloaded transport stream file.
Step 1042, performing decryption processing on the downloaded transport stream file to obtain a corresponding video stream file and playing the video stream file.
When receiving a playing instruction sent by an uploading user, obtaining an encrypted transmission stream file corresponding to each index download according to the index file to obtain a downloaded transmission stream file. And decrypting the downloaded transport stream file by using an AES algorithm to obtain a corresponding video stream file and playing the video stream file.
In some embodiments, step 103 performs encryption processing on the initial transport stream file, and the specific process of obtaining the encrypted transport stream file is:
a first key required for AES-128 encryption of the initial transport stream file is generated, and a second key is encrypted for the first key. And encrypting the initial transport stream file by using the first key to obtain an encrypted transport stream. The second secret key is a secret key agreed between a client side for video playing of a user and a video-on-demand platform, is respectively built in the client side and the video-on-demand platform in advance, and has matching property about the second secret key. The encrypted transport stream of the different second key transmission cannot be played.
Illustratively, the second key includes M and N, the video on demand platform a includes the second key M, the client B includes the second key N, and the client C includes the second key M, so that the encrypted data stream provided by the video on demand platform cannot be played on the client B, but can be played on the client C.
In some embodiments, step 102 further comprises, after:
step 10A, determining whether the video playing client has an original video downloading function.
And step 10B, determining that the original video downloading function is not available, and deleting the video file.
In specific implementation, after slicing the video file, whether the original video downloading function is provided is judged. And if the video file does not exist, deleting the video file, so that unnecessary resource occupation is avoided. If the original video downloading function exists, the video file is reserved for the user to download the video file.
Through the scheme, whether the video file is deleted or not is determined according to whether the video playing client used by the user has the original video downloading function or not, so that the requirements of different clients are met.
In some embodiments, step 104 further comprises, after:
step 105, playing the decoded video stream; during the playing process, the network bandwidth of the client is monitored.
And step 106, searching a target definition and a target code rate corresponding to the network bandwidth according to the network bandwidth, and adjusting the play definition and the code rate of the video stream based on the target definition and the target code rate.
In the implementation process, the network bandwidth information of the client is monitored in the video stream playing process. Searching a target definition and a target code rate corresponding to the network bandwidth from a database according to the acquired network bandwidth, wherein the database stores the corresponding relation between the network bandwidth and the definition and the code rate, and the corresponding relation form can comprise at least one of the following: relationship table, functional relationship, curve relationship, and histogram relationship. In this embodiment, the relationship table is preferable.
Through the scheme, when the network bandwidth is suddenly reduced, the definition and the code rate of the video are automatically reduced, so that smooth playing of the video is ensured. If the network bandwidth is suddenly increased, the definition and the code rate of the video are automatically increased so as to improve the quality of the video.
The video on demand platform related to the embodiment also has the function of batch video setting, and specifically comprises batch slicing heads and batch setting classification. Taking a video file as an example of a movie, the batch slice header function selects the movie in batch, sets a time axis, and can slice the header by one key. The batch setting classification function can select movies for the background and batch setting classification.
The video on demand platform also comprises a preview function, wherein the preview function is represented by that a mouse moves to a progress bar, and a preview corresponding to a time axis is displayed, so that the video on demand platform is very cool.
The video on demand platform related to this embodiment further includes a permission system, and a member system is added, so that the member system can be started simultaneously when the CMS is started, and the member system can also be started independently. The extensible membership system is matched with the background card generation system, so that the number of days of membership cards can be generated, and the number of days of membership time can be increased when the membership is used in the foreground. The authority control of the unique routing layer can dynamically return completely different contents according to the authority difference, wherein the same m3u8 file is provided with the authority control.
The video on demand platform is also provided with an icon counting function for acquiring the playing condition of the video by one key according to condition screening, latest, hot, cold, time sequencing and the like. Meanwhile, the background can also be configured by a self-defined player, picture watermarks and text advertisements are configured, and advertisement links can be respectively arranged at positions, text fonts, bold, italics, underlines, font colors, font sizes and the like.
The video on demand platform also comprises a screenshot function, wherein the screenshot function generates a preset number of video shots in a folder where the slice files are located by default, and the original resolution of the video is adopted by default. Illustratively, 4 video shots are generated in the folder in which the slice file resides, namely 0-4.Jpg.
The video on demand platform also comprises a scanning and warehousing function, video files are transmitted to the movie file folder under the installation directory in batches by using ftp, scp or other transmission tools, the video can be scanned into the database by clicking the scanning and warehousing function in the background, and transcoding and slicing operations can be carried out in the background by one key.
The video on demand platform comprises a second cut function, and a background can be used for setting whether the second cut function is started or not. If the second slicing function is turned on, if the resolution of the video uploaded to the cloud transcoding is less than the resolution selected by the setting and the encoding format is h264, the system judges that the video is subjected to compression transcoding, and the system directly performs slicing work. If the second cut function is not started, the system always carries out transcoding, but the resolution used is according to whether the resolution of the video is larger than the set resolution, if so, the set resolution is used for transcoding slices, and if not, the resolution of the video is directly used for transcoding slices.
The video on demand platform comprises related functions for setting the subtitles, specifically comprises a subtitle uploading function and a subtitle burning function, wherein the subtitle uploading function can upload srt files with the same name as the uploaded video files into a movie folder by using ftp, scp or other server transmission tools. The subtitle burning function is to burn the subtitle into the video with the same name if the video with the same name and the srt file exist in the movie folder when the transcoding operation is performed, and whether the second cutting function is selected or not is performed. Meanwhile, when the subtitle is burned, note that the srt file needs to be adjusted in time axis and must be in utf-8 coding format, if the burned subtitle is a messy code, then the system has no Chinese font file.
The video on demand platform also comprises a vtt subtitle uploading function, after video transcoding is completed, each video can upload vtt subtitles respectively, the vtt subtitles can be automatically loaded when the video is played at the front end, the subtitles and the video files are separated, and the function is different from the subtitle burning function in that: the burning function is to burn the subtitles into the video file, and the vtt subtitle function is to load the vtt subtitles by the player, which is equivalent to externally embedded subtitles.
The video on demand platform also comprises a sharing function, and the video after slicing is generated into a sharing link, and the link can be directly used for playing the video in a browser or other webpages to be called by using an iframe. If the reference website is set, the sharing link cannot be directly played in the browser, and the appointed reference website can be normally played by using iframe calling, so that the anti-theft function is realized. Meanwhile, an anti-theft chain KEY is arranged at the background, so that the system can generate an encrypted token at intervals, the system can automatically capture each access of the m3u8 file, and the m3u8 file can be normally displayed only by carrying the token.
The video on demand platform comprises a watermark setting function, and a background is used for uploading watermark pictures, and each time transcoding is performed, the watermark pictures are burnt into the video and displayed at the upper right corner of the video by default. If the watermark does not need to be displayed, uploading an empty png format. The watermark is recommended to be in 120 x 40, png format.
The video on demand platform also comprises a domain name distribution function, a background setting is used for starting the domain name distribution function, and a distributed domain name is set, so that ts in m3u8 can be added with a domain name prefix in a circulating mode according to the domain name set by the background every time, and the function is mainly used for facilitating the synchronization of contents of multiple servers and load balancing.
The video on demand platform also comprises an online magnetic force playing function, and the online magnetic force link can be played by adopting a webtorent protocol.
By adopting the video on demand platform to play video, video content can be diversified and enriched more, various types, styles, subjects, languages and the like are covered, and the favorites and demands of different users are met. The video quality is higher in definition and reality, high-quality video experience of 4K, 8K, VR, AR and the like is provided, and the immersion and substitution sense of a user are enhanced. The video service can be more intelligent and personalized, and more accurate and effective video recommendation, searching, subscription and other services are provided by utilizing artificial intelligence, big data, cloud computing and other technologies, so that personalization and customization of users are realized. The video interaction is more natural and social, and natural interaction and social interaction among users, video content, video platforms, video producers and video audiences are realized by means of voice, gestures, expressions and the like. Meanwhile, the video interaction is more natural and social, and natural interaction and social interaction among users, video content, video platforms, video producers and video audiences are realized by means of voice, gestures, expressions and the like.
It should be noted that the method of the embodiments of the present disclosure may be performed by a single device, such as a computer or a server. The method of the embodiment can also be applied to a distributed scene, and is completed by mutually matching a plurality of devices. In the case of such a distributed scenario, one of the devices may perform only one or more steps of the methods of embodiments of the present disclosure, the devices interacting with each other to accomplish the methods.
It should be noted that the foregoing describes some embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments described above and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Based on the same inventive concept, the present disclosure also provides a video playing device corresponding to the method of any embodiment.
Referring to fig. 2, fig. 2 is a video playing device according to an embodiment, including:
the video analysis module 201 is configured to acquire a video file, analyze the video file, and obtain an initial resolution of the video file;
the slice processing module 202 is configured to perform slice processing on the video file according to a preset time length based on the initial resolution to obtain at least one initial transport stream file;
an index file generating module 203, configured to encrypt the initial transport stream file to obtain an encrypted transport stream file, generate an index file based on the encrypted transport stream file, and store the index file;
and the parsing and playing module 204 is configured to determine that a playing instruction is received, parse and play the index file.
In some embodiments, the slice processing module 202 specifically includes:
a history transport stream file judging unit configured to judge whether a history transport stream file corresponding to the video file exists in a database;
the first slicing processing unit is configured to determine that a historical transmission stream file corresponding to the video file exists, acquire a historical time length corresponding to the historical transmission stream file, and slice the video file according to a preset time length based on the historical time length and the initial resolution;
Or,
and the second slice processing unit is configured to determine that no historical transmission stream file corresponding to the video file exists, transcode the video file to obtain a transcoded video file, and slice the transcoded video file according to a preset time length.
In some embodiments, the first slice processing unit specifically includes:
a time length acquisition subunit configured to acquire an overall time length of the video file;
a video file to be sliced determining subunit configured to determine a video file to be sliced according to the overall time length and the historical time length;
and the slicing processing subunit is configured to determine that the initial resolution is smaller than or equal to a first preset resolution threshold value, and slice the video file to be sliced according to a preset time length.
In some embodiments, the first slice processing unit specifically includes:
a time length acquisition subunit configured to acquire an overall time length of the video file;
a video file to be sliced determining subunit configured to determine a video file to be sliced according to the overall time length and the historical time length;
A resolution conversion subunit, configured to determine that the initial resolution is greater than a first preset resolution threshold, and perform resolution conversion on the video file to be sliced to obtain a first video file, where the resolution of the first video file is the first preset resolution threshold;
the transcoding processing subunit is configured to transcode the first video file according to the first preset resolution threshold value to obtain a second video file;
and the slicing processing subunit is configured to slice the second video file according to a preset time length.
In some embodiments, the second slice processing unit specifically includes:
a resolution judgment subunit configured to judge the magnitudes of the initial resolution and a second preset resolution threshold;
the resolution conversion subunit is respectively configured to determine that the initial resolution is greater than the second preset resolution threshold, and perform resolution conversion on the video file to obtain a third video file, wherein the resolution of the third video file is the second preset resolution threshold;
and the transcoding processing subunit is configured to transcode the third video file according to the second preset resolution threshold value to obtain a transcoded video file.
In some embodiments, the second slice processing unit specifically includes:
a resolution judgment subunit configured to judge the magnitudes of the initial resolution and a second preset resolution threshold;
and the transcoding processing subunit is configured to determine that the initial resolution is smaller than or equal to the second preset resolution threshold value, and transcode the video file according to the initial resolution to obtain a transcoded video file.
In some embodiments, the parsing and playing module 204 specifically includes:
an encrypted transport stream downloading unit configured to download a corresponding encrypted transport stream file based on the index file, to obtain a downloaded transport stream file;
and the playing unit is configured to decrypt the downloaded transport stream file, obtain a corresponding video stream file and play the video stream file.
For convenience of description, the above devices are described as being functionally divided into various modules, respectively. Of course, the functions of the various modules may be implemented in the same one or more pieces of software and/or hardware when implementing the present disclosure.
The device of the foregoing embodiment is configured to implement the corresponding video playing method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which is not described herein.
Based on the same inventive concept, the present disclosure also provides an electronic device corresponding to the method of any embodiment, including a memory, a processor, and a computer program stored on the memory and capable of running on the processor, where the processor implements the video playing method of any embodiment when executing the program.
Fig. 3 shows a more specific hardware architecture of an electronic device according to this embodiment, where the device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 implement communication connections therebetween within the device via a bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit ), microprocessor, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc. for executing relevant programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory ), static storage device, dynamic storage device, or the like. Memory 1020 may store an operating system and other application programs, and when the embodiments of the present specification are implemented in software or firmware, the associated program code is stored in memory 1020 and executed by processor 1010.
The input/output interface 1030 is used to connect with an input/output module for inputting and outputting information. The input/output module may be configured as a component in a device (not shown) or may be external to the device to provide corresponding functionality. Wherein the input devices may include a keyboard, mouse, touch screen, microphone, various types of sensors, etc., and the output devices may include a display, speaker, vibrator, indicator lights, etc.
Communication interface 1040 is used to connect communication modules (not shown) to enable communication interactions of the present device with other devices. The communication module may implement communication through a wired manner (such as USB, network cable, etc.), or may implement communication through a wireless manner (such as mobile network, WIFI, bluetooth, etc.).
Bus 1050 includes a path for transferring information between components of the device (e.g., processor 1010, memory 1020, input/output interface 1030, and communication interface 1040).
It should be noted that although the above-described device only shows processor 1010, memory 1020, input/output interface 1030, communication interface 1040, and bus 1050, in an implementation, the device may include other components necessary to achieve proper operation. Furthermore, it will be understood by those skilled in the art that the above-described apparatus may include only the components necessary to implement the embodiments of the present description, and not all the components shown in the drawings.
The electronic device of the foregoing embodiment is configured to implement the corresponding video playing method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which is not described herein.
Based on the same inventive concept, corresponding to any of the above embodiments of the method, the present disclosure further provides a non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the video playing method according to any of the above embodiments.
The computer readable media of the present embodiments, including both permanent and non-permanent, removable and non-removable media, may be used to implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device.
The storage medium of the foregoing embodiments stores computer instructions for causing the computer to execute the video playing method according to any one of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which are not described herein.
It will be appreciated that before using the technical solutions of the various embodiments in the disclosure, the user may be informed of the type of personal information involved, the range of use, the use scenario, etc. in an appropriate manner, and obtain the authorization of the user.
For example, in response to receiving an active request from a user, a prompt is sent to the user to explicitly prompt the user that the operation it is requesting to perform will require personal information to be obtained and used with the user. Therefore, the user can select whether to provide personal information to the software or hardware such as the electronic equipment, the application program, the server or the storage medium for executing the operation of the technical scheme according to the prompt information.
As an alternative but non-limiting implementation, in response to receiving an active request from a user, the manner in which the prompt information is sent to the user may be, for example, a popup, in which the prompt information may be presented in a text manner. In addition, a selection control for the user to select to provide personal information to the electronic device in a 'consent' or 'disagreement' manner can be carried in the popup window.
It will be appreciated that the above-described notification and user authorization process is merely illustrative, and not limiting of the implementations of the present disclosure, and that other ways of satisfying relevant legal regulations may be applied to the implementations of the present disclosure.
Those of ordinary skill in the art will appreciate that: the discussion of any of the embodiments above is merely exemplary and is not intended to suggest that the scope of the disclosure, including the claims, is limited to these examples; the technical features of the above embodiments or in the different embodiments may also be combined under the idea of the present disclosure, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present disclosure as described above, which are not provided in details for the sake of brevity.
Additionally, well-known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown within the provided figures, in order to simplify the illustration and discussion, and so as not to obscure the embodiments of the present disclosure. Furthermore, the devices may be shown in block diagram form in order to avoid obscuring the embodiments of the present disclosure, and this also accounts for the fact that specifics with respect to implementation of such block diagram devices are highly dependent upon the platform on which the embodiments of the present disclosure are to be implemented (i.e., such specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the disclosure, it should be apparent to one skilled in the art that embodiments of the disclosure can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative in nature and not as restrictive.
While the present disclosure has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of those embodiments will be apparent to those skilled in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
The disclosed embodiments are intended to embrace all such alternatives, modifications and variances which fall within the broad scope of the appended claims. Accordingly, any omissions, modifications, equivalents, improvements, and the like, which are within the spirit and principles of the embodiments of the disclosure, are intended to be included within the scope of the disclosure.

Claims (10)

1. A video playing method, comprising:
acquiring a video file, and analyzing and processing the video file to obtain the initial resolution of the video file;
slicing the video file according to a preset time length based on the initial resolution to obtain at least one initial transport stream file;
encrypting the initial transport stream file to obtain an encrypted transport stream file, generating an index file based on the encrypted transport stream file, and storing the index file;
And determining that a playing instruction is received, analyzing the index file and playing the index file.
2. The method of claim 1, wherein slicing the video file for a predetermined length of time based on the initial resolution comprises:
judging whether a historical transmission stream file corresponding to the video file exists in a database or not;
determining that a historical transmission stream file corresponding to the video file exists, acquiring a historical time length corresponding to the historical transmission stream file, and slicing the video file according to a preset time length based on the historical time length and the initial resolution; or,
and determining that the historical transmission stream file corresponding to the video file does not exist, transcoding the video file to obtain a transcoded video file, and slicing the transcoded video file according to a preset time length.
3. The method according to claim 2, wherein slicing the video file for a predetermined length of time based on the historical length of time and the initial resolution comprises:
acquiring the whole time length of the video file;
Determining a video file to be sliced according to the integral time length and the historical time length;
and determining that the initial resolution is smaller than or equal to a first preset resolution threshold, and slicing the video file to be sliced according to a preset time length.
4. The method according to claim 2, wherein slicing the video file for a predetermined length of time based on the historical length of time and the initial resolution comprises:
acquiring the whole time length of the video file;
determining a video file to be sliced according to the integral time length and the historical time length;
determining that the initial resolution is larger than a first preset resolution threshold, and performing resolution conversion on the video file to be sliced to obtain a first video file, wherein the resolution of the first video file is the first preset resolution threshold;
transcoding the first video file according to the first preset resolution threshold to obtain a second video file;
and slicing the second video file according to the preset time length.
5. The method of claim 2, wherein determining that there is no historical transport stream file corresponding to the video file,
The transcoding processing is performed on the video file to obtain a transcoded video file, which comprises the following steps:
judging the magnitudes of the initial resolution and a second preset resolution threshold;
determining that the initial resolution is larger than the second preset resolution threshold, and performing resolution conversion on the video file to obtain a third video file, wherein the resolution of the third video file is the second preset resolution threshold;
and transcoding the third video file according to the second preset resolution threshold value to obtain a transcoded video file.
6. The method of claim 2, wherein determining that there is no historical transport stream file corresponding to the video file,
the transcoding processing is performed on the video file to obtain a transcoded video file, which comprises the following steps:
judging the magnitudes of the initial resolution and a second preset resolution threshold;
and determining that the initial resolution is smaller than or equal to the second preset resolution threshold, and performing transcoding processing on the video file according to the initial resolution to obtain a transcoded video file.
7. The method of claim 1, wherein parsing and playing the index file comprises:
Downloading a corresponding encrypted transport stream file based on the index file to obtain a downloaded transport stream file;
and decrypting the downloaded transport stream file to obtain a corresponding video stream file and playing the video stream file.
8. A video playback device, comprising:
the video analysis module is configured to acquire a video file, analyze the video file and obtain the initial resolution of the video file;
the slice processing module is configured to slice the video file according to the preset time length based on the initial resolution to obtain at least one initial transport stream file;
the index file generation module is configured to encrypt the initial transport stream file to obtain an encrypted transport stream file, generate an index file based on the encrypted transport stream file, and store the index file;
and the analysis playing module is configured to determine that a playing instruction is received, analyze the index file and play the index file.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the video playback method of any one of claims 1 to 7 when the program is executed.
10. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the video playback method of any one of claims 1 to 7.
CN202311501370.9A 2023-11-10 2023-11-10 Video playing method and device, electronic equipment and storage medium Pending CN117768674A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311501370.9A CN117768674A (en) 2023-11-10 2023-11-10 Video playing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311501370.9A CN117768674A (en) 2023-11-10 2023-11-10 Video playing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117768674A true CN117768674A (en) 2024-03-26

Family

ID=90320775

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311501370.9A Pending CN117768674A (en) 2023-11-10 2023-11-10 Video playing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117768674A (en)

Similar Documents

Publication Publication Date Title
US10187668B2 (en) Method, system and server for live streaming audio-video file
US8695054B2 (en) Ingesting heterogeneous video content to provide a unified video provisioning service
US9712890B2 (en) Network video streaming with trick play based on separate trick play files
US9609340B2 (en) Just-in-time (JIT) encoding for streaming media content
US9247317B2 (en) Content streaming with client device trick play index
EP2490445B1 (en) Method, terminal and server for implementing trickplay
US9538183B2 (en) Audio-visual content delivery with partial encoding of content chunks
US20140219634A1 (en) Video preview creation based on environment
US20230336612A1 (en) Systems and Methods for Quick Start-Up of Playback
WO2020211731A1 (en) Video playing method and related device
US20130042100A1 (en) Method and apparatus for forced playback in http streaming
US20150006645A1 (en) Social sharing of video clips
CN110784750B (en) Video playing method and device and computer equipment
IL230273A (en) Transmission of reconstruction data in a tiered signal quality hierarchy
US10965969B2 (en) Method and apparatus for playing online television program
US9680901B2 (en) Method, apparatus and non-transitory computer medium for encoding data of a media file
US9666233B2 (en) Efficient video frame rendering in compliance with cross-origin resource restrictions
US10856017B2 (en) Systems and methods for securely generating live previews
US11206386B2 (en) Information processing apparatus and information processing method
JP4444358B1 (en) Progressive download playback program
US9471950B2 (en) Device and method of inserting watermarks through conversing contents automatically
CN117768674A (en) Video playing method and device, electronic equipment and storage medium
US20190158898A1 (en) Hybrid transmission protocol
Kammachi‐Sreedhar et al. Omnidirectional video delivery with decoder instance reduction
WO2022220207A1 (en) Information processing device and 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