Disclosure of Invention
The embodiment of the application provides a recording file compression device and a method, and mainly aims to reduce the occupancy rate of a local storage space of a television (or a set top box) or reduce the occupancy rate of a storage space of target storage equipment.
In order to solve the above technical problem, an embodiment of the present application provides the following technical solutions:
in a first aspect, the present application provides a recorded file compression apparatus, where the apparatus is applied to a target terminal device, where the target terminal device is a target television or a set-top box connected to the target television, and the apparatus includes:
the device comprises an acquisition unit, a compression unit and a compression unit, wherein the acquisition unit is used for acquiring a recording file to be compressed, the recording file to be compressed is obtained by recording a television program live broadcast by a target television channel, and the recording file to be compressed comprises an original video stream;
the determining unit is used for determining a target parameter value corresponding to the target compression parameter;
the processing unit is used for compressing the original video stream according to a preset compression rule and a target parameter value corresponding to the target compression parameter so as to obtain a compressed video stream corresponding to the original video stream;
a replacement unit for replacing the original video stream with the compressed video stream.
Optionally, the obtaining unit includes:
the receiving module is used for receiving a recording file selection instruction, wherein the recording file selection instruction comprises a unique identifier corresponding to the recording file to be compressed;
the first acquisition module is used for acquiring the recording file to be compressed in a local storage space according to the unique identifier corresponding to the recording file to be compressed;
and the second acquisition module is used for acquiring the recording file to be compressed in the target storage equipment according to the unique identifier corresponding to the recording file to be compressed.
Optionally, the determining unit includes:
a third obtaining module, configured to obtain a default parameter value corresponding to the target compression parameter;
a generating module, configured to generate a partial compressed video stream corresponding to the original video stream according to the original video stream and a default parameter value corresponding to the target compression parameter;
the output module is used for outputting and displaying the partial compressed video stream;
a first determining module, configured to determine, when a confirmation instruction is received, a default parameter value corresponding to the target compression parameter as a target parameter value corresponding to the target compression parameter;
and the processing module is used for modifying the default parameter value corresponding to the target compression parameter according to the compression parameter modification instruction when the compression parameter modification instruction is received so as to obtain the target parameter value corresponding to the target compression parameter, wherein the compression parameter modification instruction comprises the modification parameter value corresponding to the target compression parameter.
Optionally, the third obtaining module includes:
the acquisition submodule is used for acquiring attribute information corresponding to the target television and attribute information corresponding to the original video stream;
and the determining submodule is used for determining a default parameter value corresponding to the target compression parameter according to the attribute information corresponding to the target television and the attribute information corresponding to the original video stream.
Optionally, the target compression parameter is specifically any one or more of a compression resolution parameter, a compression frame rate parameter, and an encoding format parameter, the attribute information corresponding to the original video stream is an original frame rate value and an original resolution value corresponding to the original video stream, and the attribute information corresponding to the target television is a screen resolution value, a preset frame rate threshold, and a supported encoder list corresponding to the target television;
the determining submodule is specifically configured to determine, when an original resolution value corresponding to the original video stream is greater than a screen resolution value corresponding to the target television, a screen resolution value corresponding to the target television as a default parameter value corresponding to the compressed resolution parameter; when the original resolution value corresponding to the original video stream is smaller than or equal to the screen resolution value corresponding to the target television, determining the original resolution value corresponding to the original video stream as a default parameter value corresponding to the compression resolution parameter;
when the original frame rate value corresponding to the original video stream is greater than the preset frame rate threshold corresponding to the target television, determining the preset frame rate threshold corresponding to the target television as a default parameter value corresponding to the compression frame rate parameter; when the original frame rate value corresponding to the original video stream is less than or equal to the preset frame rate threshold corresponding to the target television, determining the original frame rate value corresponding to the original video stream as a default parameter value corresponding to the compressed frame rate parameter;
determining a target coding format corresponding to the target television according to the supported encoder list corresponding to the target television, wherein the target coding format corresponding to the target television is a coding format with the highest compression rate in a plurality of coding formats supported by the target television; and determining the target coding format corresponding to the target television as a default parameter value corresponding to the coding format parameter.
Optionally, the generating module is specifically configured to intercept the original video stream to obtain a partial video stream corresponding to the original video stream; and inputting the part of the video stream and default parameter values corresponding to the target compression parameters into a preset processing tool so that the preset processing tool can compress the part of the video stream according to the default parameter values corresponding to the target compression parameters to obtain a part of compressed video stream corresponding to the original video stream.
Optionally, the processing unit includes:
the second determining module is used for determining whether the starting condition of the compression task is met or not according to the preset compression rule;
and the input module is used for inputting the original video stream and the target parameter value corresponding to the target compression parameter into a preset processing tool when the condition that the compression task starting condition is met is determined, so that the preset processing tool can compress the original video stream according to the target parameter value corresponding to the target compression parameter to obtain the compressed video stream corresponding to the original video stream.
Optionally, the preset compression rule is that if the target terminal device is in an idle state, it is determined that a compression task starting condition is met; if the target terminal equipment receives a compression task starting instruction, determining that a compression task starting condition is met; and if the performance of the target terminal equipment meets the preset requirement, determining that the starting condition of the compression task is met.
In a second aspect, the present application further provides a method for compressing a recorded file, where the method is applied to a target terminal device, where the target terminal device is a target television or a set-top box connected to the target television, and the method includes:
acquiring a recording file to be compressed, wherein the recording file to be compressed is obtained by recording a television program live broadcast by a target television channel, and the recording file to be compressed comprises an original video stream;
determining a target parameter value corresponding to the target compression parameter;
compressing the original video stream according to a preset compression rule and a target parameter value corresponding to the target compression parameter to obtain a compressed video stream corresponding to the original video stream;
replacing the original video stream with the compressed video stream.
Optionally, the obtaining of the recording file to be compressed includes:
receiving a recording file selection instruction, wherein the recording file selection instruction comprises a unique identifier corresponding to the recording file to be compressed;
acquiring the recording file to be compressed in a local storage space according to the unique identifier corresponding to the recording file to be compressed; or
And acquiring the recording file to be compressed in a target storage device according to the unique identifier corresponding to the recording file to be compressed.
Optionally, the determining a target parameter value corresponding to the target compression parameter includes:
acquiring a default parameter value corresponding to the target compression parameter;
generating a partial compressed video stream corresponding to the original video stream according to the original video stream and a default parameter value corresponding to the target compression parameter;
outputting and displaying the part of the compressed video stream;
if a confirmation instruction is received, determining a default parameter value corresponding to the target compression parameter as a target parameter value corresponding to the target compression parameter;
and if a compression parameter modification instruction is received, modifying the default parameter value corresponding to the target compression parameter according to the compression parameter modification instruction to obtain a target parameter value corresponding to the target compression parameter, wherein the compression parameter modification instruction comprises a modification parameter value corresponding to the target compression parameter.
Optionally, the obtaining of the default parameter value corresponding to the target compression parameter includes:
acquiring attribute information corresponding to the target television and attribute information corresponding to the original video stream;
and determining a default parameter value corresponding to the target compression parameter according to the attribute information corresponding to the target television and the attribute information corresponding to the original video stream.
Optionally, the target compression parameter is specifically any one or more of a compression resolution parameter, a compression frame rate parameter, and an encoding format parameter, the attribute information corresponding to the original video stream is an original frame rate value and an original resolution value corresponding to the original video stream, and the attribute information corresponding to the target television is a screen resolution value, a preset frame rate threshold, and a supported encoder list corresponding to the target television; the determining a default parameter value corresponding to the target compression parameter according to the attribute information corresponding to the target television and the attribute information corresponding to the original video stream includes:
if the original resolution value corresponding to the original video stream is larger than the screen resolution value corresponding to the target television, determining the screen resolution value corresponding to the target television as a default parameter value corresponding to the compression resolution parameter; if the original resolution value corresponding to the original video stream is less than or equal to the screen resolution value corresponding to the target television, determining the original resolution value corresponding to the original video stream as a default parameter value corresponding to the compression resolution parameter; and/or
If the original frame rate value corresponding to the original video stream is greater than the preset frame rate threshold corresponding to the target television, determining the preset frame rate threshold corresponding to the target television as a default parameter value corresponding to the compression frame rate parameter; if the original frame rate value corresponding to the original video stream is less than or equal to the preset frame rate threshold corresponding to the target television, determining the original frame rate value corresponding to the original video stream as a default parameter value corresponding to the compressed frame rate parameter; and/or
Determining a target coding format corresponding to the target television according to the supported encoder list corresponding to the target television, wherein the target coding format corresponding to the target television is a coding format with the highest compression rate in a plurality of coding formats supported by the target television; and determining the target coding format corresponding to the target television as a default parameter value corresponding to the coding format parameter.
Optionally, the generating a partial compressed video stream corresponding to the original video stream according to the original video stream and the default parameter value corresponding to the target compression parameter includes:
intercepting the original video stream to obtain a partial video stream corresponding to the original video stream;
and inputting the part of the video stream and default parameter values corresponding to the target compression parameters into a preset processing tool so that the preset processing tool can compress the part of the video stream according to the default parameter values corresponding to the target compression parameters to obtain a part of compressed video stream corresponding to the original video stream.
Optionally, the compressing the original video stream according to a preset compression rule and a target parameter value corresponding to the target compression parameter to obtain a compressed video stream corresponding to the original video stream includes:
determining whether a compression task starting condition is met or not according to the preset compression rule;
and if so, inputting the original video stream and a target parameter value corresponding to the target compression parameter into a preset processing tool so that the preset processing tool can compress the original video stream according to the target parameter value corresponding to the target compression parameter to obtain a compressed video stream corresponding to the original video stream.
Optionally, the preset compression rule is that if the target terminal device is in an idle state, it is determined that a compression task starting condition is met; if the target terminal equipment receives a compression task starting instruction, determining that a compression task starting condition is met; and if the performance of the target terminal equipment meets the preset requirement, determining that the starting condition of the compression task is met.
In a third aspect, an embodiment of the present application provides a storage medium, where the storage medium includes a stored program, and when the program runs, a device on which the storage medium is located is controlled to execute the recording file compression method according to the second aspect.
In a fourth aspect, embodiments of the present application provide a recorded file compression apparatus, including a storage medium; and one or more processors, the storage medium coupled with the processors, the processors configured to execute program instructions stored in the storage medium; the program instructions, when executed, implement the method for compressing a recording file according to the second aspect.
By means of the technical scheme, the technical scheme provided by the application at least has the following advantages:
the application provides a recording file compression device and a method, and the recording file compression device provided by the application comprises: the device comprises an acquisition unit, a determination unit, a processing unit and a replacement unit; firstly, an acquisition unit acquires a recording file to be compressed in a local storage space of target terminal equipment (or a storage space of the target storage equipment); secondly, determining a target parameter value corresponding to the target compression parameter by a determining unit; thirdly, compressing the original video stream contained in the file to be compressed and recorded by the processing unit according to the preset compression rule and the target parameter value corresponding to the target compression parameter, thereby obtaining a compressed video stream corresponding to the original video stream; and finally, replacing the original video stream by the compressed video stream corresponding to the original video stream in the local storage space of the target terminal device by the replacing unit so as to reduce the occupancy rate of the local storage space of the target terminal device, or replacing the original video stream by the compressed video stream corresponding to the original video stream in the storage space of the target storage device so as to reduce the occupancy rate of the storage space of the target storage device.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
It is to be noted that, unless otherwise specified, technical or scientific terms used herein shall have the ordinary meaning as understood by those skilled in the art to which this application belongs.
The embodiment of the application provides a recorded file compression device, which is applied to a target terminal device, wherein the target terminal device is a target television or a set top box connected with the target television, as shown in fig. 1, the device comprises: the acquiring unit 11 is configured to acquire a recording file to be compressed, where the recording file to be compressed is obtained by recording a television program live broadcast in a target television channel, and the recording file to be compressed includes an original video stream; a determining unit 12, configured to determine a target parameter value corresponding to a target compression parameter; the processing unit 13 is configured to perform compression processing on the original video stream according to a preset compression rule and a target parameter value corresponding to a target compression parameter, so as to obtain a compressed video stream corresponding to the original video stream; a replacement unit 14 for replacing the original video stream with the compressed video stream.
The following describes in detail the detailed process of compressing a to-be-compressed recording file by the recording file compressing apparatus with reference to the recording file compressing apparatus shown in fig. 1:
the target compression parameter may be a code rate parameter, or may be: any one or more of an I-frame parameter, a compression resolution parameter, a compression frame rate parameter, an intra-frame compression rate parameter, and an encoding format parameter is truncated.
In the embodiment of the application, after a user records a television program live broadcast by a target television channel through target terminal equipment to obtain a recording file to be compressed, the target terminal equipment can store the recording file to be compressed into a local storage space or store the recording file to be compressed into target storage equipment; when a user desires to compress a recording file to be compressed, the user sends a corresponding instruction to a target terminal device, at this time, an obtaining unit 11 in the recording file compression device receives the instruction, and obtains the recording file to be compressed in a local storage space of the target terminal device according to the instruction, or obtains the recording file to be compressed in a storage space of the target storage device; after the acquiring unit 11 acquires the recording file to be compressed, the determining unit 12 may determine a target parameter value corresponding to the target compression parameter; after the determining unit 12 determines the target parameter value corresponding to the target compression parameter, the processing unit 13 may compress the original video stream contained in the to-be-compressed recording file according to the preset compression rule and the target parameter value corresponding to the target compression parameter, so as to obtain a compressed video stream corresponding to the original video stream; after the processing unit 13 obtains the compressed video stream corresponding to the original video stream by compression, the replacing unit 14 may replace the original video stream with the compressed video stream corresponding to the original video stream in the local storage space of the target terminal device, so as to reduce the occupancy rate of the local storage space of the target terminal device, or replace the original video stream with the compressed video stream corresponding to the original video stream in the storage space of the target storage device, so as to reduce the occupancy rate of the storage space of the target storage device.
The embodiment of the application provides a record file compression device, and the record file compression device provided by the embodiment of the application comprises: the device comprises an acquisition unit, a determination unit, a processing unit and a replacement unit; firstly, an acquisition unit acquires a recording file to be compressed in a local storage space of target terminal equipment (or a storage space of the target storage equipment); secondly, determining a target parameter value corresponding to the target compression parameter by a determining unit; thirdly, compressing the original video stream contained in the file to be compressed and recorded by the processing unit according to the preset compression rule and the target parameter value corresponding to the target compression parameter, thereby obtaining a compressed video stream corresponding to the original video stream; and finally, replacing the original video stream by the replacing unit by using the compressed video stream corresponding to the original video stream in the local storage space of the target terminal device so as to reduce the occupancy rate of the local storage space of the target terminal device, or replacing the original video stream by using the compressed video stream corresponding to the original video stream in the storage space of the target storage device so as to reduce the occupancy rate of the storage space of the target storage device.
The embodiment of the application also provides another recorded file compression device which is applied to target terminal equipment, wherein the target terminal equipment is a target television or a set top box connected with the target television; as shown in fig. 2, the following explanation is made in conjunction with fig. 2:
further, as shown in fig. 2, the acquiring unit 11 includes: the receiving module 111 is configured to receive a recording file selection instruction, where the recording file selection instruction includes a unique identifier corresponding to a recording file to be compressed; the first obtaining module 112 is configured to obtain the recording file to be compressed in the local storage space according to the unique identifier corresponding to the recording file to be compressed; the second obtaining module 113 is configured to obtain the recording file to be compressed in the target storage device according to the unique identifier corresponding to the recording file to be compressed.
In this embodiment of the application, when a user desires to compress a recording file to be compressed, the user sends a recording file selection instruction carrying a unique identifier corresponding to the recording file to be compressed to a target terminal device, and at this time, the receiving module 111 in the obtaining unit 11 receives the recording file selection instruction; if the target terminal device stores the recording file to be compressed in the local storage space, the first obtaining module 112 in the obtaining unit 11 may obtain the recording file to be compressed in the local storage space of the target terminal device according to the unique identifier corresponding to the recording file to be compressed; if the target terminal device stores the recording file to be compressed into the target storage device, the second obtaining module 113 in the obtaining unit 11 may obtain the recording file to be compressed in the storage space of the target storage device according to the unique identifier corresponding to the recording file to be compressed; wherein, the target storage device may be, but is not limited to: a U disk, a mobile hard disk and the like connected with the target terminal equipment.
Further, as shown in fig. 2, the determination unit 12 includes: a third obtaining module 121, configured to obtain a default parameter value corresponding to the target compression parameter; a generating module 122, configured to generate a partial compressed video stream corresponding to the original video stream according to the original video stream and a default parameter value corresponding to the target compression parameter; an output module 123, configured to output and display a part of the compressed video stream; a first determining module 124, configured to determine, when a confirmation instruction is received, a default parameter value corresponding to the target compression parameter as a target parameter value corresponding to the target compression parameter; the processing module 125 is configured to, when a compression parameter modification instruction is received, modify a default parameter value corresponding to a target compression parameter according to the compression parameter modification instruction to obtain a target parameter value corresponding to the target compression parameter, where the compression parameter modification instruction includes a modification parameter value corresponding to the target compression parameter.
In the embodiment of the present application, the specific process of determining, by the determining unit 12, the target parameter value corresponding to the target compression parameter is as follows: firstly, a third obtaining module 121 obtains a default parameter value corresponding to a target compression parameter; secondly, the generating module 122 generates a partial compressed video stream corresponding to the original video stream according to the default parameter values corresponding to the original video stream and the target compression parameter; thirdly, the output module 123 outputs and displays a part of the compressed video stream generated by the generation module 122, so that the user can preview the compression effect of compressing the recording file to be compressed according to the default parameter value corresponding to the target compression parameter; if the compression effect is satisfied, the user sends a confirmation instruction to the target terminal device, at this time, the first determining module 124 receives the confirmation instruction, and determines the default parameter value corresponding to the target compression parameter as the target parameter value corresponding to the target compression parameter; if the compression effect is not satisfied, the user sends a compression parameter modification instruction carrying a modification parameter value corresponding to the target compression parameter to the target terminal device, at this time, the processing module 125 receives the compression parameter modification instruction, modifies the default parameter value corresponding to the target compression parameter according to the compression parameter modification instruction to obtain a target parameter value corresponding to the target compression parameter, that is, modifies the default parameter value corresponding to the target compression parameter to the modification parameter value corresponding to the target compression parameter, and determines the modification parameter value corresponding to the target compression parameter as the target parameter value corresponding to the target compression parameter.
Further, as shown in fig. 2, the third obtaining module 121 includes: an obtaining submodule 1211, configured to obtain attribute information corresponding to the target television and attribute information corresponding to the original video stream; the determining submodule 1212 is configured to determine a default parameter value corresponding to the target compression parameter according to the attribute information corresponding to the target television and the attribute information corresponding to the original video stream.
In the embodiment of the present application, the default parameter values corresponding to the pruned I-frame parameters are: deleting the I frame, the default parameter values corresponding to the intra-frame compression rate parameter may be, but not limited to: 70%, 60% or 50%, etc., wherein the default parameter value corresponding to the deletion I frame parameter and the default parameter value corresponding to the intra-frame compression rate parameter can be preset by the user; when the target compression parameter is specifically a truncated I frame parameter or an intra-frame compression ratio parameter, the third obtaining module 121 may directly obtain a default parameter value corresponding to the target compression parameter; when the target compression parameter is specifically a compression resolution parameter, a compression frame rate parameter, or a coding format parameter, the specific process of the third obtaining module 121 obtaining the default parameter value corresponding to the target compression parameter is as follows: firstly, the obtaining submodule 1211 obtains attribute information corresponding to a target television and attribute information corresponding to an original video stream; the determining submodule 1212 determines a default parameter value corresponding to the target compression parameter according to the attribute information corresponding to the target television and the attribute information corresponding to the original video stream, which are acquired by the acquiring submodule 1211.
It should be noted that, when the target compression parameter is specifically a bitrate parameter, the third obtaining module 121 may first obtain a bitrate value and a preset ratio corresponding to an original video stream, then calculate a product of the bitrate value and the preset ratio corresponding to the original video stream, and determine a calculation result as a default parameter value corresponding to the bitrate parameter, where the preset ratio is preset by a user, and the preset ratio may be, but is not limited to: 30%, 40% or 50%, etc.
Further, as shown in fig. 2, in this embodiment of the application, the attribute information corresponding to the original video stream obtained by the obtaining sub-module 1211 specifically includes: the obtained attribute information corresponding to the target television is specifically: a screen resolution value, a preset frame rate threshold value and a supported encoder list corresponding to the target television set; when the target compression parameter is specifically any one or more of a compression resolution parameter, a compression frame rate parameter, and a coding format parameter, the specific process of determining, by the determining sub-module 1212, a default parameter value corresponding to the target compression parameter according to the attribute information corresponding to the target television and the attribute information corresponding to the original video stream is as follows: (1) when the original resolution value corresponding to the original video stream is larger than the screen resolution value corresponding to the target television, determining the screen resolution value corresponding to the target television as a default parameter value corresponding to the compression resolution parameter; when the original resolution value corresponding to the original video stream is smaller than or equal to the screen resolution value corresponding to the target television, determining the original resolution value corresponding to the original video stream as a default parameter value corresponding to the compression resolution parameter; (2) when the original frame rate value corresponding to the original video stream is larger than the preset frame rate threshold corresponding to the target television, determining the preset frame rate threshold corresponding to the target television as a default parameter value corresponding to the compressed frame rate parameter; when the original frame rate value corresponding to the original video stream is less than or equal to the preset frame rate threshold value corresponding to the target television, determining the original frame rate value corresponding to the original video stream as a default parameter value corresponding to the compression frame rate parameter; (3) and determining a target coding format corresponding to the target television according to the supported encoder list corresponding to the target television, and determining the target coding format corresponding to the target television as a default parameter value corresponding to the coding format parameter, wherein the target coding format corresponding to the target television is a coding format with the highest compression rate in a plurality of coding formats supported by the target television.
Further, as shown in fig. 2, in this embodiment of the application, a specific process of the generating module 122 generating the partial compressed video stream corresponding to the original video stream according to the default parameter values corresponding to the original video stream and the target compression parameter is as follows: intercepting an original video stream to obtain a partial video stream corresponding to the original video stream, wherein the intercepted partial video stream can be any part of the original video stream; inputting the default parameter values corresponding to the partial video stream and the target compression parameter into a preset processing tool, so that the preset processing tool performs compression processing on the partial video stream according to the default parameter values corresponding to the target compression parameter to obtain a partial compressed video stream corresponding to the original video stream, wherein the preset processing tool may be, but is not limited to: FFmpeg open source video processing tools.
Further, as shown in fig. 2, the processing unit 13 includes: a second determining module 131, configured to determine whether a compression task starting condition is met according to a preset compression rule; the input module 132 is configured to, when it is determined that the compression task starting condition is met, input the original video stream and a target parameter value corresponding to the target compression parameter into the preset processing tool, so that the preset processing tool performs compression processing on the original video stream according to the target parameter value corresponding to the target compression parameter, thereby obtaining a compressed video stream corresponding to the original video stream.
In this embodiment of the present application, the processing unit 13 compresses an original video stream contained in a to-be-compressed recording file according to a preset compression rule and a target parameter value corresponding to a target compression parameter, so as to obtain a compressed video stream corresponding to the original video stream by a specific process that: firstly, the second determining module 131 determines whether the compression task starting condition is met according to a preset compression rule; when the second determining module 131 determines that the compression task starting condition is met, the input module 132 inputs the original video stream and the target parameter value corresponding to the target compression parameter into the preset processing tool, so that the preset processing tool compresses the original video stream according to the target parameter value corresponding to the target compression parameter, thereby obtaining a compressed video stream corresponding to the original video stream; the preset compression rule specifically comprises the following steps: if the target terminal equipment is in an idle state, determining that a compression task starting condition is met, namely determining that the compression task starting condition is met when the target terminal equipment is in a standby state or a dormant state; if the target terminal equipment receives a compression task starting instruction, determining that a compression task starting condition is met; and if the performance of the target terminal equipment meets the preset requirement, determining that the compression task starting condition is met, wherein when the CPU utilization rate of the target terminal equipment is smaller than a preset threshold value and the memory utilization rate is smaller than the preset threshold value, determining that the performance of the target terminal equipment meets the preset requirement.
Further, as an implementation of the apparatus shown in fig. 1 and fig. 2, another embodiment of the present application further provides a method for compressing a recording file, where the method is applied to a target terminal device, and the target terminal device is a target television or a set-top box connected to the target television. The embodiment of the method corresponds to the embodiment of the apparatus, and for convenience of reading, details of the embodiment of the method are not repeated one by one, but it should be clear that the method in the embodiment can correspondingly implement all the contents of the embodiment of the apparatus. The method is applied to reducing the occupancy rate of the local storage space of a television (or a set-top box), or reducing the occupancy rate of the storage space of a target storage device, and specifically as shown in fig. 3, the method includes:
s201, acquiring a recording file to be compressed.
The file to be compressed is obtained by recording a television program live broadcast by a target television channel, and the file to be compressed comprises an original video stream.
S202, determining a target parameter value corresponding to the target compression parameter.
S203, compressing the original video stream according to the preset compression rule and the target parameter value corresponding to the target compression parameter to obtain a compressed video stream corresponding to the original video stream.
And S204, replacing the original video stream with the compressed video stream.
Further, step S201 obtains a recording file to be compressed, including:
receiving a recording file selection instruction, wherein the recording file selection instruction comprises a unique identifier corresponding to a recording file to be compressed;
acquiring a recording file to be compressed in a local storage space according to a unique identifier corresponding to the recording file to be compressed; or
And acquiring the recording file to be compressed in the target storage device according to the unique identifier corresponding to the recording file to be compressed.
Further, step S202, determining a target parameter value corresponding to the target compression parameter, includes:
acquiring a default parameter value corresponding to a target compression parameter;
generating a part of compressed video stream corresponding to the original video stream according to the default parameter values corresponding to the original video stream and the target compression parameter;
outputting and displaying the partial compressed video stream;
if the confirmation instruction is received, determining a default parameter value corresponding to the target compression parameter as a target parameter value corresponding to the target compression parameter;
and if a compression parameter modification instruction is received, modifying the default parameter value corresponding to the target compression parameter according to the compression parameter modification instruction to obtain the target parameter value corresponding to the target compression parameter, wherein the compression parameter modification instruction comprises the modification parameter value corresponding to the target compression parameter.
Further, obtaining a default parameter value corresponding to the target compression parameter includes:
acquiring attribute information corresponding to a target television and attribute information corresponding to an original video stream;
and determining a default parameter value corresponding to the target compression parameter according to the attribute information corresponding to the target television and the attribute information corresponding to the original video stream.
Further, the target compression parameter is specifically any one or more of a compression resolution parameter, a compression frame rate parameter and an encoding format parameter, the attribute information corresponding to the original video stream is an original frame rate value and an original resolution value corresponding to the original video stream, and the attribute information corresponding to the target television is a screen resolution value, a preset frame rate threshold value and a support encoder list corresponding to the target television; determining a default parameter value corresponding to the target compression parameter according to the attribute information corresponding to the target television and the attribute information corresponding to the original video stream, wherein the determining comprises the following steps:
if the original resolution value corresponding to the original video stream is larger than the screen resolution value corresponding to the target television, determining the screen resolution value corresponding to the target television as a default parameter value corresponding to the compression resolution parameter; if the original resolution value corresponding to the original video stream is smaller than or equal to the screen resolution value corresponding to the target television, determining the original resolution value corresponding to the original video stream as a default parameter value corresponding to the compression resolution parameter; and/or
If the original frame rate value corresponding to the original video stream is larger than the preset frame rate threshold corresponding to the target television, determining the preset frame rate threshold corresponding to the target television as a default parameter value corresponding to the compressed frame rate parameter; if the original frame rate value corresponding to the original video stream is less than or equal to the preset frame rate threshold value corresponding to the target television, determining the original frame rate value corresponding to the original video stream as a default parameter value corresponding to the compression frame rate parameter; and/or
Determining a target coding format corresponding to the target television according to a supported encoder list corresponding to the target television, wherein the target coding format corresponding to the target television is a coding format with the highest compression rate in a plurality of coding formats supported by the target television; and determining the target coding format corresponding to the target television as a default parameter value corresponding to the coding format parameter.
Further, generating a partial compressed video stream corresponding to the original video stream according to the default parameter values corresponding to the original video stream and the target compression parameter, including:
intercepting the original video stream to obtain a partial video stream corresponding to the original video stream;
and inputting the part of the video stream and default parameter values corresponding to the target compression parameters into a preset processing tool so that the preset processing tool can compress the part of the video stream according to the default parameter values corresponding to the target compression parameters to obtain the part of the compressed video stream corresponding to the original video stream.
Further, in step S203, compressing the original video stream according to the preset compression rule and the target parameter value corresponding to the target compression parameter to obtain a compressed video stream corresponding to the original video stream, including:
determining whether a compression task starting condition is met or not according to a preset compression rule;
and if so, inputting the original video stream and the target parameter value corresponding to the target compression parameter into a preset processing tool so that the preset processing tool can compress the original video stream according to the target parameter value corresponding to the target compression parameter to obtain a compressed video stream corresponding to the original video stream.
Further, the preset compression rule is that if the target terminal device is in an idle state, it is determined that the compression task starting condition is met; if the target terminal equipment receives a compression task starting instruction, determining that a compression task starting condition is met; and if the performance of the target terminal equipment meets the preset requirement, determining that the starting condition of the compression task is met.
In order to achieve the above object, according to another aspect of the present application, an embodiment of the present application further provides a storage medium, where the storage medium includes a stored program, where the program, when executed, controls a device on the storage medium to execute the above-mentioned recording file compression method.
In order to achieve the above object, according to another aspect of the present application, an embodiment of the present application further provides a recorded file compression apparatus, which includes a storage medium; and one or more processors, the storage medium coupled with the processors, the processors configured to execute program instructions stored in the storage medium; and when the program instruction runs, executing the recording file compression method.
The embodiment of the application provides a recording file compression device and a method, and the recording file compression device provided by the embodiment of the application comprises: the device comprises an acquisition unit, a determination unit, a processing unit and a replacement unit; firstly, an acquisition unit acquires a recording file to be compressed in a local storage space of target terminal equipment (or a storage space of the target storage equipment); secondly, determining a target parameter value corresponding to the target compression parameter by a determining unit; thirdly, compressing the original video stream contained in the file to be compressed and recorded by the processing unit according to the preset compression rule and the target parameter value corresponding to the target compression parameter, thereby obtaining a compressed video stream corresponding to the original video stream; and finally, replacing the original video stream by the compressed video stream corresponding to the original video stream in the local storage space of the target terminal device by the replacing unit so as to reduce the occupancy rate of the local storage space of the target terminal device, or replacing the original video stream by the compressed video stream corresponding to the original video stream in the storage space of the target storage device so as to reduce the occupancy rate of the storage space of the target storage device.
The recorded file compression device comprises a processor and a memory, wherein the acquisition unit, the determination unit, the processing unit, the replacement unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can set one or more than one, and the occupancy rate of the local storage space of the television (or the set top box) is reduced or the occupancy rate of the storage space of the target storage device is reduced by adjusting the kernel parameters.
The embodiment of the application provides a storage medium, which comprises a stored program, wherein when the program runs, the device where the storage medium is located is controlled to execute the recording file compression method.
The storage medium may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
The embodiment of the application also provides a recorded file compression device, which comprises a storage medium; and one or more processors, the storage medium coupled with the processors, the processors configured to execute program instructions stored in the storage medium; and when the program instruction runs, executing the recording file compression method.
The embodiment of the application provides equipment, the equipment comprises a processor, a memory and a program which is stored on the memory and can run on the processor, and the following steps are realized when the processor executes the program:
acquiring a recording file to be compressed, wherein the recording file to be compressed is obtained by recording a television program live broadcast by a target television channel, and the recording file to be compressed comprises an original video stream;
determining a target parameter value corresponding to the target compression parameter;
compressing the original video stream according to a preset compression rule and a target parameter value corresponding to the target compression parameter to obtain a compressed video stream corresponding to the original video stream;
replacing the original video stream with the compressed video stream.
Further, the acquiring the recording file to be compressed includes:
receiving a recording file selection instruction, wherein the recording file selection instruction comprises a unique identifier corresponding to the recording file to be compressed;
acquiring the recording file to be compressed in a local storage space according to the unique identifier corresponding to the recording file to be compressed; or
And acquiring the recording file to be compressed in a target storage device according to the unique identifier corresponding to the recording file to be compressed.
Further, the determining a target parameter value corresponding to the target compression parameter includes:
acquiring a default parameter value corresponding to the target compression parameter;
generating a partial compressed video stream corresponding to the original video stream according to the original video stream and a default parameter value corresponding to the target compression parameter;
outputting and displaying the part of the compressed video stream;
if a confirmation instruction is received, determining a default parameter value corresponding to the target compression parameter as a target parameter value corresponding to the target compression parameter;
and if a compression parameter modification instruction is received, modifying the default parameter value corresponding to the target compression parameter according to the compression parameter modification instruction to obtain a target parameter value corresponding to the target compression parameter, wherein the compression parameter modification instruction comprises a modification parameter value corresponding to the target compression parameter.
Further, the obtaining of the default parameter value corresponding to the target compression parameter includes:
acquiring attribute information corresponding to the target television and attribute information corresponding to the original video stream;
and determining default parameter values corresponding to the target compression parameters according to the attribute information corresponding to the target television and the attribute information corresponding to the original video stream.
Further, the target compression parameter is specifically any one or more of a compression resolution parameter, a compression frame rate parameter, and an encoding format parameter, the attribute information corresponding to the original video stream is an original frame rate value and an original resolution value corresponding to the original video stream, and the attribute information corresponding to the target television is a screen resolution value, a preset frame rate threshold, and a supported encoder list corresponding to the target television; the determining a default parameter value corresponding to the target compression parameter according to the attribute information corresponding to the target television and the attribute information corresponding to the original video stream includes:
if the original resolution value corresponding to the original video stream is larger than the screen resolution value corresponding to the target television, determining the screen resolution value corresponding to the target television as a default parameter value corresponding to the compression resolution parameter; if the original resolution value corresponding to the original video stream is less than or equal to the screen resolution value corresponding to the target television, determining the original resolution value corresponding to the original video stream as a default parameter value corresponding to the compression resolution parameter; and/or
If the original frame rate value corresponding to the original video stream is greater than the preset frame rate threshold corresponding to the target television, determining the preset frame rate threshold corresponding to the target television as a default parameter value corresponding to the compression frame rate parameter; if the original frame rate value corresponding to the original video stream is less than or equal to the preset frame rate threshold corresponding to the target television, determining the original frame rate value corresponding to the original video stream as a default parameter value corresponding to the compressed frame rate parameter; and/or
Determining a target coding format corresponding to the target television according to the supported encoder list corresponding to the target television, wherein the target coding format corresponding to the target television is a coding format with the highest compression rate in a plurality of coding formats supported by the target television; and determining the target coding format corresponding to the target television as a default parameter value corresponding to the coding format parameter.
Further, the generating a partial compressed video stream corresponding to the original video stream according to the default parameter values corresponding to the original video stream and the target compression parameter includes:
intercepting the original video stream to obtain a partial video stream corresponding to the original video stream;
and inputting the part of the video stream and default parameter values corresponding to the target compression parameters into a preset processing tool so that the preset processing tool can compress the part of the video stream according to the default parameter values corresponding to the target compression parameters to obtain a part of compressed video stream corresponding to the original video stream.
Further, the compressing the original video stream according to a preset compression rule and a target parameter value corresponding to the target compression parameter to obtain a compressed video stream corresponding to the original video stream includes:
determining whether a compression task starting condition is met or not according to the preset compression rule;
and if so, inputting the original video stream and a target parameter value corresponding to the target compression parameter into a preset processing tool so that the preset processing tool can compress the original video stream according to the target parameter value corresponding to the target compression parameter to obtain a compressed video stream corresponding to the original video stream.
Further, the preset compression rule is that if the target terminal device is in an idle state, it is determined that a compression task starting condition is met; if the target terminal equipment receives a compression task starting instruction, determining that a compression task starting condition is met; and if the performance of the target terminal equipment meets the preset requirement, determining that the starting condition of the compression task is met.
The present application further provides a computer program product adapted to perform program code for initializing the following method steps when executed on a data processing device: acquiring a recording file to be compressed, wherein the recording file to be compressed is obtained by recording a television program live broadcast by a target television channel, and the recording file to be compressed comprises an original video stream; determining a target parameter value corresponding to the target compression parameter; compressing the original video stream according to a preset compression rule and a target parameter value corresponding to the target compression parameter to obtain a compressed video stream corresponding to the original video stream; replacing the original video stream with the compressed video stream.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may 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 computer storage media 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 that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.