CN111225210B - Video coding method, video coding device and terminal equipment - Google Patents

Video coding method, video coding device and terminal equipment Download PDF

Info

Publication number
CN111225210B
CN111225210B CN201811414972.XA CN201811414972A CN111225210B CN 111225210 B CN111225210 B CN 111225210B CN 201811414972 A CN201811414972 A CN 201811414972A CN 111225210 B CN111225210 B CN 111225210B
Authority
CN
China
Prior art keywords
video
pts
time period
lossy
lossless
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
CN201811414972.XA
Other languages
Chinese (zh)
Other versions
CN111225210A (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 Weibo Technology Co ltd
Original Assignee
Shenzhen Weibo 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 Weibo Technology Co ltd filed Critical Shenzhen Weibo Technology Co ltd
Priority to CN201811414972.XA priority Critical patent/CN111225210B/en
Publication of CN111225210A publication Critical patent/CN111225210A/en
Application granted granted Critical
Publication of CN111225210B publication Critical patent/CN111225210B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/17Methods 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 an image region, e.g. an object
    • H04N19/172Methods 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 an image region, e.g. an object the region being a picture, frame or field
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/845Structuring of content, e.g. decomposing content into time segments
    • H04N21/8456Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The application is applicable to the technical field of video processing, and provides a video coding method, a video coding device, a terminal device and a computer readable storage medium, wherein the video coding method comprises the following steps: acquiring a video file to be edited; obtaining a display time stamp PTS list of all instantaneous decoding refreshing IDR frames in the video file to be edited; obtaining a lossy time period and a lossless time period of the video cutting segment according to PTS lists of all IDR frames in the video file to be edited and a start PTS and an end PTS of the video cutting segment; lossy coding is carried out on the video frame in the lossy time period so as to obtain a lossy video frame; lossless coding is carried out on the video frames in the lossless time period so as to obtain lossless video frames; and synthesizing the damaged video frame and the lossless video frame, and outputting the synthesized video frame and the lossless video frame to a specified file. The method and the device can solve the problem that in the prior art, the video quality is poor due to the fact that a lossy coding mode is adopted to output the video.

Description

Video coding method, video coding device and terminal equipment
Technical Field
The present application belongs to the field of video processing technologies, and in particular, to a video encoding method, a video encoding apparatus, a terminal device, and a computer-readable storage medium.
Background
The video editing is an editing process of firstly using a shooting device to shoot and record an expected image and then using video editing software to make the image into a disc. In video editing software in the current market, video materials edited by the video editing software usually come from the same shooting equipment, and after being edited, videos are output in a lossy coding mode. In practice, most video segments of an edited video are not processed, and if the video is output in a lossy coding mode, the video quality will be poor, for example, some common editing software adobe premiere/conference audio/video and the like are output in the lossy coding mode.
Disclosure of Invention
In view of the above, the present application provides a video encoding method, a video encoding apparatus, a terminal device and a computer readable storage medium, so as to solve the problem in the prior art that the quality of a video is poor due to the fact that a lossy encoding mode is adopted to output the video.
A first aspect of the present application provides a video encoding method, including:
acquiring a video file to be edited;
obtaining a display time stamp PTS list of all instantaneous decoding refreshing IDR frames in the video file to be edited;
obtaining a lossy time period and a lossless time period of the video cutting segment according to PTS lists of all IDR frames in the video file to be edited and a start PTS and an end PTS of the video cutting segment, wherein the video cutting segment refers to a video segment reserved after the video file to be edited is cut;
lossy coding is carried out on the video frame in the lossy time period so as to obtain a lossy video frame;
lossless coding is carried out on the video frames in the lossless time period so as to obtain lossless video frames;
and synthesizing the damaged video frame and the lossless video frame, and outputting the synthesized video frame and the lossless video frame to a specified file.
A second aspect of the present application provides a video encoding device, comprising:
the file acquisition module is used for acquiring a video file to be edited;
the list acquisition module is used for acquiring display time stamp PTS lists of all instantaneous decoding refreshing IDR frames in the video file to be edited;
the time acquisition module is used for acquiring a lossy time period and a lossless time period of the video cutting segment according to PTS lists of all IDR frames in the video file to be edited and a start PTS and an end PTS of the video cutting segment, wherein the video cutting segment refers to a video segment reserved after cutting the video file to be edited;
a lossy coding module, configured to perform lossy coding on the video frame in the lossy time period to obtain a lossy video frame;
a lossless encoding module, configured to perform lossless encoding on the video frame within the lossless time period to obtain a lossless video frame;
and the video synthesis file is used for synthesizing the lossy video frame and the lossless video frame and outputting the synthesized video frame and the lossless video frame to a specified file.
A third aspect of the present application provides a terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the video encoding method according to the first aspect when executing the computer program.
A fourth aspect of the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the video encoding method as described in the first aspect above.
A fifth aspect of the present application provides a computer program product comprising a computer program which, when executed by one or more processors, performs the steps of the video encoding method as described in the first aspect above.
From the above, according to the scheme of the application, the PTS lists of all IDR frames in the video file to be edited are obtained first, the lossy time period and the lossless time period of the video clip segment can be obtained according to the PTS lists and the start PTS and the end PTS of the video clip segment, the video frames in the lossy time period are subjected to lossy coding, the video frames in the lossless time period are subjected to lossless coding, and the lossy video frames and the lossless video frames are synthesized and output, so that the coding conversion speed and the quality of output video are improved through lossy and lossless fusion coding.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic flow chart illustrating an implementation of a video encoding method according to an embodiment of the present application;
FIG. 2 is an exemplary diagram of lossy and lossless time periods;
fig. 3 is a schematic flowchart of an implementation of a video encoding method according to a second embodiment of the present application;
fig. 4 is a schematic diagram of a video encoding apparatus according to a third embodiment of the present application;
fig. 5 is a schematic diagram of a terminal device according to a fourth embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that, the sequence numbers of the steps in this embodiment do not mean the execution sequence, and the execution sequence of each process should be determined by the function and the inherent logic of the process, and should not constitute any limitation to the implementation process of the embodiment of the present application.
In order to explain the technical solution described in the present application, the following description will be given by way of specific examples.
Referring to fig. 1, which is a schematic flowchart illustrating an implementation flow of a video encoding method according to an embodiment of the present application, as shown in the figure, the video encoding method may include the following steps:
step S101, a video file to be edited is obtained.
In the embodiment of the application, when the video file to be edited input by a user is detected, the video file to be edited input by the user is obtained. The video file to be edited may refer to any video file input by a user, for example, a short video shot by the user using a mobile phone, a video downloaded by the user from the internet, and the like, which is not limited herein.
Step S102, obtaining PTS lists of all IDR frames in the video file to be edited.
In this embodiment of the application, after the video file to be edited is obtained, the video file to be edited may be preprocessed and analyzed, and each video frame in the video file to be edited is analyzed to determine whether the video frame is an Instantaneous Decoding Refresh (IDR) frame, so as to find an IDR frame in the video file to be edited, and obtain a Presentation Time Stamp (PTS) corresponding to each IDR frame, so as to obtain a PTS list of all IDR frames in the video file to be edited. The purpose of the IDR frame is to refresh it immediately so that errors do not propagate, and normally all frames following the IDR frame cannot refer to the content preceding the IDR frame. The PTS is used to characterize the time at which the video frame is displayed, e.g., the PTS of video frame a may be used to indicate when the player should display video frame a. The PTS list of all IDR frames includes the PTS of each of all IDR frames.
Step S103, according to the PTS lists of all IDR frames in the video file to be edited and the start PTS and the end PTS of the video clip segment, obtaining the loss time segment and the lossless time segment of the video clip segment.
The video cutting segment refers to a video segment reserved after the video file to be edited is cut.
In the embodiment of the present application, when a cutting operation of a user on a video file to be edited is detected, a start point PTS and an end point PTS of a video segment (i.e., a video cut segment) that is reserved after cutting may be obtained, and the start point PTS and the end point PTS of the video cut segment are respectively compared with the PTS in the PTS lists of all IDR frames, so as to obtain an IDR frame and a PTS of the IDR frame that are located between the start point PTS and the end point PTS of the video cut segment, and further obtain a lossy time segment and a lossless time segment of the video cut segment. The lossy time period refers to a time period for performing lossy coding, and the lossless time period refers to a time period for performing lossless coding.
Optionally, the obtaining the lossy time segment and the lossless time segment of the video clip according to the PTS lists of all IDR frames in the video file to be edited and the start PTS and the end PTS of the video clip includes:
obtaining IDR frames in the video clipping segment and PTS of the IDR frames according to PTS lists of all IDR frames in the video file to be edited and start PTS and end PTS of the video clipping segment, wherein the video clipping segment at least comprises two IDR frames;
selecting a time period between a start PTS of the video shearing section and a PTS of a first IDR frame in the video shearing section, and a time period between a PTS of a last IDR frame in the video shearing section and an end PTS of the video shearing section as a loss time period of the video shearing section, wherein a time period between the PTS of the first IDR frame in the video shearing section and the PTS of the last IDR frame in the video shearing section is a lossless time period of the video shearing section.
In the embodiment of the present application, PTS in PTS lists of all IDR frames in a video file to be edited is compared with start PTS and end PTS of a video clip to obtain an IDR frame and PTS of the IDR frame located in the video clip, a time period between the start PTS of the video clip and the PTS of a first IDR frame in the video clip, a time period between PTS of a last IDR frame in the video clip and end PTS of the video clip may be selected as a lossy time period of the video clip, and a time period between PTS of the first IDR frame in the video clip and PTS of a last IDR frame in the video clip is selected as a lossless time period of the video clip.
Illustratively, T1 in fig. 2 is a start PTS of a video file to be edited, T2 is a start PTS of a video clip, T3 is a PTS of a first IDR frame, T4 is a PTS of a second IDR frame, T5 is an end PTS of a video clip, and T6 is an end PTS of a video file to be edited, then a time period between T2 and T3 and a time period between T4 and T5 are lossy time periods of the video clip, and a time period between T3 and T4 is a lossless time period of the horizontal clip.
In the embodiment of the present application, in order to further improve the speed and quality of the output video, when the time period between the PTS of the first IDR frame in the video clip and the PTS of the last IDR frame in the video clip is selected as the lossless time period of the video clip, it is further possible to determine whether video post-processing has been performed on video frames in a time period between the PTS of the first IDR frame in the video clip and the PTS of the last IDR frame in the video clip, if no video post-processing is performed on video frames in a time period between the PTS of the first IDR frame in the video clip and the PTS of the last IDR frame in the video clip, a time period between the PTS of the first IDR frame in the video clip and the PTS of the last IDR frame in the video clip may be selected as a lossless time period of the video clip; and if a video frame for video post-processing exists in the time period between the PTS of the first IDR frame in the video shearing section and the PTS of the last IDR frame in the video shearing section, screening the time period between the PTS of the first IDR frame in the video shearing section and the PTS of the last IDR frame in the video shearing section to screen out the time period in which the video frame without video post-processing exists and the time period is positioned between the two IDR frames, wherein the time period is a lossless time period of the video shearing section. The video post-processing may refer to adding an action of changing video content such as transition/special effect to the video.
In the embodiment of the present application, since the interval between two IDR frames is an independent video segment, the video frames in the interval are not affected by the video frames outside the interval, and the decoding of the video frames in the interval is independent and safe, in order to improve the quality of the output video, the video frames in the interval can be losslessly encoded, and the output with the same quality as that of the source file (i.e., the video file to be edited) is ensured.
And step S104, carrying out lossy coding on the video frame in the lossy time period to obtain a lossy video frame.
In this embodiment of the present application, after a lossy period is obtained, a video frame in the lossy period may be obtained according to the lossy period, and lossy coding may be performed on the video frame in the lossy period, so as to obtain a lossy video frame. The process of decoding a video frame first and then re-encoding the decoded video frame, where there is a loss of quality of the video in the decoding and re-encoding, may be referred to as lossy encoding. For example, the video is decoded into video frames of YV12 format, and then the video frames of YV12 format are re-encoded and encapsulated into video frames of H264 format.
Optionally, before performing lossy encoding on the video frame in the lossy time period, the method further includes:
and decoding the video frames in the lossy time period from the video file to be edited.
In the embodiment of the application, the video frame within the lossy time can be decoded from the video file to be edited, and lossy coding is performed on the decoded video frame within the lossy time, so that the accuracy of the obtained video frame is improved.
And step S105, carrying out lossless coding on the video frame in the lossless time period to obtain a lossless video frame.
In the embodiment of the present application, after the lossless time period is acquired, the video frame in the lossless time period may be acquired according to the lossless time period, and the video frame in the lossless time period may be subjected to lossless encoding, so as to acquire a high-quality lossless video frame. The video is not decoded, and only the finished video frame is separated from the video file, and the video frame is repackaged into a file format such as MP4/MOV, and the video coding is finished, which is called lossless coding.
Optionally, before lossless encoding the video frame in the lossless time period, the method further includes:
and separating the video frames in the lossless time period from the video file to be edited.
In the embodiment of the application, the video frame in the lossless time period can be separated from the video file to be edited, and the video frame in the separated lossless time period is subjected to lossless coding, so that the accuracy of the obtained video frame is improved.
And step S106, synthesizing the lossy video frame and the lossless video frame, and outputting the synthesized lossy video frame and the lossless video frame to a specified file.
In this embodiment of the present application, after a lossy video frame and a lossless video frame are obtained, a file synthesizer may be used to merge the lossy video frame and the lossless video frame into one video file and output the video file. The designated file may be a file in a designated format, and a user may designate the format of the file according to actual needs, for example, merge a lossy video frame and a lossless video frame into a file in an MP4 format, which is not limited herein.
According to the method and the device, the PTS lists of all IDR frames in the video file to be edited are obtained, the lossy time period and the lossless time period of the video cutting segment can be obtained according to the PTS lists and the start PTS and the end PTS of the video cutting segment, the video frames in the lossy time period are subjected to lossy coding, the video frames in the lossless time period are subjected to lossless coding, the lossy video frames and the lossless video frames are synthesized and output, and therefore the coding conversion speed and the quality of output video are improved through lossy and lossless fusion coding.
Referring to fig. 3, which is a schematic flowchart illustrating an implementation flow of a video encoding method provided in the second embodiment of the present application, the video encoding method may include the following steps:
step S301, a video file to be edited is obtained.
The step is the same as step S101, and reference may be made to the related description of step S101, which is not repeated herein.
Step S302, obtain all PTS lists of IDR frames in the video file to be edited.
The step is the same as step S102, and reference may be made to the related description of step S102, which is not repeated herein.
Step S303, according to the PTS lists of all IDR frames in the video file to be edited and the start PTS and the end PTS of the video clip segment, obtaining the lossy time segment and the lossless time segment of the video clip segment.
The step is the same as step S103, and reference may be made to the related description of step S103, which is not described herein again.
Step S304, extracting decoding extra data from the video file to be edited.
Wherein the decoding additional data may refer to data required for decoding. For example, taking H264 encoded video Sequence as an example, the decoding extra data may be a Sequence Parameter Set (SPS) and a Picture Parameter Set (PPS).
Step S305, initializing the encoder reversely according to the decoded extra data.
In the embodiment of the application, the decoding extra data is analyzed, and the encoder which is the same as the video file to be edited is reversely initialized, so that the purpose of keeping the same decoding extra data as the source video file is achieved.
And step S306, performing lossy coding on the video frame in the lossy time period by using the encoder after the reverse initialization to obtain a lossy video frame.
Step S307, performing lossless coding on the video frame in the lossless time period to obtain a lossless video frame.
The step is the same as step S105, and reference may be made to the related description of step S105, which is not repeated herein.
And step S308, synthesizing the lossy video frame and the lossless video frame, and outputting the synthesized lossy video frame and the lossless video frame to a specified file.
The step is the same as step S106, and reference may be made to the related description of step S106, which is not repeated herein.
On the basis of the first implementation, the decoding extra data is extracted from the video file to be edited, and the encoder which is the same as the video file to be edited is initialized reversely according to the decoding extra data, so that the purpose of keeping the same decoding extra data as the source video file can be achieved.
Fig. 4 is a schematic diagram of a video encoding apparatus provided in the third embodiment of the present application, and only the relevant portions of the third embodiment of the present application are shown for convenience of description.
The video encoding device includes:
the file obtaining module 40 is used for obtaining a video file to be edited;
a list obtaining module 41, configured to obtain a display time stamp PTS list of all instantaneous decoding refresh IDR frames in the video file to be edited;
a time obtaining module 42, configured to obtain a lossy time period and a lossless time period of the video clip according to PTS lists of all IDR frames in the video file to be edited and start PTS and end PTS of the video clip, where the video clip refers to a video segment that is reserved after the video file to be edited is clipped;
a lossy coding module 43, configured to perform lossy coding on the video frame in the lossy time period to obtain a lossy video frame;
a lossless encoding module 44, configured to perform lossless encoding on the video frame within the lossless time period to obtain a lossless video frame;
and a video composition file 45 for composing the lossy video frame and the lossless video frame and outputting the composed video frame and the lossless video frame to a designated file.
Optionally, the time obtaining module 42 includes:
an obtaining unit, configured to obtain IDR frames in a video clip and a start PTS and an end PTS of the IDR frame according to PTS lists of all IDR frames in the video file to be edited and start PTS and end PTS of the video clip, where the video clip at least includes two IDR frames;
and the selecting unit is used for selecting a time period between a start point PTS of the video shearing section and a PTS of a first IDR frame in the video shearing section, and a time period between a PTS of a last IDR frame in the video shearing section and an end point PTS of the video shearing section as a loss time period of the video shearing section, and a time period between the PTS of the first IDR frame in the video shearing section and the PTS of the last IDR frame in the video shearing section as a lossless time period of the video shearing section.
Optionally, the video encoding apparatus further includes:
and a video decoding module 46, configured to decode the video frame within the lossy time period from the video file to be edited.
Optionally, the video encoding apparatus further includes:
and the video separation module 47 is configured to separate the video frames in the lossless time period from the video file to be edited.
Optionally, the video encoding apparatus further includes:
a data extraction module 48, configured to extract decoded extra data from the video file to be edited;
an initialization module 49 for initializing the encoder inversely according to the decoded extra data;
accordingly, the lossy coding module 43 is specifically configured to:
and performing lossy encoding on the video frame in the lossy time period by using the encoder after the reverse initialization.
The video encoding device provided in the embodiment of the present application can be applied to the first method embodiment and the second method embodiment, and for details, reference is made to the description of the first method embodiment and the second method embodiment, and details are not repeated here.
Fig. 5 is a schematic diagram of a terminal device according to a fourth embodiment of the present application. As shown in fig. 5, the terminal device 5 of this embodiment includes: a processor 50, a memory 51 and a computer program 52 stored in said memory 51 and executable on said processor 50. The processor 50, when executing the computer program 52, implements the steps in the various video encoding method embodiments described above, such as the steps S101 to S106 shown in fig. 1. Alternatively, the processor 50, when executing the computer program 52, implements the functions of the modules/units in the above-mentioned device embodiments, such as the functions of the modules 40 to 49 shown in fig. 4.
Illustratively, the computer program 52 may be partitioned into one or more modules/units, which are stored in the memory 51 and executed by the processor 50 to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 52 in the terminal device 5. For example, the computer program 52 may be divided into a file obtaining module, a list obtaining module, a time obtaining module, a lossy coding module, a lossless coding module, a video composition file, a video decoding module, a video separating module, a data extracting module, and an initializing module, and each module has the following specific functions:
the file acquisition module is used for acquiring a video file to be edited;
the list acquisition module is used for acquiring display time stamp PTS lists of all instantaneous decoding refreshing IDR frames in the video file to be edited;
the time acquisition module is used for acquiring a lossy time period and a lossless time period of the video cutting segment according to PTS lists of all IDR frames in the video file to be edited and a start PTS and an end PTS of the video cutting segment, wherein the video cutting segment refers to a video segment reserved after cutting the video file to be edited;
a lossy coding module, configured to perform lossy coding on the video frame in the lossy time period to obtain a lossy video frame;
a lossless encoding module, configured to perform lossless encoding on the video frame within the lossless time period to obtain a lossless video frame;
and the video synthesis file is used for synthesizing the lossy video frame and the lossless video frame and outputting the synthesized video frame and the lossless video frame to a specified file.
Optionally, the time obtaining module includes:
an obtaining unit, configured to obtain IDR frames in a video clip and a start PTS and an end PTS of the IDR frame according to PTS lists of all IDR frames in the video file to be edited and start PTS and end PTS of the video clip, where the video clip at least includes two IDR frames;
and the selecting unit is used for selecting a time period between a start point PTS of the video shearing section and a PTS of a first IDR frame in the video shearing section, and a time period between a PTS of a last IDR frame in the video shearing section and an end point PTS of the video shearing section as a loss time period of the video shearing section, and a time period between the PTS of the first IDR frame in the video shearing section and the PTS of the last IDR frame in the video shearing section as a lossless time period of the video shearing section.
Optionally, the video decoding module is configured to decode a video frame within the lossy time period from the video file to be edited.
Optionally, the video separation module is configured to separate the video frame within the lossless time period from the video file to be edited.
Optionally, the data extracting module is configured to extract decoded extra data from the video file to be edited;
an initialization module for initializing an encoder in reverse direction according to the decoded extra data;
correspondingly, the lossy coding module is specifically configured to:
and performing lossy encoding on the video frame in the lossy time period by using the encoder after the reverse initialization.
The terminal device 5 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device may include, but is not limited to, a processor 50, a memory 51. Those skilled in the art will appreciate that fig. 5 is merely an example of a terminal device 5 and does not constitute a limitation of terminal device 5 and may include more or fewer components than shown, or some components may be combined, or different components, e.g., the terminal device may also include input-output devices, network access devices, buses, etc.
The processor 50 may be a central processing unit CPU, but may also be other general purpose processors, digital signal processors DSP, application specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 51 may be an internal storage unit of the terminal device 5, such as a hard disk or a memory of the terminal device 5. The memory 51 may also be an external storage device of the terminal device 5, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 5. Further, the memory 51 may also include both an internal storage unit and an external storage device of the terminal device 5. The memory 51 is used for storing the computer program and other programs and data required by the terminal device. The memory 51 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A video encoding method, the video encoding method comprising:
acquiring a video file to be edited;
obtaining a display time stamp PTS list of all instantaneous decoding refreshing IDR frames in the video file to be edited;
obtaining a lossy time period and a lossless time period of the video cutting segment according to PTS lists of all IDR frames in the video file to be edited and a start PTS and an end PTS of the video cutting segment, wherein the video cutting segment refers to a video segment reserved after the video file to be edited is cut;
lossy coding is carried out on the video frame in the lossy time period so as to obtain a lossy video frame;
lossless coding is carried out on the video frames in the lossless time period so as to obtain lossless video frames;
and synthesizing the damaged video frame and the lossless video frame, and outputting the synthesized video frame and the lossless video frame to a specified file.
2. The video encoding method of claim 1, wherein the obtaining the lossy time segment and the lossless time segment of the video clip according to the PTS list of all IDR frames in the video file to be edited and the start PTS and the end PTS of the video clip comprises:
obtaining IDR frames in the video clipping segment and PTS of the IDR frames according to PTS lists of all IDR frames in the video file to be edited and start PTS and end PTS of the video clipping segment, wherein the video clipping segment at least comprises two IDR frames;
selecting a time period between a start PTS of the video shearing section and a PTS of a first IDR frame in the video shearing section, and a time period between a PTS of a last IDR frame in the video shearing section and an end PTS of the video shearing section as a loss time period of the video shearing section, wherein a time period between the PTS of the first IDR frame in the video shearing section and the PTS of the last IDR frame in the video shearing section is a lossless time period of the video shearing section.
3. The video encoding method of claim 1, wherein prior to lossy encoding the video frames in the lossy time period, further comprising:
and decoding the video frames in the lossy time period from the video file to be edited.
4. The video encoding method of claim 1, wherein prior to losslessly encoding the video frame within the lossless time period, further comprising:
and separating the video frames in the lossless time period from the video file to be edited.
5. The video encoding method of any of claims 1 to 4, wherein prior to lossy encoding the video frames within the lossy time period, further comprising:
extracting decoding extra data from the video file to be edited;
initializing an encoder in reverse direction according to the decoded extra data;
correspondingly, the lossy encoding the video frame in the lossy time period includes:
and performing lossy encoding on the video frame in the lossy time period by using the encoder after the reverse initialization.
6. A video encoding apparatus, characterized in that the video encoding apparatus comprises:
the file acquisition module is used for acquiring a video file to be edited;
the list acquisition module is used for acquiring display time stamp PTS lists of all instantaneous decoding refreshing IDR frames in the video file to be edited;
the time acquisition module is used for acquiring a lossy time period and a lossless time period of the video cutting segment according to PTS lists of all IDR frames in the video file to be edited and a start PTS and an end PTS of the video cutting segment, wherein the video cutting segment refers to a video segment reserved after cutting the video file to be edited;
a lossy coding module, configured to perform lossy coding on the video frame in the lossy time period to obtain a lossy video frame;
a lossless encoding module, configured to perform lossless encoding on the video frame within the lossless time period to obtain a lossless video frame;
and the video synthesis file is used for synthesizing the lossy video frame and the lossless video frame and outputting the synthesized video frame and the lossless video frame to a specified file.
7. The video encoding apparatus of claim 6, wherein the time acquisition module comprises:
an obtaining unit, configured to obtain IDR frames in a video clip and a start PTS and an end PTS of the IDR frame according to PTS lists of all IDR frames in the video file to be edited and start PTS and end PTS of the video clip, where the video clip at least includes two IDR frames;
and the selecting unit is used for selecting a time period between a start point PTS of the video shearing section and a PTS of a first IDR frame in the video shearing section, and a time period between a PTS of a last IDR frame in the video shearing section and an end point PTS of the video shearing section as a loss time period of the video shearing section, and a time period between the PTS of the first IDR frame in the video shearing section and the PTS of the last IDR frame in the video shearing section as a lossless time period of the video shearing section.
8. The video encoding apparatus of claim 6 or 7, wherein the video encoding apparatus further comprises:
the data extraction module is used for extracting decoding extra data from the video file to be edited;
an initialization module for initializing an encoder in reverse direction according to the decoded extra data;
correspondingly, the lossy coding module is specifically configured to:
and performing lossy encoding on the video frame in the lossy time period by using the encoder after the reverse initialization.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the video encoding method according to any one of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the video encoding method according to one of claims 1 to 5.
CN201811414972.XA 2018-11-26 2018-11-26 Video coding method, video coding device and terminal equipment Active CN111225210B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811414972.XA CN111225210B (en) 2018-11-26 2018-11-26 Video coding method, video coding device and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811414972.XA CN111225210B (en) 2018-11-26 2018-11-26 Video coding method, video coding device and terminal equipment

Publications (2)

Publication Number Publication Date
CN111225210A CN111225210A (en) 2020-06-02
CN111225210B true CN111225210B (en) 2022-04-01

Family

ID=70828627

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811414972.XA Active CN111225210B (en) 2018-11-26 2018-11-26 Video coding method, video coding device and terminal equipment

Country Status (1)

Country Link
CN (1) CN111225210B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2533537A1 (en) * 2011-06-10 2012-12-12 Panasonic Corporation Transmission of picture size for image or video coding
CN103686182A (en) * 2013-12-13 2014-03-26 洪雪荣 Method and system for coding screen display information
CN107318020A (en) * 2017-06-22 2017-11-03 长沙市极云网络科技有限公司 The data processing method and system remotely shown

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013028565A1 (en) * 2011-08-19 2013-02-28 General Instrument Corporation Encoder-aided segmentation for adaptive streaming
US9369732B2 (en) * 2012-10-08 2016-06-14 Google Inc. Lossless intra-prediction video coding
US9503744B2 (en) * 2013-01-22 2016-11-22 Vixs Systems, Inc. Video processor with random access to compressed frame buffer and methods for use therewith

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2533537A1 (en) * 2011-06-10 2012-12-12 Panasonic Corporation Transmission of picture size for image or video coding
CN103686182A (en) * 2013-12-13 2014-03-26 洪雪荣 Method and system for coding screen display information
CN107318020A (en) * 2017-06-22 2017-11-03 长沙市极云网络科技有限公司 The data processing method and system remotely shown

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于HEVC帧内无损编码的技术研究;王晓虹;《中国优秀硕士学位论文全文数据库 信息科技辑》;20170215;全文 *

Also Published As

Publication number Publication date
CN111225210A (en) 2020-06-02

Similar Documents

Publication Publication Date Title
US10194150B2 (en) Method and device for coding image, and method and device for decoding image
CN108063976B (en) Video processing method and device
US20170163992A1 (en) Video compressing and playing method and device
US10298931B2 (en) Coupling sample metadata with media samples
CN102364945B (en) Multi-picture image decoding display method and video monitoring terminal
MX2013007730A (en) Video encoding apparatus, video decoding apparatus, video encoding method, and video decoding method.
CN113473126B (en) Video stream processing method and device, electronic equipment and computer readable medium
US20180227595A1 (en) Compressor
CN111343503A (en) Video transcoding method and device, electronic equipment and storage medium
US11051080B2 (en) Method for improving video resolution and video quality, encoder, and decoder
KR101551915B1 (en) Device and method for video compression
CN110769241B (en) Video frame processing method and device, user side and storage medium
US20180302636A1 (en) Method of mixing video bitstreams and apparatus performing the method
US11323701B2 (en) Systems and methods for group of pictures encoding
CN110582021B (en) Information processing method and device, electronic equipment and storage medium
CN111225210B (en) Video coding method, video coding device and terminal equipment
WO2020071101A1 (en) Image processing device and method
CN110944197B (en) Method and device for coding images and audios
US20170201759A1 (en) Method and device for image encoding and image decoding
JP2017192080A (en) Image compression device, image decoding device, image compression method, and image compression program
CN116668691A (en) Picture compression transmission method and device and terminal equipment
GB2548578A (en) Video data processing system
CN114079823A (en) Video rendering method, device, equipment and medium based on Flutter
US8559794B2 (en) System and method for recording collaborative information
WO2021057676A1 (en) Video coding method and apparatus, video decoding method and apparatus, electronic device and readable storage medium

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