CN108153873B - Compression method of recorded file, television and readable storage medium - Google Patents

Compression method of recorded file, television and readable storage medium Download PDF

Info

Publication number
CN108153873B
CN108153873B CN201711427251.8A CN201711427251A CN108153873B CN 108153873 B CN108153873 B CN 108153873B CN 201711427251 A CN201711427251 A CN 201711427251A CN 108153873 B CN108153873 B CN 108153873B
Authority
CN
China
Prior art keywords
packets
packet
recording file
compression
compressing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711427251.8A
Other languages
Chinese (zh)
Other versions
CN108153873A (en
Inventor
李宏强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen TCL New Technology Co Ltd
Original Assignee
Shenzhen TCL New Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen TCL New Technology Co Ltd filed Critical Shenzhen TCL New Technology Co Ltd
Priority to CN201711427251.8A priority Critical patent/CN108153873B/en
Publication of CN108153873A publication Critical patent/CN108153873A/en
Application granted granted Critical
Publication of CN108153873B publication Critical patent/CN108153873B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1744Redundancy elimination performed by the file system using compression, e.g. sparse files
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/70Media network packetisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/184Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being bits, e.g. of the compressed video stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/85Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using pre-processing or post-processing specially adapted for video compression

Abstract

The invention discloses a compression method of a recording file, a television and a readable storage medium, wherein TS packets of the recording file are obtained, and the same TS packets are combined according to a preset combination rule; and compressing the combined TS packets according to a preset compression algorithm to complete the compression of the recording file. The invention utilizes the characteristics of the TS packets, namely the fixed format of the TS packets in the recording file, and the recording file needs to continuously use a plurality of TS packets with the same PID to transmit large block data due to the limitation of the TS packet capacity. By combining a plurality of same PIDs and compressing the combined TS packets, high-efficiency lossless compression is realized, the size of a recorded file is remarkably reduced, the file is convenient to store and transmit, the compression method is simple and easy to use, and the technical problem that the recorded code stream corresponding to the existing file to be recorded is large in size and inconvenient to store and transmit is solved.

Description

Compression method of recorded file, television and readable storage medium
Technical Field
The invention relates to the technical field of file recording and playing, in particular to a compression method of a recorded file, a television and a readable storage medium.
Background
According to the standard of the ISOI3818, the storage and transmission of the file are realized by recording a Transport Stream (TS, Transport Stream or code Stream)) (188 bytes or other bytes and the like) of the file, and the recorded file is generally a complete TS Packet (Transport Stream Packet) corresponding to a directly recorded file. However, with the improvement of the definition of the recorded files, the popularity of the high-definition recorded files is increasingly improved, and the volume of the recorded files corresponding to the TS packets is increasingly large. For example, when recording 60 seconds of high-definition video, the corresponding recorded code stream exceeds 400 Mbytes. Therefore, when the volume of the recorded code stream corresponding to the file to be recorded is large, the file to be recorded is inconvenient to store and transmit.
Disclosure of Invention
The invention mainly aims to provide a compression method of a recorded file, a television and a readable storage medium, and aims to solve the technical problem that the recorded code stream corresponding to the existing file to be recorded is large in volume and inconvenient to store and transmit.
In order to achieve the above object, the present invention provides a compression method for a recording file, comprising the steps of:
acquiring TS packets of the recording files, and merging the same TS packets according to a preset merging rule;
and compressing the combined TS packets according to a preset compression algorithm to complete the compression of the recording file.
Optionally, before the step of obtaining the TS packets of the recording file and merging the same TS packets according to the preset merging rule, the method further includes:
and replacing the TS packet head of the TS packet with a TSP format head in a preset format, acquiring the PID of the TS packet, and storing the PID to the TSP format head.
Optionally, the step of acquiring a Transport Stream (TS) packet of the recording file, and merging the same TS packet according to a preset merging rule specifically includes:
acquiring TS packets of the recording file, and merging the same TS packets according to the PID;
and acquiring the quantity of the combined TS packets, and storing the quantity of the combined TS packets to the TSP format head.
Optionally, after the step of obtaining the TS packets of the recording file and merging the same TS packets according to the preset merging rule, the method further includes:
judging whether an empty packet exists in the TS packet or not;
and when the empty packet exists, deleting the empty packet, acquiring the number of the empty packet, and storing the number of the empty packet to the TSP format head.
Optionally, after the step of compressing the recording file by compressing the combined TS packet according to a preset compression algorithm and completing the compression of the recording file, the method further includes:
and when a reduction instruction is received, decompressing and reducing the recording file according to the TSP format header.
Optionally, when the restoring instruction is received, the step of decompressing and restoring the recording file according to the TSP format header specifically includes:
and restoring the combined TS packets according to the number of the combined TS packets in the TSP format head, and restoring the deleted empty packets according to the number of the empty packets in the TSP format head.
Optionally, after the step of compressing the recording file by compressing the combined TS packet according to a preset compression algorithm and completing the compression of the recording file, the method further includes:
when a selective reduction instruction is received, acquiring the specified PID of the specified TS packet in the selective reduction instruction;
and acquiring a TS packet matched with the specified PID in the compressed recording file as a specified TS packet according to the TSP format header, and decompressing and restoring the specified TS packet.
Optionally, the step of compressing the combined TS packet according to a preset compression algorithm to complete compression of the recording file specifically includes:
and compressing the combined TS packets according to a gzip compression algorithm to complete the compression of the recording file.
In addition, in order to achieve the above object, the present invention further provides a television set, which includes a processor, a memory, and a compression program stored on the memory and executable by the processor, wherein when the compression program is executed by the processor, the steps of the method for compressing a recording file as described above are implemented.
In addition, to achieve the above object, the present invention further provides a computer readable storage medium having a compression program stored thereon, wherein the compression program, when executed by a processor, implements the steps of the compression method for a recording file as described above.
The invention provides a compression method of a recording file, a television and a readable storage medium, wherein TS packets of the recording file are obtained, and the same TS packets are combined according to a preset combination rule; and compressing the combined TS packets according to a preset compression algorithm to complete the compression of the recording file. In the above way, the present invention utilizes the characteristics of the TS packets, i.e. the fixed format of the TS packets in the recording file, and because of the limitation of the TS packet capacity, the recording file needs to continuously use a plurality of TS packets with the same PID to transmit the large block data. By combining a plurality of same PIDs and compressing the combined TS packets, high-efficiency lossless compression is realized, the size of a recorded file is remarkably reduced, the file is convenient to store and transmit, the compression method is simple and easy to use, and the technical problem that the recorded code stream corresponding to the existing file to be recorded is large in size and inconvenient to store and transmit is solved.
Drawings
Fig. 1 is a schematic diagram of a hardware structure of a television according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of a method for compressing a recorded file according to the present invention;
FIG. 3 is a combined schematic diagram of step S10 in FIG. 2;
FIG. 4 is a flowchart illustrating a second embodiment of a method for compressing a recorded file according to the present invention;
FIG. 5 is a flowchart illustrating a third embodiment of a method for compressing a recorded file according to the present invention;
FIG. 6 is a schematic diagram of the reduction of step S40 according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The main idea of the embodiment scheme of the invention is as follows: acquiring TS packets of the recording files, and merging the same TS packets according to a preset merging rule; and compressing the combined TS packets according to a preset compression algorithm to complete the compression of the recorded file, so that the technical problem that the recorded code stream corresponding to the existing file to be recorded is large in volume and inconvenient to store and transmit is solved.
The compression method of the recorded file related to the embodiment of the invention is mainly applied to the television, and the television can be realized in various ways. For example, a fixed terminal such as a smart tv, a liquid crystal tv, or a curved tv.
While the following description will be described with a P-tv set as a compression terminal for recording files, those skilled in the art will appreciate that the configuration according to the embodiment of the present invention can be applied to other types of terminals besides elements particularly used for mobile purposes.
Referring to fig. 1, fig. 1 is a schematic diagram of a hardware structure of a television according to an embodiment of the present invention. In the embodiment of the present invention, the television set may include a processor 1001 (e.g., a CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used for realizing connection communication among the components; the user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard); the network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface); the memory 1005 may be a high-speed RAM memory, or may be a non-volatile memory (e.g., a magnetic disk memory), and optionally, the memory 1005 may be a storage device independent of the processor 1001.
Those skilled in the art will appreciate that the hardware configuration of the television set shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
With continued reference to fig. 1, the memory 1005 of fig. 1, which is one type of computer-readable storage medium, may include an operating system, a network communication module, and a compression program.
In fig. 1, the network communication module is mainly used for connecting to a server and performing data communication with the server; and the processor 1001 may call the compression program stored in the memory 1005 and perform the following operations:
acquiring TS packets of the recording files, and merging the same TS packets according to a preset merging rule;
in this embodiment, existing transport files generally transport content using TS streams (188 bytes or otherwise) as required by the ISOI3818 standard. When recording, the complete TS packet corresponding to the recording file is generally recorded. The TS stream is composed of TS packets, each of which is composed of a Packet Header (Packet Header) and Packet Data (Packet Data). Where the Packet header indicates what attributes the TS Packet is and gives a unique network identifier PID (PID) of the Packet data. However, with the increase of the popularity of the high definition programs, the volume of the recorded code stream corresponding to the recorded file is larger and larger. If a 60-second high-definition video file is recorded, the recorded code stream exceeds 400 Mbytes. The larger the recording code stream volume of the recorded file is, the more inconvenient the storage and transmission are, so how to reduce the recording code stream volume of the recorded file is a technical problem to be solved at present. In the embodiment, by utilizing the characteristic that a recording file needs to continuously use a plurality of TS packets with the same PID to transmit large blocks of data, the plurality of same PIDs are combined, and the combined TS packets are compressed, so that efficient lossless compression is realized. Specifically, a TS packet of the recording file is acquired. Wherein, only 188 bytes of recorded content can be recorded in the TS packet. Thus, the recording file requires multiple TS packets of the same PID to enter the content. Each TS packet contains a corresponding PID, which is an important parameter for identifying the TS packet and is used to identify the data carried by the TS packet. When the TS code stream is generated, the basic code stream of each type of service (video, audio and data) is endowed with a different identification number PID, and the decoder judges which type of basic code stream of the service a certain TS packet belongs to by means of the PID. As shown in fig. 3, the same PIDs are merged, and the merging step is: obtaining a plurality of TS packets with the same PID, extracting a Header, reserving the Header, and then sequentially connecting a plurality of TS payloads in series. The data after the first byte of the TS packet is TS payload. As in fig. 3, 0x47, TS1, 0x47, TS2, 0x47, TS3, 0x47, TS4, where TS1 in the second box and TS2 in the fourth box in 1 have the same PID, can be merged. I.e., extract a 0x47 and store in the first box Header in 2. TS1 and TS2 are serially connected and stored in the second box Payload in FIG. 2. 0x47 in the fifth frame and TS3 in the sixth frame in 1 are both null packets, the null packets are deleted, and the number of deleted null packets is stored in the third frame Header in 2.
And compressing the combined TS packets according to a preset compression algorithm to complete the compression of the recording file.
Specifically, after merging a plurality of TS packets with the same PID and/or deleting empty packets, the merged content, i.e., the content after the plurality of TS payloads are sequentially concatenated is compressed, and the compressed content is saved to the Payload. Because the combined Payload volume is larger than the volume of the original TS packet, the compression efficiency can be improved, and the volume of the recorded code stream is reduced.
Further, the processor 1001 may also call a compression program stored in the memory 1005, and perform the following operations:
and replacing the TS packet head of the TS packet with a TSP format head in a preset format, acquiring the PID of the TS packet, and storing the PID to the TSP format head.
Further, the processor 1001 may also call a compression program stored in the memory 1005, and perform the following operations:
acquiring TS packets of the recording file, and merging the same TS packets according to the PID;
and acquiring the quantity of the combined TS packets, and storing the quantity of the combined TS packets to the TSP format head.
Further, the processor 1001 may also call a compression program stored in the memory 1005, and perform the following operations:
judging whether an empty packet exists in the recording file;
and when the empty packet exists, deleting the empty packet, acquiring the number of the empty packet, and storing the number of the empty packet to the TSP format head.
Further, the processor 1001 may also call a compression program stored in the memory 1005, and perform the following operations:
and when a reduction instruction is received, decompressing and reducing the recording file according to the TSP format header.
Further, the processor 1001 may also call a compression program stored in the memory 1005, and perform the following operations:
and restoring the combined TS packets according to the number of the combined TS packets in the TSP format head, and restoring the deleted empty packets according to the number of the empty packets in the TSP format head.
Further, the processor 1001 may also call a compression program stored in the memory 1005, and perform the following operations:
when a selective reduction instruction is received, acquiring the specified PID of the specified TS packet in the selective reduction instruction;
and acquiring a TS packet matched with the specified PID in the compressed recording file as a specified TS packet according to the TSP format header, and decompressing and restoring the specified TS packet.
Further, the processor 1001 may also call a compression program stored in the memory 1005, and perform the following operations:
and compressing the combined TS packets according to a gzip compression algorithm to complete the compression of the recording file.
Based on the above compression terminal hardware structure of the recording file, the present invention provides various embodiments of the compression method of the recording file.
The invention provides a compression method of a recorded file.
Referring to fig. 2, fig. 2 is a flowchart illustrating a first embodiment of a method for compressing a recorded file according to the present invention.
In this embodiment, the compression method for the recording file includes the following steps:
step S10, obtaining TS packets of the recording files, and merging the same TS packets according to a preset merging rule;
in this embodiment, according to the requirements of the ISOI3818 standard, the existing transmission file generally uses TS stream, and the transmission of the content is generally performed by using 188 byte TS stream. When recording, the complete TS packet corresponding to the recording file is generally recorded. However, with the increase of the popularity of the high definition programs, the volume of the recorded code stream corresponding to the recorded file is larger and larger. If a 60-second high-definition video file is recorded, the recorded code stream exceeds 400 Mbytes. The larger the recording code stream volume of the recorded file is, the more inconvenient the storage and transmission are, so how to reduce the recording code stream volume of the recorded file is a technical problem to be solved at present. In the embodiment, by utilizing the characteristic that a recording file needs to continuously use a plurality of TS packets with the same PID to transmit large blocks of data, the plurality of same PIDs are combined, and the combined TS packets are compressed, so that efficient lossless compression is realized. Specifically, a TS packet of the recording file is acquired. Wherein, only 188 bytes of recorded content can be recorded in the TS packet. Thus, theRecording a file requires multiple TS packets of the same PID to enter the content. Each TS packet contains a corresponding PID, which is an important parameter for identifying the TS packet and is used to identify the data carried by the TS packet. When the TS code stream is generated, the basic code stream of each type of service (video, audio and data) is endowed with a different identification number PID, and the decoder judges which type of basic code stream of the service a certain TS packet belongs to by means of the PID. As shown in fig. 3, the same PIDs are merged, and the merging step is: obtaining a plurality of TS packets with the same PID, extracting a Header, reserving the Header, and then sequentially connecting a plurality of TS payloads in series. The data after the first byte of the TS packet is TS payload. As in FIG. 3, 0x47, TS1、0x47、TS2、0x47、TS3、0x47、TS4Wherein, the TS in the second frame in 11And TS in the fourth frame2With the same PID, can be combined. I.e., extract a 0x47 and store in the first box Header in 2. TS (transport stream)1And TS2Serially connected in sequence and stored in the second box Payload in 2. 0x47 in the fifth box and TS in the sixth box in 13And deleting the empty packets, and storing the number of the deleted empty packets in a Header of a third frame in the step 2.
And step S20, compressing the combined TS packets according to a preset compression algorithm to complete compression of the recording file.
Specifically, after merging a plurality of TS packets with the same PID and/or deleting empty packets, the merged content, i.e., the content after the plurality of TS payloads are sequentially concatenated is compressed, and the compressed content is saved to the Payload. Because the combined Payload volume is larger than the volume of the original TS packet, the compression efficiency can be improved, and the volume of the recorded code stream is reduced.
And further compressing the combined TS packets according to a gzip compression algorithm to complete compression of the recording file.
Specifically, the merged Payload content is compressed by using a gzip (gnuzip) compression algorithm. After the file content is compressed, the storage space can be reduced, and the transmission time can be reduced when the file is transmitted through a network. The gzip compression algorithm in the embodiment is not only convenient to use, but also has high compression efficiency.
The embodiment provides a compression method of a recording file, a television and a readable storage medium, wherein TS packets of the recording file are obtained, and the same TS packets are merged according to a preset merging rule; and compressing the combined TS packets according to a preset compression algorithm to complete the compression of the recording file. In the above way, the present invention utilizes the characteristics of the TS packets, i.e. the fixed format of the TS packets in the recording file, and because of the limitation of the TS packet capacity, the recording file needs to continuously use a plurality of TS packets with the same PID to transmit the large block data. By combining a plurality of same PIDs and compressing the combined TS packets, high-efficiency lossless compression is realized, the size of a recorded file is remarkably reduced, the file is convenient to store and transmit, the compression method is simple and easy to use, and the technical problem that the recorded code stream corresponding to the existing file to be recorded is large in size and inconvenient to store and transmit is solved.
Referring to fig. 4, fig. 4 is a detailed flowchart of step S10 in fig. 2.
Based on the above embodiment shown in fig. 2, before step S10, the method further includes:
and step S01, replacing the TS packet head of the TS packet with a TSP format head in a preset format, acquiring the PID of the TS packet, and storing the PID to the TSP format head.
Specifically, in order to facilitate merging and subsequent restoration, the first byte 0x47, i.e., the Header, in the original TS packet may be replaced with a TSP format Header. Wherein, the TSP format header may include: the PacketType is used to indicate the number of TS packets that the recording file has, and the PID is used as an identifier. And the AHF is used as a null packet identification bit, and when the AHF is equal to 1, a null packet exists, and when the AHF is equal to 0, no null packet exists. NumTS, used as a specific number of null packets. DNP is used as the number of deleted null packets, that is, the number of deleted null packets can be known by reading the number, and then the corresponding number of null packets is filled. Payload, which is used as data after the first byte of the TS packet, can store up to 64 kbytes of content. And acquiring the PID of each TS packet in the recording file, and storing each PID into a corresponding TSP format header, such as a PID identifier.
Step S10 specifically includes:
step S11, obtaining the TS packet of the recording file, and merging the same TS packet according to the PID;
specifically, each TS packet of the recording file is acquired, a plurality of TS packets with the same PID are acquired, a Header of one of the plurality of TS packets is extracted, the Header is retained, and then the plurality of TS payloads are sequentially connected in series.
Step S12, acquiring the number of TS packets to be merged, and storing the number of TS packets to be merged in the TSP format header.
Specifically, the number of TS packets to be merged is obtained, and the number of TS packets to be merged is sequentially stored in the TSP format header.
The embodiment provides a compression method of a recording file, a television and a readable storage medium, wherein TS packets of the recording file are obtained, and the same TS packets are merged according to a preset merging rule; and compressing the combined TS packets according to a preset compression algorithm to complete the compression of the recording file. In the above way, the present invention utilizes the characteristics of the TS packets, i.e. the fixed format of the TS packets in the recording file, and because of the limitation of the TS packet capacity, the recording file needs to continuously use a plurality of TS packets with the same PID to transmit the large block data. By combining a plurality of same PIDs and compressing the combined TS packets, high-efficiency lossless compression is realized, the size of a recorded file is remarkably reduced, the file is convenient to store and transmit, the compression method is simple and easy to use, and the technical problem that the recorded code stream corresponding to the existing file to be recorded is large in size and inconvenient to store and transmit is solved.
Referring to fig. 5, fig. 5 is a flowchart illustrating a compression method for a recording file according to a third embodiment of the present invention.
Based on the embodiment shown in fig. 2, after step S10, the method further includes:
step S31, judging whether there is empty packet in the TS packet;
specifically, since 188 bytes are not sufficient after the recording file data is blocked, a large amount of empty packets of 0xff are required to be filled. In addition, in order to control the broadcasting rate, a large number of null packets need to be inserted, and the content of the null packets is meaningless. Therefore, the empty packet can be deleted for code stream physical examination reduction. And judging whether the TS packet has an empty packet or not by reading an empty packet identification bit AHF.
And step S32, when empty packets exist, deleting the empty packets, acquiring the number of the empty packets, and storing the number of the empty packets to the TSP format header.
Specifically, when the empty packet identification bit AHF is 1, then the TS packet is empty. And acquiring all empty packets in the TS, and deleting all empty packets. And then acquiring the number of the empty packets, and storing the number of the empty packets into the TSP format header for subsequent lossless restoration.
The embodiment provides a compression method of a recording file, a television and a readable storage medium, wherein TS packets of the recording file are obtained, and the same TS packets are merged according to a preset merging rule; and compressing the combined TS packets according to a preset compression algorithm to complete the compression of the recording file. In the above way, the present invention utilizes the characteristics of the TS packets, i.e. the fixed format of the TS packets in the recording file, and because of the limitation of the TS packet capacity, the recording file needs to continuously use a plurality of TS packets with the same PID to transmit the large block data. By combining a plurality of same PIDs and compressing the combined TS packets, high-efficiency lossless compression is realized, the size of a recorded file is remarkably reduced, the file is convenient to store and transmit, the compression method is simple and easy to use, and the technical problem that the recorded code stream corresponding to the existing file to be recorded is large in size and inconvenient to store and transmit is solved.
Further, the compression method of the recording file further comprises the following steps:
and step S40, when a reduction instruction is received, decompressing and reducing the recording file according to the TSP format header.
Specifically, in this embodiment, after compressing the recording file, lossless restoration can be further implemented, so that the recording file is conveniently saved in transmission. When a restoring instruction triggered by the outside is received, the TS packet in the recording file is obtained, then a TSP format head of the TS packet is obtained, the TSP format head is read, and the TSP format head stores the number of the combined PIDs, the number of the deleted empty packets and the like. In a specific embodiment, the following may be obtained in sequence: the PacketType is used to indicate the number of TS packets that the recording file has, and the PID is used as an identifier. And the AHF is used as a null packet identification bit, and when the AHF is equal to 1, a null packet exists, and when the AHF is equal to 0, no null packet exists. NumTS, used as a specific number of null packets. DNP is used as the number of deleted null packets, that is, the number of deleted null packets can be known by reading the number, and then the corresponding number of null packets is filled. Payload, which is used as data after the first byte of the TS packet, can store up to 64 kbytes of content. And correspondingly decompressing and restoring each TS packet in the recording file through the identification content, thereby decompressing and restoring the recording file.
Further, step S40 specifically includes:
and step S41, restoring the merged TS packets according to the number of the merged TS packets in the TSP format header, and restoring the deleted empty packets according to the number of the empty packets in the TSP format header.
Specifically, the number of the merged TS packets in the TSP format header is acquired, and then the merged TS packets are restored according to the number of the TS packets. As shown in FIG. 6, the Header in the first frame of 3 is restored to byte 0x47 in the first frame of 4, and the Payload in the second frame of 3 is restored to TS in the second frame of 41And TS in the fourth frame2And according to the number of the two combined TS packets, adding packet Header bytes 0x47 in a third frame in 4, and restoring a Header in the third frame in 3 into a TS in a fifth frame in 43And TS in sixth frame4Wherein TS3And TS4Empty packet, etc.
Step S51, when receiving the selective reduction command, obtaining the appointed PID of the appointed TS packet in the selective reduction command;
specifically, the TSP format header of the present embodiment has a PID field, and may be configured with a filter to filter out packets with a specified PID, and then perform a restore operation. Namely, the appointed PID of the appointed TS packet in the selective reduction instruction is obtained.
And step S52, according to the TSP format header, acquiring a TS packet matched with the specified PID in the compressed recording file as a specified TS packet, and decompressing and restoring the specified TS packet.
Specifically, according to the PID included in the TSP format header, a TS packet matching the specified PID is acquired as a specified TS packet. And then decompressing and restoring the specified TS packet to finish the restoration operation of the specified TS packet.
The embodiment provides a compression method of a recording file, a television and a readable storage medium, wherein TS packets of the recording file are obtained, and the same TS packets are merged according to a preset merging rule; and compressing the combined TS packets according to a preset compression algorithm to complete the compression of the recording file. In the above way, the present invention utilizes the characteristics of the TS packets, i.e. the fixed format of the TS packets in the recording file, and because of the limitation of the TS packet capacity, the recording file needs to continuously use a plurality of TS packets with the same PID to transmit the large block data. By combining a plurality of same PIDs and compressing the combined TS packets, high-efficiency lossless compression is realized, the size of a recorded file is remarkably reduced, the file is convenient to store and transmit, the compression method is simple and easy to use, and the technical problem that the recorded code stream corresponding to the existing file to be recorded is large in size and inconvenient to store and transmit is solved.
Furthermore, the invention also provides a television.
The television set comprises a processor, a memory and a compression program which is stored on the memory and can be executed by the processor, wherein when the compression program is executed by the processor, the steps of the compression method of the recorded file are realized.
The method for implementing the compression program when executed may refer to various embodiments of the compression method for recording files of the present invention, and will not be described herein again.
Further, the present invention also provides a computer readable storage medium.
The computer readable storage medium of the present invention stores a compression program, wherein the compression program, when executed by a processor, implements the steps of the method for compressing a recording file as described above.
The method for implementing the compression program when executed may refer to various embodiments of the compression method for recording files of the present invention, and will not be described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system 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 system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (8)

