Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings. The embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 is a schematic diagram of an application scenario of a video playing method according to some embodiments of the present disclosure.
The video playing method provided by some embodiments of the present disclosure is generally executed by a terminal device. The terminal device may be hardware or software. When the terminal device is hardware, it may be various electronic devices supporting video processing, including but not limited to a smart phone, a tablet computer, an electronic book reader, a vehicle-mounted terminal, and the like. When the terminal device is software, the terminal device can be installed in the electronic devices listed above. It may be implemented, for example, as multiple software or software modules to provide distributed services, or as a single software or software module. And is not particularly limited herein.
In the application scenario shown in fig. 1, an execution subject of the video playing method may be a video-class application installed on the smartphone 100. The user can watch videos through the smart phone 100 and the video-type application installed on the smart phone. In this process, as an example, the video class application may first read the native aspect ratio 102 of the target video 101 obtained from the video file of the target video 101. In practice, various attribute information such as the size and aspect ratio of a video is often contained in a video file. The video-class application can directly read such information of the target video 101. On this basis, it can be determined whether the aspect ratio 102 is consistent with the aspect ratio 104 in the video playing information 103 corresponding to the target video 101, and the video playing information 103 is issued by the server. The video playback information 103 may be intermediate information related to video playback. As an example, information such as aspect ratio may be included. In response to determining that the aspect ratio 102 is inconsistent with the aspect ratio 104 in the video playing information 103, processing the target video based on the aspect ratio and the aspect ratio of the screen of the video playing device to obtain a processed video; and playing the processed video. For example, the native aspect ratio is 2:1, and the screen aspect ratio is 16:9, in which case the width of the target video may be clipped to obtain a processed video with an aspect ratio of 16: 9.
With continued reference to fig. 2, a flow 200 of some embodiments of a video playback method according to the present disclosure is shown. The video playing method comprises the following steps:
step 201, obtaining the aspect ratio of the target video from the video file of the target video.
In some embodiments, the executing subject of the video playing method may obtain the self aspect ratio of the target video from the video file of the target video. The video file of the target video can be stored locally in the execution main body or can be stored in other electronic equipment in communication connection. When stored in other electronic devices, the execution body may acquire the video file in a limited or wireless manner. In practice, various attribute information of the target video may be included in the video file of the target video. For example, the size, aspect ratio, resolution, etc. of the video. The execution subject of the video playing method (e.g., the video-class application in fig. 1) can directly read this information. The target video may be any video. The target video can be determined through specification or screening under certain conditions. For example, a currently playing video may be determined as the target video. As another example, a video stored at a video playback address acquired by the execution subject may be determined as the target video. Wherein the aspect ratio may refer to a ratio between a width and a height of the video image.
Step 202, determining whether the aspect ratio of the video playing information corresponding to the target video is consistent with the aspect ratio of the video playing information corresponding to the target video, and issuing the video playing information by the server.
In some embodiments, when the video file is stored in the server, the execution main body may receive a video playing address (URL) issued by the server. In addition, the video playing information sent by the server can be received. As an example, the video playing information may include information such as aspect ratio. On this basis, the execution subject may determine whether the aspect ratio thereof coincides with the aspect ratio in the video play information corresponding to the target video. If not, execution may continue to step 203. If the video playing information is consistent with the target video, optionally, the target video can be directly played according to the aspect ratio (or the aspect ratio of the target video) in the video playing information.
In some optional implementations of some embodiments, the execution body may upload aspect ratio comparison information to a server of the communication connection. The aspect ratio comparison information is used for representing whether the aspect ratio of the aspect ratio is consistent with the aspect ratio in the video playing information corresponding to the target video. Therefore, the server can perform corresponding marking so as to adjust the aspect ratio in the video playing information subsequently.
Step 203, in response to determining that the aspect ratio of the target video is inconsistent with the aspect ratio in the video playing information, processing the target video based on the aspect ratio of the target video and the aspect ratio of the screen of the video playing device to obtain a processed video.
In some embodiments, in response to determining that the self aspect ratio is not consistent with the aspect ratio in the video playing information, as an example, the execution subject may crop the target video based on the self aspect ratio and the screen aspect ratio of the video playing device, thereby obtaining the processed video. For example, the native aspect ratio is 2:1, and the screen aspect ratio is 16:9, in which case the width of the target video may be cropped to obtain a processed video with an aspect ratio of 16: 9.
And step 204, playing the processed video.
In some embodiments, the aspect ratio of the processed video to the screen is adapted, and the execution subject can play the processed video.
One of the above-described various embodiments of the present disclosure has the following advantageous effects: in some scenarios, for example, the aspect ratio of the video is not included in the video playing information, or the video rotation parameter is included in the video playing information, and the like, which may cause the aspect ratio reading failure or the reading error, thereby affecting the normal playing of the video. The aspect ratio issued by the server is verified by comparing the aspect ratio of the video with the aspect ratio issued by the server. Therefore, video compression or amplification caused by server issuing errors can be avoided. And for the condition that the aspect ratio of the video playing device is inconsistent with the aspect ratio issued by the server, processing the target video based on the aspect ratio of the video playing device and the aspect ratio of the screen of the video playing device, and playing the processed video to correct the wrong aspect ratio and realize the normal playing of the video.
With further reference to fig. 3, a flow 300 of further embodiments of a video playback method according to the present disclosure is shown. The video playing method comprises the following steps:
step 301, before playing the first preset number of frames of the target video, obtaining the aspect ratio of the target video from the video file of the target video.
In some embodiments, the execution subject may obtain the self aspect ratio of the target video from the video file of the target video before playing the first preset number of frames of the target video. In practice, the preset number can be set according to actual needs. For example, the preset number may be one, so that subsequent processing may be performed before the first frame to reduce video frames that are not normally played (enlarged or reduced). Compared with the verification at other times, the aspect ratio verification is carried out before the first frame is played, so that the video amplification or compression can be avoided to the maximum extent. In addition, step 201 in those embodiments corresponding to fig. 2 may be referred to for specific implementation of obtaining the aspect ratio of the target video from the video file of the target video, and details are not repeated here.
Step 302, determining whether the aspect ratio of the video playing information corresponding to the target video is consistent with the aspect ratio of the video playing information corresponding to the target video, and issuing the video playing information by the server.
In some embodiments, the specific implementation of step 302 and the technical effect brought by the implementation may refer to step 202 in the embodiment corresponding to fig. 2, which are not described herein again.
Step 303, in response to determining that the aspect ratio of itself is inconsistent with the aspect ratio in the video playing information, determining the type of the target video.
In some embodiments, the execution subject may determine the type of the target video in response to determining that the aspect ratio itself is not consistent with the aspect ratio in the video playback information. According to actual needs, videos can be classified according to different classification standards. For example, videos may be classified according to whether they are horizontal or vertical. As another example, the video may be classified according to the content thereof.
And step 304, processing the target video based on the aspect ratio of the target video, the aspect ratio of the screen of the video playing device and the type of the target video.
In some embodiments, the executing agent may process the target video based on its aspect ratio, the aspect ratio of the screen of the video playback device, and the type of target video determined in step 303. Taking as an example the classification of a video according to whether the video is a horizontal version video or a vertical version video, the processing can be performed according to the following steps:
step 3041, in response to determining that the type of the target video is a landscape video, fixing the width of the target video, and cutting the height of the target video based on the aspect ratio of the target video and the aspect ratio of the screen to obtain a processed video. For example, the target video is a landscape video with an aspect ratio of 16:9 and an aspect ratio of 16:8, and the height of the target video may be clipped to obtain a processed video with an aspect ratio of 16: 8. The video is guaranteed to be a horizontal version video all the time through fixing the width and cutting the height, and the video type is guaranteed to be unchanged.
Step 3042, in response to determining that the type of the target video is a portrait video, fixing the height of the target video, and cutting the width of the target video based on the aspect ratio of the target video and the aspect ratio of the screen to obtain a processed video. For example, the target video is a portrait video with an aspect ratio of 6:8 and an aspect ratio of 5:8, and the width of the target video may be clipped to obtain a processed video with an aspect ratio of 5: 8. The height is cut by fixing the height, so that the video is always vertical, and the video type is unchanged.
Of course, for videos classified by other classification criteria, a corresponding mode may be selected for processing such as clipping.
And 305, playing the processed video.
As can be seen from fig. 3, compared with the description of some embodiments corresponding to fig. 2, by determining the type of the video and performing different processing on the video according to different types of the video, the video processing is more targeted and accurate, so as to further ensure the normal playing of the video.
With further reference to fig. 4, as an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a video playing apparatus, which correspond to those shown in fig. 2, and which may be applied in various electronic devices.
As shown in fig. 4, the video playback apparatus 400 of some embodiments includes: an acquisition unit 401, a comparison unit 402, a processing unit 403, and a playback unit 404. Wherein the obtaining unit 401 is configured to obtain the self aspect ratio of the target video from the video file of the target video. The comparing unit 402 is configured to determine whether the aspect ratio of the video playing information is consistent with that of the video playing information corresponding to the target video, and the video playing information is issued by the server. The playing unit 403 is configured to process the target video based on the aspect ratio of the video playing device and the aspect ratio of the screen of the video playing device, in response to determining that the aspect ratio of the video playing device is inconsistent with the aspect ratio of the video playing device, to obtain a processed video. The playback unit 404 is configured to play back the processed video.
In some embodiments, specific implementations of the obtaining unit 401, the comparing unit 402, the processing unit 403, and the playing unit 404 in the video playing apparatus 400 and the technical effects thereof may refer to step 201 and step 204 in the embodiment corresponding to fig. 2, which are not described herein again.
In an alternative implementation of some embodiments, the processing unit 403 may be further configured to: determining the type of the target video; and processing the target video based on the aspect ratio of the target video, the aspect ratio of the screen of the video playing device and the type of the target video.
In an optional implementation of some embodiments, the obtaining unit 401 may be further configured to: before the first preset number of frames of the target video are played, the self aspect ratio of the target video is obtained from the video file of the target video.
In an alternative implementation of some embodiments, the processing unit 403 may be further configured to: in response to the fact that the type of the target video is determined to be a horizontal version video, fixing the width of the target video, and cutting the height of the target video based on the self aspect ratio and the aspect ratio of the screen; and in response to the fact that the type of the target video is determined to be a portrait video, fixing the height of the target video, and cutting the width of the target video based on the aspect ratio of the target video and the aspect ratio of the screen.
In some embodiments, the aspect ratio delivered by the server is checked by comparing the aspect ratio of the video itself with the aspect ratio delivered by the server. Therefore, video compression or amplification caused by server issuing errors can be avoided. And for the condition that the aspect ratio of the video player is inconsistent with the aspect ratio issued by the server, playing the target video based on the aspect ratio of the video player so as to correct the wrong aspect ratio and realize the normal playing of the video.
Referring now to fig. 5, a block diagram of an electronic device (e.g., the terminal device of fig. 1) 500 suitable for use in implementing some embodiments of the present disclosure is shown. The electronic device in some embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle-mounted terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 5, electronic device 500 may include a processing means (e.g., central processing unit, graphics processor, etc.) 501 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data necessary for the operation of the electronic apparatus 500 are also stored. The processing device 501, the ROM 502, and the RAM503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
Generally, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 507 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; a storage device 508 including, for example, a memory card; and a communication device 509. The communication means 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 illustrates an electronic device 500 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 5 may represent one device or may represent multiple devices as desired.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In some such embodiments, the computer program may be downloaded and installed from a network via the communication means 509, or installed from the storage means 508, or installed from the ROM 502. The computer program, when executed by the processing device 501, performs the above-described functions defined in the methods of some embodiments of the present disclosure.
It should be noted that the computer readable medium described in some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText transfer protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring the aspect ratio of a target video from a video file of the target video; determining whether the aspect ratio of the video playing information is consistent with that of the video playing information corresponding to the target video, and issuing the video playing information by a server; in response to determining that the aspect ratio of the target video is inconsistent with the aspect ratio in the video playing information, processing the target video based on the aspect ratio of the target video and the aspect ratio of the screen of the video playing device to obtain a processed video; and playing the processed video.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by software, and may also be implemented by hardware. The described units may also be provided in a processor, and may be described as: a processor includes an acquisition unit, a comparison unit, and a play unit. Where the names of these units do not in some cases constitute a limitation on the unit itself, for example, the acquisition unit may also be described as a "unit that acquires the own aspect ratio of the target video".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
According to one or more embodiments of the present disclosure, there is provided a video playing method including: acquiring the aspect ratio of a target video from a video file of the target video; determining whether the aspect ratio of the video playing information is consistent with that of the video playing information corresponding to the target video, and issuing the video playing information by a server; in response to determining that the aspect ratio of the target video is inconsistent with the aspect ratio in the video playing information, processing the target video based on the aspect ratio of the target video and the aspect ratio of the screen of the video playing device to obtain a processed video; and playing the processed video.
According to one or more embodiments of the present disclosure, processing a target video based on an aspect ratio of the target video and an aspect ratio of a screen of a video playing device includes: determining the type of the target video; and processing the target video based on the aspect ratio of the target video, the aspect ratio of the screen of the video playing device and the type of the target video.
According to one or more embodiments of the present disclosure, acquiring the self aspect ratio of the target video includes: before the first preset number of frames of the target video are played, the self aspect ratio of the target video is obtained from the video file of the target video.
According to one or more embodiments of the present disclosure, processing a target video based on an aspect ratio of the target video, an aspect ratio of a screen of a video playing device, and a type of the target video includes: in response to the fact that the type of the target video is determined to be a horizontal version video, fixing the height of the target video, and cutting the width of the target video based on the aspect ratio of the target video and the aspect ratio of the screen; and in response to the fact that the type of the target video is determined to be a portrait video, fixing the width of the target video, and cutting the height of the target video based on the aspect ratio of the target video and the aspect ratio of the screen.
According to one or more embodiments of the present disclosure, there is provided a video playback apparatus including: an acquisition unit configured to acquire an aspect ratio of a target video from a video file of the target video; the comparison unit is configured to determine whether the aspect ratio of the comparison unit is consistent with that of the video playing information corresponding to the target video or not, and the video playing information is issued by the server; the processing unit is configured to respond to the fact that the aspect ratio is inconsistent with the aspect ratio in the video playing information, and process the target video based on the aspect ratio and the aspect ratio of the screen of the video playing equipment to obtain a processed video; and the playing unit is configured to play the processed video.
In accordance with one or more embodiments of the present disclosure, the processing unit is further configured to: determining the type of the target video; and processing the target video based on the aspect ratio of the target video, the aspect ratio of the screen of the video playing device and the type of the target video.
In accordance with one or more embodiments of the present disclosure, in an optional implementation of some embodiments, the obtaining unit may be further configured to: before the first preset number of frames of the target video are played, the self aspect ratio of the target video is obtained from the video file of the target video.
In accordance with one or more embodiments of the present disclosure, the processing unit may be further configured to: in response to the fact that the type of the target video is determined to be a horizontal version video, fixing the width of the target video, and cutting the height of the target video based on the self aspect ratio and the aspect ratio of the screen; and in response to the fact that the type of the target video is determined to be a portrait video, fixing the height of the target video, and cutting the width of the target video based on the aspect ratio of the target video and the aspect ratio of the screen.
According to one or more embodiments of the present disclosure, there is provided an electronic device including: one or more processors; a storage device having one or more programs stored thereon which, when executed by one or more processors, cause the one or more processors to implement any of the methods described above.
According to one or more embodiments of the present disclosure, a computer-readable medium is provided, on which a computer program is stored, wherein the program, when executed by a processor, implements any of the methods described above.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.