1. A compression method of a recorded file is characterized by comprising the following steps:
replacing a TS packet head of a TS packet of a recording file with a TSP format head in a preset format, acquiring a PID (proportion integration differentiation) of the TS packet, and storing the PID to the TSP format head, wherein the PID of elementary streams of different services in the TS packet is different, and the elementary streams of different services comprise elementary streams of video services, elementary streams of audio services and elementary streams of data services;
acquiring TS packets of the recording files, and merging the same TS packets according to a preset merging rule;
compressing the combined TS packets according to a preset compression algorithm to complete compression of the recording file;
the step of acquiring the TS packets of the recording file and merging the same TS packets according to a preset merging rule comprises the following steps:
acquiring TS packets of the recording file, and merging the same TS packets according to the PID;
and acquiring the quantity of the combined TS packets, and storing the quantity of the combined TS packets to the TSP format head.
2. The method for compressing a recording file according to claim 1, wherein after the step of obtaining the TS packets of the recording file and merging the same TS packets according to the preset merging rule, the method further comprises:
judging whether an empty packet exists in the TS packet or not;
and when the empty packet exists, deleting the empty packet, acquiring the number of the empty packet, and storing the number of the empty packet to the TSP format head.
3. The method for compressing the recording file according to claim 2, wherein the step of compressing the recording file by compressing the combined TS packets according to a preset compression algorithm further comprises:
and when a reduction instruction is received, decompressing and reducing the recording file according to the TSP format header.
4. The method as claimed in claim 3, wherein said step of decompressing and restoring said recorded file according to said TSP format header upon receiving a restoring instruction comprises:
and restoring the combined TS packets according to the number of the combined TS packets in the TSP format head, and restoring the deleted empty packets according to the number of the empty packets in the TSP format head.
5. The method for compressing the recording file according to claim 2, wherein the step of compressing the recording file by compressing the combined TS packets according to a preset compression algorithm further comprises:
when a selective reduction instruction is received, acquiring the specified PID of the specified TS packet in the selective reduction instruction;
and acquiring a TS packet matched with the specified PID in the compressed recording file as a specified TS packet according to the TSP format header, and decompressing and restoring the specified TS packet.
6. The method according to any one of claims 1 to 5, wherein the step of compressing the combined TS packets according to a preset compression algorithm to complete the compression of the recording file specifically comprises:
and compressing the combined TS packets according to a gzip compression algorithm to complete the compression of the recording file.
7. A television set, characterized in that the television set comprises a processor, a memory, and a compression program stored on the memory and executable by the processor, wherein the compression program when executed by the processor implements the steps of the method of compressing a recording file according to any one of claims 1 to 6.
8. A computer-readable storage medium, having a compression program stored thereon, wherein the compression program, when executed by a processor, implements the steps of the method of compressing a recording file according to any one of claims 1 to 6.
CN201711427251.8A 2017-12-22 2017-12-22 Compression method of recorded file, television and readable storage medium Active CN108153873B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711427251.8A CN108153873B (en) 2017-12-22 2017-12-22 Compression method of recorded file, television and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711427251.8A CN108153873B (en) 2017-12-22 2017-12-22 Compression method of recorded file, television and readable storage medium

Publications (2)

Publication Number Publication Date
CN108153873A CN108153873A (en) 2018-06-12
CN108153873B true CN108153873B (en) 2022-04-22

Family

ID=62462711

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711427251.8A Active CN108153873B (en) 2017-12-22 2017-12-22 Compression method of recorded file, television and readable storage medium

Country Status (1)

Country Link
CN (1) CN108153873B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108833945B (en) * 2018-06-29 2021-12-17 井冈山电器有限公司 Method and device for simultaneously transmitting multiple TS streams by using single-channel DMA (direct memory Access)
CN108965295B (en) * 2018-07-17 2021-09-17 郑州云海信息技术有限公司 File compression and combination method and related device
CN109743573A (en) * 2018-12-29 2019-05-10 深圳Tcl新技术有限公司 Media playing method, device, intelligent terminal and computer readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101043620A (en) * 2006-06-19 2007-09-26 华为技术有限公司 TV program transmission method and apparatus
CN105740298A (en) * 2014-12-12 2016-07-06 北京奇虎科技有限公司 File processing method and apparatus, and server-side equipment
CN106776663A (en) * 2015-11-25 2017-05-31 腾讯科技(深圳)有限公司 The compression method and device of audio file

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4251133B2 (en) * 2004-11-29 2009-04-08 ソニー株式会社 Image compression apparatus and method
EP2645709B1 (en) * 2010-11-23 2019-10-23 LG Electronics Inc. Broadcast signal transmitting apparatus and broadcast signal transceiving method in broadcast signal transmitting apparatus
CN102012818B (en) * 2010-12-01 2014-03-26 广东威创视讯科技股份有限公司 Screen recording method and device
CN103873860B (en) * 2014-03-18 2017-12-22 深信服网络科技(深圳)有限公司 Document transmission method and device
US9998748B2 (en) * 2014-04-16 2018-06-12 Disney Enterprises, Inc. Methods and systems of archiving media files
CN105049920B (en) * 2015-07-27 2018-08-10 青岛海信移动通信技术股份有限公司 A kind of method for recording and device of multimedia file

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101043620A (en) * 2006-06-19 2007-09-26 华为技术有限公司 TV program transmission method and apparatus
CN105740298A (en) * 2014-12-12 2016-07-06 北京奇虎科技有限公司 File processing method and apparatus, and server-side equipment
CN106776663A (en) * 2015-11-25 2017-05-31 腾讯科技(深圳)有限公司 The compression method and device of audio file

Also Published As

Publication number Publication date
CN108153873A (en) 2018-06-12

Similar Documents

Publication Publication Date Title
CN108153873B (en) Compression method of recorded file, television and readable storage medium
KR100717008B1 (en) Method and apparatus for transmitting and receiving of partial font file
US7089554B2 (en) Program executing apparatus
CN108900843A (en) Monochrome image compression method, device, medium and electronic equipment
WO2019011133A1 (en) Data transmission method, device, server and storage medium
CN105721934A (en) Video wireless transmission device and method, video play device and method, and system
CN112202939A (en) Method, device and storage medium for compressing and decompressing IP address and transmitting and receiving message
US9282331B2 (en) Image processing method and electronic device
CN109584889B (en) Audio transmission method and device and storage medium
CN113014510A (en) Data caching method and device in distributed test of inertial navigation system
CN101141442B (en) System and method for implementing memory card function service
CN113704206B (en) Metadata processing method and device, electronic equipment and storage medium
CN113573059B (en) Image display method, image display apparatus, storage medium, and electronic apparatus
CN104219537A (en) Video data processing method, device and system
CN110545107B (en) Data processing method and device, electronic equipment and computer readable storage medium
US8395537B2 (en) Methods for compressing and decompressing mifare applications
US8346970B2 (en) Data relay device, data receiving device and communication system
KR101683409B1 (en) Encapsulation of video scanning format information for media transport and storage
CN108055573B (en) Data processing method and smart television
CN101321231A (en) Method, system and device for storing and reading television image
CN113099270A (en) File storage method, decoding method, device, storage medium and electronic device
JP2002531974A (en) Compressed data loadable chip card
CN106534137B (en) Media stream transmission method and device
WO2020103057A1 (en) Data processing method, apparatus, electronic device and storage medium
CN106874285B (en) Photo file processing method and terminal equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant