CN111586413A - Video adjusting method and device, computer equipment and storage medium - Google Patents

Video adjusting method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN111586413A
CN111586413A CN202010507974.4A CN202010507974A CN111586413A CN 111586413 A CN111586413 A CN 111586413A CN 202010507974 A CN202010507974 A CN 202010507974A CN 111586413 A CN111586413 A CN 111586413A
Authority
CN
China
Prior art keywords
video data
parameter
value
quality parameter
roi
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.)
Granted
Application number
CN202010507974.4A
Other languages
Chinese (zh)
Other versions
CN111586413B (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.)
Guangzhou Fanxing Huyu IT Co Ltd
Original Assignee
Guangzhou Fanxing Huyu IT 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 Guangzhou Fanxing Huyu IT Co Ltd filed Critical Guangzhou Fanxing Huyu IT Co Ltd
Priority to CN202010507974.4A priority Critical patent/CN111586413B/en
Publication of CN111586413A publication Critical patent/CN111586413A/en
Application granted granted Critical
Publication of CN111586413B publication Critical patent/CN111586413B/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/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/167Position within a video image, e.g. region of interest [ROI]
    • 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/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • 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/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/154Measured or subjectively estimated visual quality after decoding, e.g. measurement of distortion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2187Live feed
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • H04N21/234381Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements by altering the temporal resolution, e.g. decreasing the frame rate by frame skipping
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/25Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
    • H04N21/266Channel or content management, e.g. generation and management of keys and entitlement messages in a conditional access system, merging a VOD unicast channel into a multicast channel
    • H04N21/2662Controlling the complexity of the video stream, e.g. by scaling the resolution or bitrate of the video stream based on the client capabilities

Abstract

The application discloses a video adjusting method, a video adjusting device, computer equipment and a storage medium, and belongs to the technical field of video processing. The method comprises the following steps: the first video data is encoded by adopting a first ROI QP value and then decoded to obtain second video data; acquiring a first quality parameter of second video data and a second quality parameter of a target area in the second video data according to the first video data and the second video data; and if the second video data meets the first adjustment condition, adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value, so that the ROI QP value is adaptively adjusted according to the quality of the video data, the accuracy of the code rate distributed in the video data can be ensured when the code rate in the video data is determined according to the adjusted ROI QP value, and the image quality of the video data is improved.

Description

Video adjusting method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of video processing technologies, and in particular, to a video adjustment method and apparatus, a computer device, and a storage medium.
Background
With the rapid development Of video processing technology and the increasing requirements Of people on video playing effect, ROI (Region Of Interest) technology is usually adopted to distinguish a target Region from a non-target Region in video data, and different code rates are adopted to encode the target Region and the non-target Region respectively.
In the related art, when video data is encoded by using an ROI technique, an initial code rate is set, a target region and a non-target region of each video data in the video data are obtained, a fixed ROI QP (Quantization Parameter) value is set for the target region, so as to determine a code rate corresponding to the target region and a code rate corresponding to the non-target region according to the initial code rate and the ROI QP value, and then the code rate corresponding to the target region and the code rate corresponding to the non-target region are respectively used to encode the target region and the non-target region.
However, the sizes of target regions in different video data may be different, and only the video data is encoded by using a fixed ROI QP value, which may cause inaccurate code rate for video data allocation and reduce image quality of the video data.
Disclosure of Invention
The embodiment of the application provides a video adjusting method, a video adjusting device, computer equipment and a storage medium, which can adaptively adjust a ROI QP value, so that when a code rate in video data is determined according to the adjusted ROI QP value, the accuracy of the code rate distributed in the video data can be ensured, and the image quality of the video data is further improved. The technical scheme is as follows:
in a first aspect, a video adjusting method is provided, where the method includes:
the first video data is encoded by adopting a first ROI QP value and then decoded to obtain second video data;
acquiring a first quality parameter of the second video data and a second quality parameter of a target area in the second video data according to the first video data and the second video data;
and if the second video data meets a first adjusting condition, adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value, wherein the first adjusting condition comprises that the first quality parameter is greater than a first preset parameter and less than a second preset parameter, or the second quality parameter is greater than a third preset parameter, or the second quality parameter is less than at least one of fourth preset parameters, the first preset parameter is less than the second preset parameter, and the third preset parameter is greater than the fourth preset parameter.
Optionally, the adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value includes:
and when the first quality parameter is greater than the first preset parameter and less than the second preset parameter, and the second quality parameter is greater than the third preset parameter, increasing the first ROI QP value according to a first adjustment value to obtain the second ROI QP value.
Optionally, after the adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value, the method further includes:
according to the second ROI QP value, encoding and then decoding third video data behind the first video data to obtain fourth video data;
and acquiring a third quality parameter of the fourth video data and a fourth quality parameter of a target area in the fourth video data according to the third video data and the fourth video data.
Optionally, after the first quality parameter is greater than the first preset parameter and less than a fifth preset parameter, the second quality parameter is greater than the third preset parameter, and the third quality parameter of the fourth video data and the fourth quality parameter of the target area in the fourth video data are obtained, the method further includes:
if the fourth video data meets a second adjustment condition, continuing to increase the second ROI QP value according to the first adjustment value, wherein the second adjustment condition comprises that the third quality parameter is greater than the fourth quality parameter or the fourth quality parameter is greater than the third preset parameter;
the fifth preset parameter is smaller than the second preset parameter.
Optionally, after the first quality parameter is not less than the fifth preset parameter and less than the second preset parameter, and the second quality parameter is greater than the third preset parameter, and the third quality parameter of the fourth video data and the fourth quality parameter of the target area in the fourth video data are obtained, the method further includes:
if the fourth video data meets a third adjustment condition, continuing to increase the second ROI QP value according to the first adjustment value, wherein the third adjustment condition comprises that the fourth quality parameter is not less than a sixth preset parameter, the third quality parameter is greater than the fifth preset parameter, and the third quality parameter is less than the fourth quality parameter; the sixth preset parameter is smaller than the third preset parameter, or,
and if the fourth video data meets a fourth adjustment condition, reducing the second ROIQP value according to a second adjustment value, wherein the fourth adjustment condition comprises that the fourth quality parameter is smaller than the sixth preset parameter and the third quality parameter is larger than the fifth preset parameter, or the third quality parameter is not smaller than the fourth quality parameter, or the fourth quality parameter is not smaller than the sixth preset parameter and the third quality parameter is not larger than the fifth preset parameter.
Optionally, the adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value includes:
and when the first quality parameter is greater than the first preset parameter and less than the second preset parameter, and the second quality parameter is less than the fourth preset parameter, reducing the first ROI value according to a first adjustment value to obtain a second ROI QP value.
Optionally, after the first ROI QP value is adjusted according to the first quality parameter and the second quality parameter, and an adjusted second ROI QP value is obtained, the method further includes:
according to the second ROI QP value, encoding and then decoding third video data behind the first video data to obtain fourth video data;
and acquiring a third quality parameter of the fourth video data and a fourth quality parameter of a target area of the fourth video data according to the third video data and the fourth video data.
Optionally, after the first quality parameter is greater than the first preset parameter and less than a fifth preset parameter, and the second quality parameter is less than the fourth preset parameter, and the third quality parameter of the fourth video data and the fourth quality parameter of the target area in the fourth video data are obtained, the method further includes:
if the fourth video data meets a fifth adjustment condition, continuing to reduce the second ROI QP value according to the first adjustment value, wherein the fifth adjustment condition comprises that the third quality parameter is not less than a seventh preset parameter, the fourth quality parameter is less than the fourth preset parameter and is greater than the third quality parameter, and the seventh preset parameter is less than the first preset parameter; alternatively, the first and second electrodes may be,
and if the fourth video data meets a sixth adjustment condition, increasing the second ROIQP value according to a second adjustment value, wherein the sixth adjustment condition comprises that the third quality parameter is smaller than the seventh preset parameter, the fourth quality parameter is not smaller than the fourth preset parameter and is larger than the third quality parameter, and the second adjustment value is smaller than the first adjustment value.
Optionally, after the first quality parameter is not less than the fifth preset parameter and less than the second preset parameter, and the second quality parameter is less than the fourth preset parameter, and the third quality parameter of the fourth video data and the fourth quality parameter of the target area in the fourth video data are obtained, the method further includes:
if the fourth video data meets a seventh adjustment condition, continuing to reduce the second ROI QP value according to the first adjustment value, wherein the seventh adjustment condition comprises that the third quality parameter is greater than an eighth preset parameter and the fourth quality parameter is less than the fourth preset parameter; alternatively, the first and second electrodes may be,
and if the fourth video data meets an eighth adjustment condition, increasing the second ROIQP value according to a second adjustment value, wherein the eighth adjustment condition includes that the third quality parameter is not greater than an eighth preset parameter and the fourth quality parameter is not less than the fourth preset parameter, the first adjustment value is greater than the second adjustment value, and the eighth preset parameter is less than the fifth preset parameter.
Optionally, the method further comprises:
acquiring a weighting coefficient of the ROI QP value, an intensity coefficient of the ROI QP value, the width of video data, the length of the video data, the width of the target area and the length of the target area;
determining the ROI QP value according to the weighting coefficient of the ROI QP value, the intensity coefficient of the ROI QP value, the width of the video data, the length of the video data, the width of the target area and the length of the target area; the ROI QP value is inversely proportional to an intensity coefficient of the ROI QP value;
the adjusting the ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted ROI QP value comprises the following steps:
and adjusting the intensity coefficient of the ROI QP value according to the first quality parameter and the second quality parameter, and determining the adjusted ROI QP value according to the intensity coefficient of the adjusted ROI QP value.
Optionally, the determining the ROI QP value according to the weighting coefficient of the ROI QP value, the intensity coefficient of the ROI QP value, the width of the video data, the length of the video data, the width of the target region, and the length of the target region includes:
determining the ROI QP value using the following formula:
Figure BDA0002527225680000041
wherein α represents a weighting coefficient of the ROI QP value, β represents an intensity coefficient of the ROI QP value, video represents a width of the video data, video represents a length of the video data, roiW represents a width of the target region, and roiH represents a length of the target region.
Optionally, if the second video data meets a first adjustment condition, adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value, including:
and if the second video data meet a first adjusting condition, calling a parameter adjusting model, and adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value.
Optionally, the method further comprises:
obtaining a first sample quality parameter, a second sample quality parameter and a sample ROI QP value of sample video data; the first sample quality parameter is a quality parameter of any sample video data in the sample video data, the second sample quality parameter is a quality parameter of a target area in the sample video data, and the sample ROI QP value is an ROI QP value adopted when the sample video data is coded;
and training the parameter adjustment model according to the first sample intrinsic quantity parameter, the second sample quality parameter and the sample ROI QP value to obtain a trained parameter adjustment model.
Optionally, the obtaining the first sample quality parameter, the second sample quality parameter, and the sample ROI QP value of the sample video data includes:
obtaining a first sample intrinsic quality parameter, a second sample quality parameter and a sample ROI QP value of the sample video data, as well as a code rate adopted by the sample video data, a pixel value of an outline area of the sample video data and a motion vector between the sample video data and previous video data;
the training the parameter adjustment model according to the first sample intrinsic quality parameter, the second sample quality parameter and the sample ROI QP value to obtain a trained parameter adjustment model, comprising:
and training the parameter adjustment model according to the first sample intrinsic quality parameter, the second sample quality parameter, the sample ROI QP value, the code rate adopted by the sample video data, the pixel value of the outline area of the sample video data and the motion vector between the sample video data and the previous video data to obtain a trained quality parameter model.
Optionally, the obtaining pixel values of the contour region of the sample video data includes:
extracting a contour region in the sample video data by adopting an edge contour extraction algorithm;
and acquiring the average value of the pixel values of a plurality of pixel points in the contour region, and determining the average value as the pixel value of the contour region.
Optionally, the obtaining a motion vector between the sample video data and previous video data includes:
acquiring a first motion intensity of the sample video data and a second motion intensity of a previous video data of the sample video data;
and acquiring a motion vector between the sample video data and the previous video data according to the first motion intensity and the second motion intensity.
Optionally, the obtaining the first motion intensity of the sample video data includes:
determining a position vector of each pixel block in a plurality of pixel blocks according to the position of each pixel block in the sample video data;
determining a sum of squares of the position vectors of each of the pixel blocks as the first motion strength.
In a second aspect, there is provided a video adjusting apparatus, the apparatus comprising:
the coding and decoding module is used for coding the first video data by adopting a first ROI QP value and then decoding the first video data to obtain second video data;
the quality acquisition module is used for acquiring a first quality parameter of the second video data and a second quality parameter of a target area in the second video data according to the first video data and the second video data;
and the adjusting module is used for adjusting the first ROI QP value according to the first quality parameter and the second quality parameter when the second video data meets a first adjusting condition to obtain an adjusted second ROI QP value, wherein the first adjusting condition comprises that the first quality parameter is greater than a first preset parameter and less than a second preset parameter, or the second quality parameter is greater than a third preset parameter, or the second quality parameter is less than at least one of fourth preset parameters, the first preset parameter is less than the second preset parameter, and the third preset parameter is greater than the fourth preset parameter.
Optionally, the adjusting module includes:
and the improving unit is used for improving the first ROI QP value according to a first adjusting value to obtain a second ROI QP value when the first quality parameter is greater than the first preset parameter and less than the second preset parameter and the second quality parameter is greater than the third preset parameter.
Optionally, the encoding and decoding module is configured to encode and decode third video data after the first video data according to the second ROI QP value to obtain fourth video data;
the quality obtaining module is configured to obtain a third quality parameter of the fourth video data and a fourth quality parameter of a target area in the fourth video data according to the third video data and the fourth video data.
Optionally, the first quality parameter is greater than the first preset parameter and less than a fifth preset parameter, the second quality parameter is greater than the third preset parameter, and the increasing unit is configured to:
if the fourth video data meets a second adjustment condition, continuing to increase the second ROI QP value according to the first adjustment value, wherein the second adjustment condition comprises that the third quality parameter is greater than the fourth quality parameter or the fourth quality parameter is greater than the third preset parameter;
the fifth preset parameter is smaller than the second preset parameter.
Optionally, the first quality parameter is not less than the fifth preset parameter and less than the second preset parameter, and the second quality parameter is greater than the third preset parameter:
the increasing unit is configured to continue to increase the second ROI QP value according to the first adjustment value if the fourth video data meets a third adjustment condition, where the third adjustment condition includes that the fourth quality parameter is not less than a sixth preset parameter, the third quality parameter is greater than a fifth preset parameter, and the third quality parameter is less than the fourth quality parameter; the sixth preset parameter is smaller than the third preset parameter, or,
the adjustment module further comprises: a lowering unit;
the reducing unit is configured to reduce the second ROI QP value according to a second adjustment value if the fourth video data satisfies a fourth adjustment condition, where the fourth adjustment condition includes that the fourth quality parameter is smaller than the sixth preset parameter and the third quality parameter is greater than the fifth preset parameter, or the third quality parameter is not smaller than the fourth quality parameter, or the fourth quality parameter is not smaller than the sixth preset parameter and the third quality parameter is not greater than the fifth preset parameter.
Optionally, the adjusting module includes:
and the reducing unit is used for reducing the first ROI value according to a first adjusting value to obtain a second ROI QP value when the first quality parameter is larger than the first preset parameter and smaller than the second preset parameter and the second quality parameter is smaller than the fourth preset parameter.
Optionally, the encoding and decoding module is configured to encode and decode third video data after the first video data according to the second ROI QP value to obtain fourth video data;
the quality obtaining module is configured to obtain a third quality parameter of the fourth video data and a fourth quality parameter of a target area of the fourth video data according to the third video data and the fourth video data.
Optionally, the first quality parameter is greater than the first preset parameter and less than a fifth preset parameter, the second quality parameter is less than the fourth preset parameter,
the reducing unit is configured to continue to reduce the second ROI QP value according to the first adjustment value if the fourth video data meets a fifth adjustment condition, where the fifth adjustment condition includes that the third quality parameter is not less than a seventh preset parameter, the fourth quality parameter is less than the fourth preset parameter and greater than the third quality parameter, and the seventh preset parameter is less than the first preset parameter; alternatively, the first and second electrodes may be,
the adjusting module further comprises: an increasing unit;
the increasing unit is configured to increase the second ROI QP value according to a second adjustment value if the fourth video data meets a sixth adjustment condition, where the sixth adjustment condition includes that the third quality parameter is smaller than the seventh preset parameter, the fourth quality parameter is not smaller than the fourth preset parameter and is larger than the third quality parameter, and the second adjustment value is smaller than the first adjustment value.
Optionally, the first quality parameter is not less than the fifth preset parameter and less than the second preset parameter, the second quality parameter is less than the fourth preset parameter,
the reducing unit is configured to continue to reduce the second ROI QP value according to the first adjustment value if the fourth video data meets a seventh adjustment condition, where the seventh adjustment condition includes that the third quality parameter is greater than an eighth preset parameter and the fourth quality parameter is less than the fourth preset parameter; alternatively, the first and second electrodes may be,
the adjusting module further comprises: an increasing unit;
the increasing unit is configured to increase the second ROI QP value according to a second adjustment value if the fourth video data meets an eighth adjustment condition, where the eighth adjustment condition includes that the third quality parameter is not greater than the eighth preset parameter and the fourth quality parameter is not less than the fourth preset parameter, the first adjustment value is greater than the second adjustment value, and the eighth preset parameter is less than the fifth preset parameter.
Optionally, the apparatus further comprises:
the parameter acquisition module is used for acquiring a weighting coefficient of the ROI QP value, an intensity coefficient of the ROI QP value, the width of the video data, the length of the video data, the width of the target area and the length of the target area;
a numerical value determination module for determining the ROI QP value according to a weighting coefficient of the ROI QP value, an intensity coefficient of the ROI QP value, a width of the video data, a length of the video data, a width of the target region and a length of the target region; the ROI QP value is inversely proportional to an intensity coefficient of the ROI QP value;
and the adjusting module is used for adjusting the intensity coefficient of the ROI QP value according to the first quality parameter and the second quality parameter, and determining the adjusted ROI QP value according to the adjusted intensity coefficient of the ROI QP value.
Optionally, the numerical value determining module is configured to:
determining the ROI QP value using the following formula:
Figure BDA0002527225680000091
wherein α represents a weighting coefficient of the ROI QP value, β represents an intensity coefficient of the ROI QP value, video represents a width of the video data, video represents a length of the video data, roiW represents a width of the target region, and roiH represents a length of the target region.
Optionally, the adjusting module is further configured to, if the second video data meets a first adjusting condition, invoke a parameter adjusting model, and adjust the first ROI QP value according to the first quality parameter and the second quality parameter, to obtain an adjusted second ROI QP value.
Optionally, the apparatus further comprises:
the sample acquisition module is used for acquiring a first sample quality parameter, a second sample quality parameter and a sample ROI QP value of the sample video data; the first sample quality parameter is a quality parameter of any sample video data in the sample video data, the second sample quality parameter is a quality parameter of a target region in the sample video data, and the sample ROIQP value is an ROI QP value adopted when the sample video data is coded;
and the training module is used for training the parameter adjustment model according to the first sample intrinsic quantity parameter, the second sample quality parameter and the sample ROI QP value to obtain the trained parameter adjustment model.
Optionally, the sample acquisition module is used for
Obtaining a first sample intrinsic quality parameter, a second sample quality parameter and a sample ROI QP value of the sample video data, as well as a code rate adopted by the sample video data, a pixel value of an outline area of the sample video data and a motion vector between the sample video data and previous video data;
the training module is used for training the parameter adjustment model according to the first sample intrinsic quantity parameter, the second sample quality parameter, the sample ROI QP value, the code rate adopted by the sample video data, the pixel value of the outline area of the sample video data and the motion vector between the sample video data and the previous video data to obtain a trained quality parameter model.
Optionally, the sample acquiring module is configured to:
extracting a contour region in the sample video data by adopting an edge contour extraction algorithm;
and acquiring the average value of the pixel values of a plurality of pixel points in the contour region, and determining the average value as the pixel value of the contour region.
Optionally, the sample acquiring module is configured to:
acquiring a first motion intensity of the sample video data and a second motion intensity of a previous video data of the sample video data;
and acquiring a motion vector between the sample video data and the previous video data according to the first motion intensity and the second motion intensity.
Optionally, the sample acquiring module is configured to:
determining a position vector of each pixel block in a plurality of pixel blocks according to the position of each pixel block in the sample video data;
determining a sum of squares of the position vectors of each of the pixel blocks as the first motion strength.
In a third aspect, a computer device is provided, and the computer device includes a processor and a memory, where the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the operations performed in the video adjustment method according to the first aspect.
In a fourth aspect, a computer-readable storage medium is provided, in which at least one instruction is stored, and the at least one instruction is loaded and executed by a processor to implement the operations performed in the video adjusting method according to the first aspect.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
according to the method, the device, the computer equipment and the storage medium provided by the embodiment of the application, the first video data is coded by adopting the first ROI QP value and then decoded to obtain the second video data, the first quality parameter of the second video data and the second quality parameter of the target region in the second video data are obtained, the second video data meet the first adjustment condition, and the first ROI QP value is not in accordance with the quality requirement of video coding, the first ROI QP value is adjusted according to the first quality parameter and the second quality parameter to obtain the adjusted second ROI QP value, so that the ROI QP value is adaptively adjusted according to the quality of the video data, the accuracy of the code rate distributed by the video data can be ensured when the code rate in the video data is determined according to the adjusted ROI QP value, and the image quality of the video data is further improved.
In addition, the method provided by the embodiment of the application can also continue to encode according to the adjusted second ROI QP value, and subsequently, can continue to adjust the second ROI QP value according to the quality parameter of the video data and the quality parameter of the target region in the video data, so that when the code rate in the video data is determined according to the adjusted ROI QP value, the accuracy of the code rate allocated in the video data can continue to be improved, and further, the image quality of the video data continues to be improved.
And the parameter adjusting model is called, the adjusted second ROI QP value can be determined according to the first quality parameter and the second quality parameter of the second video data, automatic adjustment of the ROI QP value is realized, and the parameter adjusting model has the capability of adjusting the ROI QP value, so that the obtained second ROI QP value can meet the coding requirement, the accuracy of the ROI QP value is improved, and the image quality of the video data is improved.
In addition, when the parameter adjustment model is trained, the accuracy of the trained parameter adjustment model can be improved by adopting the first quality parameter and the second quality parameter of the sample video data, the pixel value of the outline region of the sample video data and the motion vector between the sample video data and the previous video data, and the accuracy of calling the parameter adjustment model to determine the adjusted ROI QP value is further improved.
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 description of the embodiments are briefly introduced 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 creative efforts.
Fig. 1 is a flowchart of a video adjusting method according to an embodiment of the present application;
fig. 2 is a flowchart of a video adjustment method according to an embodiment of the present application;
FIG. 3 is a diagram illustrating a parameter relationship provided in an embodiment of the present application;
FIG. 4 is a schematic diagram of another parameter relationship provided by embodiments of the present application;
FIG. 5 is a schematic diagram of another parameter relationship provided by embodiments of the present application;
FIG. 6 is a schematic diagram of another parameter relationship provided by embodiments of the present application;
FIG. 7 is a schematic diagram of another parameter relationship provided by embodiments of the present application;
FIG. 8 is a schematic diagram of another parameter relationship provided by embodiments of the present application;
fig. 9 is a flowchart of a video adjustment method according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a video adjusting apparatus according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of another video adjusting apparatus according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of a terminal according to an embodiment of the present application;
fig. 13 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present application more clear, the embodiments of the present application will be further described in detail with reference to the accompanying drawings.
It will be understood that the terms "first," "second," and the like as used herein may be used herein to describe various concepts, which are not limited by these terms unless otherwise specified. These terms are only used to distinguish one concept from another.
The method provided by the embodiment of the application can be applied to a live broadcast scene, when a live broadcast terminal carries out live broadcast, the live broadcast video data is coded by adopting the first ROI QP value, then when the live broadcast video data coded by adopting the first ROI QP value meets the regulation condition, the first ROI QP value is regulated to obtain the regulated second ROI QP value, and the live broadcast video data is coded according to the second ROI QP value.
In addition, the method provided by the embodiment of the application is applied to a terminal, and the terminal can be a mobile phone, a computer or a tablet computer.
In a possible implementation manner, the terminal includes a first process and a second process, and based on the first process, the terminal obtains second video data after encoding and decoding first video data according to a first ROI QP value, and sends the first video data and the second video data to the second process.
And based on a second process, acquiring a first quality parameter of the second video data and a second quality parameter of a target area in the second video data according to the first video data and the second video data.
And based on the first process, adjusting the QP value of the first ROI according to the first quality parameter and the second quality parameter to obtain an adjusted QP value of the second ROI.
The method provided by the embodiment of the application is applied to the server.
In a possible implementation manner, the server includes a first process and a second process, and based on the first process, the server obtains second video data after encoding and decoding the first video data according to the first ROI QP value, and sends the first video data and the second video data to the second process.
And based on a second process, acquiring a first quality parameter of the second video data and a second quality parameter of a target area in the second video data according to the first video data and the second video data.
And based on the first process, adjusting the QP value of the first ROI according to the first quality parameter and the second quality parameter to obtain an adjusted QP value of the second ROI.
Fig. 1 is a flowchart of a video adjusting method according to an embodiment of the present application. An execution subject of the embodiment of the present application is a terminal, and referring to fig. 1, the method includes:
101. and coding the first video data by adopting the first ROI QP value and then decoding to obtain second video data.
102. And acquiring a first quality parameter of the second video data and a second quality parameter of a target area in the second video data according to the first video data and the second video data.
103. And if the second video data meet the first adjusting condition, adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value.
The first adjusting condition includes at least one of the first quality parameter being greater than the first preset parameter and less than the second preset parameter, or the second quality parameter being greater than the third preset parameter, or the second quality parameter being less than the fourth preset parameter, the first preset parameter being less than the second preset parameter, and the third preset parameter being greater than the fourth preset parameter.
According to the method provided by the embodiment of the application, the first video data is encoded by adopting the first ROI QP value and then decoded to obtain the second video data, the first quality parameter of the second video data and the second quality parameter of the target area in the second video data are obtained, the second video data meet the first adjustment condition, the first ROI QP value is not in accordance with the quality requirement of video encoding, the first ROI QP value is adjusted according to the first quality parameter and the second quality parameter to obtain the adjusted second ROI QP value, the ROI QP value is adjusted adaptively according to the quality of the video data, so that when the code rate in the video data is determined according to the adjusted ROIQP value, the accuracy of the code rate distributed by the video data can be guaranteed, and the image quality of the video data is improved.
Optionally, adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value, including:
and when the first quality parameter is greater than the first preset parameter and less than the second preset parameter, and the second quality parameter is greater than the third preset parameter, increasing the first ROI QP value according to the first adjustment value to obtain a second ROI QP value.
Optionally, after the first ROI QP value is adjusted according to the first quality parameter and the second quality parameter, and the adjusted second ROI QP value is obtained, the method further includes:
according to the second ROI QP value, encoding and then decoding third video data after the first video data to obtain fourth video data;
and acquiring a third quality parameter of the fourth video data and a fourth quality parameter of a target area in the fourth video data according to the third video data and the fourth video data.
Optionally, after the first quality parameter is greater than the first preset parameter and less than the fifth preset parameter, and the second quality parameter is greater than the third preset parameter, and a third quality parameter of the fourth video data and a fourth quality parameter of a target region in the fourth video data are obtained, the method further includes:
if the fourth video data meets a second adjustment condition, continuing to increase the second ROI QP value according to the first adjustment value, wherein the second adjustment condition comprises that the third quality parameter is greater than the fourth quality parameter or the fourth quality parameter is greater than a third preset parameter;
the fifth preset parameter is smaller than the second preset parameter.
Optionally, after the first quality parameter is not less than the fifth preset parameter and less than the second preset parameter, and the second quality parameter is greater than the third preset parameter, and a third quality parameter of the fourth video data and a fourth quality parameter of a target region in the fourth video data are obtained, the method further includes:
if the fourth video data meets a third adjustment condition, continuing to increase the second ROI QP value according to the first adjustment value, wherein the third adjustment condition comprises that the fourth quality parameter is not less than a sixth preset parameter, the third quality parameter is greater than a fifth preset parameter and the third quality parameter is less than the fourth quality parameter; the sixth preset parameter is smaller than the third preset parameter, or,
and if the fourth video data meets a fourth adjustment condition, reducing the second ROI QP value according to the second adjustment value, wherein the fourth adjustment condition comprises that the fourth quality parameter is smaller than a sixth preset parameter and the third quality parameter is larger than a fifth preset parameter, or the third quality parameter is not smaller than the fourth quality parameter, or the fourth quality parameter is not smaller than the sixth preset parameter and the third quality parameter is not larger than the fifth preset parameter.
Optionally, adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value, including:
and when the first quality parameter is greater than the first preset parameter and less than the second preset parameter, and the second quality parameter is less than the fourth preset parameter, reducing the first ROI value according to the first adjustment value to obtain a second ROI QP value.
Optionally, after the first ROI QP value is adjusted according to the first quality parameter and the second quality parameter, and the adjusted second ROI QP value is obtained, the method further includes:
according to the second ROI QP value, encoding and then decoding third video data after the first video data to obtain fourth video data;
and acquiring a third quality parameter of the fourth video data and a fourth quality parameter of a target area of the fourth video data according to the third video data and the fourth video data.
Optionally, after the first quality parameter is greater than the first preset parameter and less than the fifth preset parameter, and the second quality parameter is less than the fourth preset parameter, and a third quality parameter of the fourth video data and a fourth quality parameter of a target area in the fourth video data are obtained, the method further includes:
if the fourth video data meets a fifth adjusting condition, continuing to reduce the second ROI QP value according to the first adjusting numerical value, wherein the fifth adjusting condition comprises that the third quality parameter is not less than a seventh preset parameter, the fourth quality parameter is less than the fourth preset parameter and is greater than the third quality parameter, and the seventh preset parameter is less than the first preset parameter; alternatively, the first and second electrodes may be,
and if the fourth video data meets a sixth adjusting condition, increasing the second ROI QP value according to the second adjusting value, wherein the sixth adjusting condition comprises that the third quality parameter is smaller than a seventh preset parameter, the fourth quality parameter is not smaller than the fourth preset parameter and is larger than the third quality parameter, and the second adjusting value is smaller than the first adjusting value.
Optionally, after the first quality parameter is not less than the fifth preset parameter and less than the second preset parameter, and the second quality parameter is less than the fourth preset parameter, and a third quality parameter of the fourth video data and a fourth quality parameter of the target area in the fourth video data are obtained, the method further includes:
if the fourth video data meets a seventh adjustment condition, continuing to reduce the second ROI QP value according to the first adjustment value, wherein the seventh adjustment condition comprises that the third quality parameter is greater than the eighth preset parameter and the fourth quality parameter is less than the fourth preset parameter; alternatively, the first and second electrodes may be,
and if the fourth video data meets an eighth adjustment condition, increasing the second ROI QP value according to the second adjustment value, wherein the eighth adjustment condition comprises that the third quality parameter is not more than an eighth preset parameter and the fourth quality parameter is not less than a fourth preset parameter, the first adjustment value is more than the second adjustment value, and the eighth preset parameter is less than the fifth preset parameter.
Optionally, the method further comprises:
acquiring a weighting coefficient of the ROI QP value, an intensity coefficient of the ROI QP value, the width of the video data, the length of the video data, the width of a target area and the length of the target area;
determining the ROI QP value according to the weighting coefficient of the ROI QP value, the intensity coefficient of the ROI QP value, the width of the video data, the length of the video data, the width of the target area and the length of the target area; the ROI QP value is inversely proportional to the intensity coefficient of the ROI QP value;
adjusting the ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted ROI QP value, comprising the following steps:
and adjusting the intensity coefficient of the ROI QP value according to the first quality parameter and the second quality parameter, and determining the adjusted ROI QP value according to the intensity coefficient of the adjusted ROI QP value.
Optionally, determining the ROI QP value according to the weighting factor of the ROI QP value, the intensity factor of the ROI QP value, the width of the video data, the length of the video data, the width of the target region, and the length of the target region includes:
the ROI QP value is determined using the following formula:
Figure BDA0002527225680000161
where α represents a weighting coefficient of the ROI QP value, β represents an intensity coefficient of the ROI QP value, video represents a width of the video data, video represents a length of the video data, roiW represents a width of the target region, and roiH represents a length of the target region.
Optionally, if the second video data satisfies the first adjustment condition, adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value, including:
and if the second video data meet the first adjusting condition, calling a parameter adjusting model, and adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value.
Optionally, the method further comprises:
obtaining a first sample quality parameter, a second sample quality parameter and a sample ROI QP value of sample video data; the first sample quality parameter is the quality parameter of any sample video data in the sample video data, the second sample quality parameter is the quality parameter of a target area in the sample video data, and the sample ROI QP value is the ROI QP value adopted when the sample video data is coded;
and training the parameter adjustment model according to the first sample intrinsic quantity parameter, the second sample quality parameter and the sample ROI QP value to obtain the trained parameter adjustment model.
Optionally, obtaining a first sample quality parameter, a second sample quality parameter, and a sample ROIQP value for the sample video data includes:
acquiring a first sample intrinsic quality parameter, a second sample quality parameter and a sample ROI QP value of sample video data, a code rate adopted by the sample video data, a pixel value of an outline area of the sample video data and a motion vector between the sample video data and previous video data;
training the parameter adjustment model according to the first sample intrinsic quantity parameter, the second sample quality parameter and the sample ROI QP value to obtain a trained parameter adjustment model, wherein the training comprises the following steps:
and training the parameter adjustment model according to the first sample intrinsic quantity parameter, the second sample quality parameter, the sample ROI QP value, the code rate adopted by the sample video data, the pixel value of the outline area of the sample video data and the motion vector between the sample video data and the previous video data to obtain a trained quality parameter model.
Optionally, acquiring pixel values of a contour region of the sample video data includes:
extracting a contour region in the sample video data by adopting an edge contour extraction algorithm;
and obtaining the average value of the pixel values of a plurality of pixel points in the contour region, and determining the average value as the pixel value of the contour region.
Optionally, obtaining a motion vector between the sample video data and the previous video data comprises:
acquiring a first motion intensity of sample video data and a second motion intensity of previous video data of the sample video data;
and acquiring a motion vector between the sample video data and the previous video data according to the first motion intensity and the second motion intensity.
Optionally, obtaining a first motion intensity of the sample video data comprises:
determining a position vector of each pixel block according to the position of each pixel block in a plurality of pixel blocks in the sample video data;
the sum of the squares of the position vectors of each pixel block is determined as a first motion strength.
All the above optional technical solutions may be combined arbitrarily to form optional embodiments of the present application, and are not described herein again.
Fig. 2 is a flowchart of a video adjusting method according to an embodiment of the present application. An execution subject of the embodiment of the present application is a terminal, and referring to fig. 2, the method includes:
201. and coding the first video data by adopting the first ROI QP value and then decoding to obtain second video data.
In the embodiment of the application, after the terminal collects video data, the video data are sent to other terminals, in order to reduce the data volume of transmission, a first ROI QP value is adopted to encode the video data, and the encoded video data are sent to other terminals. However, since the video data is encoded and then decoded, the quality of the decoded video data is poor. Therefore, in order to ensure the quality of the video data, the ROI QP value is adjusted according to the first video data and the second video data obtained by encoding and decoding the first video data, so as to ensure the quality of the video data in the subsequent process.
The ROI QP value is used for determining a code rate allocated to a target area in the video data when the video data is coded. When the ROI QP value is smaller, the higher the bitrate corresponding to the target region of the video data is, and the lower the bitrate corresponding to the non-target region of the video data is. When the ROI QP value is larger, the code rate corresponding to the target region of the video data is lower, and the code rate corresponding to the non-target region of the video data is higher.
A target region in video data may be understood as a focal region in the video data. For example, when the video data is a dance video, an area including a person in the video data is a target area, and when the video data is a landscape video, an area including a plant, a building, or the like in the video data is a target video.
In a possible implementation manner, the terminal is provided with a preset trigger manner, acquires first video data according to the preset trigger manner, and decodes the acquired first video data after encoding the acquired first video data according to the first ROI QP value to obtain second video data. The preset triggering mode at least comprises one of timing polling triggering and code rate change triggering, and the number of the video frames in the collected first video data is the same as that in the collected second video data.
Optionally, when the terminal adopts a timed polling triggering mode, the terminal acquires video data once every preset time to obtain first video data, and obtains second video data through encoding and decoding. The preset time period may be any time period, for example, 10 minutes, 15 minutes, and the like.
Optionally, when the terminal adopts a ROI QP value change triggering mode, the terminal obtains a current ROI QP value in real time, and if the ROI QP value changes, acquires video data to obtain first video data, and obtains second video data through encoding and decoding.
When the two modes are adopted to trigger the acquisition of the live video data, the timing polling triggering mode is compared with the ROI QP value change triggering mode, the time length of the interval between the two times of acquiring the video data by the timing polling triggering mode is fixed, and the time length of the interval between the two times of acquiring the video data by the ROI QP value change triggering mode is random, so that the number of the video frames acquired by adopting the two triggering modes at each time can be the same or different, for example, the timing polling triggering mode can acquire 5 continuous video frames at each time, and the ROI QP value change triggering mode can acquire 10 continuous video frames at each time.
The video data is song video data, dance video data, landscape video data, or other types of video data. And the video data can be recorded by the terminal, or downloaded from the server by the terminal, or obtained by other methods.
Furthermore, one piece of video data includes a plurality of consecutive video frames, and when the video data is played, the video data is actually played in sequence according to the arrangement order of the plurality of consecutive video frames to form a continuous animation effect.
In the process of transmitting video data, in order to reduce the data volume of the video data, the video data needs to be encoded, the ROI technology can be applied in the encoding process, that is, the video data is encoded by using the ROI QP value, and the code rate used in the target region and the code rate used in the non-target region of the video data are adjusted by controlling the size of the ROI QP value.
When the terminal encodes the video data by using the ROI QP value, because the initial ROI QP value may not meet the code rate required by the video data, the terminal encodes the first video data based on the first ROI QP value and then decodes the first video data to obtain the second video data, and then the first ROI QP value can be adjusted according to the first video data and the second video data.
202. And acquiring a first quality parameter of the second video data and a second quality parameter of a target area in the second video data according to the first video data and the second video data.
Wherein the first quality parameter is used to indicate the quality of the second video data, and the second quality parameter is used to indicate the quality of the target area in the second video data.
When the first quality parameter and the second quality parameter are obtained, the first quality parameter and the second quality parameter are determined according to the first video data and the encoded and decoded second video data.
In one possible implementation, a quality determination model is invoked, and the first quality parameter and the second quality parameter are determined based on the first video data and the second video data.
Optionally, before the quality determination model is called, the quality determination model needs to be trained to obtain an initial quality determination model, or after one or more times of training, after first sample video data and second sample video data obtained by encoding and decoding the first sample video data are obtained, and a sample quality parameter of the first sample video data is obtained, the quality determination model is trained according to the first sample video data, the second sample video data, and the sample quality parameter, so as to obtain the trained quality determination model.
In the training process, the first sample video data and the second sample video data are input into a quality determination model to obtain a predicted quality parameter, and then parameters of the quality determination model are corrected according to errors between the predicted quality parameter and the sample quality parameter, so that the errors of the corrected quality determination model are converged, and the trained quality determination model is obtained.
In another possible implementation, a vmaf algorithm is used to obtain quality parameters of the video data.
203. And if the second video data meet the first adjusting condition, adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value.
In a possible implementation manner, the terminal sets a scoring standard of the image quality, and divides the image quality into a first grade, a second grade, a third grade and a fourth grade, wherein the first grade represents the best image quality, the fourth grade represents the worst image quality, and each grade has a corresponding parameter range.
For example, the total parameter range of the quality parameter is (0, 100), wherein the first level corresponds to the parameter range (95, 100), the second level corresponds to the parameter range (85, 95), the third level corresponds to the parameter range (65, 85), and the fourth level corresponds to the parameter range (0, 65).
It should be noted that, the embodiment of the present application is only described as an example of dividing the image quality into four levels, and in another embodiment, the image quality may be divided into other numbers of levels, for example, into three levels, five levels, or other levels.
The first adjusting condition includes at least one of the first quality parameter being greater than the first preset parameter and being less than the second preset parameter, or the second quality parameter being greater than the third preset parameter, or the second quality parameter being less than the fourth preset parameter. And the first preset parameter is smaller than the second preset parameter, and the third preset parameter is larger than the fourth preset parameter. In addition, the third preset parameter and the second preset parameter do not distinguish the size relationship, and the third preset parameter may be greater than the second preset parameter, or the third preset parameter is not greater than the second preset parameter.
It is to be understood that the first preset parameter and the second preset parameter define three levels, and the third preset parameter and the fourth preset parameter define three levels.
The first preset parameter, the second preset parameter, the third preset parameter and the fourth preset parameter are all set by a terminal, or set by an operator, or set by other modes. The first predetermined parameter may be 60, 65 or other values. The second predetermined parameter may be 90, 95 or other values. The third predetermined parameter may be 95, 96 or other values, and the fourth predetermined parameter may be 80, 85 or other values.
For example, the first preset parameter is t1, the second preset parameter is t2, the third preset parameter is t3, the fourth preset parameter is t4, the first quality parameter is X1, the second quality parameter is X2, and the relationship among the parameters is shown in fig. 3.
Under the condition shown in fig. 3, it may be determined that the first quality parameter is between the first preset parameter and the second preset parameter, and the second quality parameter is greater than the third preset parameter, so as to satisfy the first adjustment condition.
In a possible implementation manner, when the first quality parameter is greater than the first preset parameter and less than the second preset parameter, and the second quality parameter is greater than the third preset parameter, the first ROI QP value is increased according to the first adjustment value, so as to obtain the second ROI QP value.
The first adjustment value is set by a terminal, or set by an operator, or set by other modes. The first adjustment value may be 0.5, 1, or other values.
When the second quality parameter is determined to be greater than the third preset parameter, the quality of the target region of the second video data is good, and when the first quality parameter is determined to be greater than the first preset parameter and less than the second preset parameter, the quality of the second video data is poor, the code rate allocated to the target region in the second video data can be determined to be high, and the code rate allocated to the non-target region in the second video data is low, so that the first ROI QP value needs to be increased to reduce the code rate allocated to the target region in the video data, further reduce the quality of the target region in the video data, and improve the overall quality of the video data.
In another possible implementation manner, when the first quality parameter is greater than the first preset parameter and less than the second preset parameter, and the second quality parameter is less than the fourth preset parameter, the first ROI value is reduced according to the first adjustment value, so as to obtain a second ROI QP value.
The first adjustment value is the same as the first adjustment value in the above process, and is not described herein again.
When the second quality parameter is determined to be smaller than the fourth preset parameter, the quality of the target region of the second video data is poor, when the first quality parameter is determined to be larger than the first preset parameter and smaller than the second preset parameter, the quality of the second video data is good relative to the quality of the target region in the second video data, the code rate allocated to the target region in the second video data is determined to be small, the code rate allocated to the non-target region in the second video data is determined to be large, the first ROI QP value needs to be reduced to improve the code rate allocated to the target region in the video data, the quality of the target region in the video data is improved, and the overall quality of the video data is reduced.
It should be noted that, in the embodiments of the present application, only the second video data satisfying the first adjustment condition is taken as an example for description. In another embodiment, when it is determined that the second video data does not satisfy the first adjustment condition, the direct result flow does not perform step 204 and step 205.
204. And according to the second ROI QP value, encoding and then decoding third video data after the first video data to obtain fourth video data.
205. And acquiring a third quality parameter of the fourth video data and a fourth quality parameter of a target area in the fourth video data according to the third video data and the fourth video data.
The process in step 204-.
206. And continuously adjusting the second ROI QP value according to the third quality parameter and the fourth quality parameter of the fourth video data.
In the embodiment of the application, the ROI QP value is adjusted by using the first adjustment value, and only once adjustment is performed, and the ROI QP value that may be adjusted still does not meet the requirement, so that when video data subsequent to the first video data is subsequently encoded, the ROI QP value is still continuously adjusted according to the third quality parameter and the fourth quality parameter of the obtained fourth video data.
After the QP value of the first ROI is increased in step 203, the following process further includes:
in a possible implementation manner, on the premise that the first quality parameter is greater than the first preset parameter and less than the fifth preset parameter, and the second quality parameter is greater than the third preset parameter, the adjusting of the second ROI QP value includes one of the following conditions:
and if the fourth video data meets a second adjustment condition, continuing to increase the second ROI QP value according to the first adjustment value, wherein the second adjustment condition comprises that the third quality parameter is greater than the fourth quality parameter or the fourth quality parameter is greater than a third preset parameter.
And the fifth preset parameter is smaller than the second preset parameter.
The second adjustment condition is used for indicating that the quality of the target area of the fourth video data is good and the quality of the fourth video data is poor, and at this time, the second ROI QP value needs to be continuously increased, so that the quality of the target area of the video data is continuously reduced, and the overall quality of the video data is improved. The fifth preset parameter is set by a terminal, or set by an operator, or set in other manners. The fifth predetermined parameter may be 85, 86 or other values.
For example, if the fifth preset parameter is t5, the third quality parameter is X3, and the fourth quality parameter is X4, the relationship between the parameters is shown in fig. 4.
For another example, when the first preset parameter is 65, the fifth preset parameter is 85, the third preset parameter is 95, the first quality parameter is determined to be 80, the second quality parameter is 98, and the adopted first ROI QP value is-13, when the first ROI QP value is increased according to 1, the obtained third quality parameter is 82, the fourth quality parameter is 96, and the fourth quality parameter is determined to be still greater than the third preset parameter 95, the second ROI value is continuously adjusted.
In another possible implementation manner, on the premise that the first quality parameter is not less than the fifth preset parameter and less than the second preset parameter, and the second quality parameter is greater than the third preset parameter, the adjusting of the second ROI QP value includes the following two cases:
the first method comprises the following steps: and if the fourth video data meets the third adjustment condition, continuing to increase the second ROI QP value according to the first adjustment value.
The third adjusting condition comprises that the fourth quality parameter is not less than a sixth preset parameter, the third quality parameter is greater than a fifth preset parameter, the third quality parameter is less than the fourth quality parameter, and the sixth preset parameter is less than the third preset parameter.
The third adjustment condition is used to indicate that the quality of the target area of the fourth video data is good and the quality of the fourth video data is poor, and at this time, the second ROI QP value still needs to be continuously increased, so that the quality of the target area of the video data is continuously reduced and the overall quality of the video data is improved. The sixth preset parameter is set by a terminal, or set by an operator, or set by other methods. The sixth preset parameter may be 93, 94 or other values.
For example, if the fifth preset parameter is t5, the sixth preset parameter is t6, the third quality parameter is X3, and the fourth quality parameter is X4, the relationship between the parameters is shown in fig. 4.
For another example, if the fifth preset parameter is 85, the second preset parameter is 95, the third preset parameter is 95, the sixth preset parameter is 94, the first quality parameter is 90, the second quality parameter is 97, the adopted first ROI QP value is-10, and when the first ROI QP value is increased according to 1, the third quality parameter is 91, and the fourth quality parameter is 95, the fourth quality parameter is still greater than the sixth quality parameter 94, and the second ROI value is continuously increased.
And the second method comprises the following steps: and if the fourth video data meets the fourth adjusting condition, reducing the second ROI QP value according to the second adjusting value.
The fourth adjustment condition includes that the fourth quality parameter is smaller than a sixth preset parameter and the third quality parameter is larger than a fifth preset parameter, or the third quality parameter is not smaller than the fourth quality parameter, or the fourth quality parameter is not smaller than the sixth preset parameter and the third quality parameter is not larger than the fifth preset parameter.
The fourth adjustment condition is used to indicate that the quality of the target area of the fourth video data is poor and the quality of the fourth video data is good, and at this time, the second ROI QP value needs to be decreased to improve the quality of the target area of the video data and decrease the overall quality of the video data.
When it is determined that the fourth video data satisfies the fourth adjustment condition, it is described that the increase width is large in the process of increasing the ROI QP value, and at this time, the ROI QP value needs to be decreased so that the decreased ROI QP value satisfies the requirement.
The second adjustment value is set by a terminal, or set by an operator, or set by other methods. The second adjustment value may be 0.5, 0.4, or other values.
For example, if the fifth preset parameter is t5, the sixth preset parameter is t6, the third quality parameter is X3, and the fourth quality parameter is X4, the relationship between the parameters is shown in fig. 6.
For another example, if the fifth preset parameter is 85, the second preset parameter is 95, the third preset parameter is 95, the sixth preset parameter is 94, the first quality parameter is 90, the second quality parameter is 97, the adopted first ROI QP value is-10, and when the first ROI QP value is increased according to 1, the third quality parameter is 91, and the fourth quality parameter is 93, the fourth quality parameter is determined to be smaller than the sixth quality parameter 94, and the second ROI value is continuously decreased.
After the first ROI QP value is reduced in the manner of step 203, the subsequent process further includes:
in a possible implementation manner, on the premise that the first quality parameter is greater than the first preset parameter and less than the fifth preset parameter, and the second quality parameter is less than the fourth preset parameter, the adjusting of the second ROI QP value includes two cases:
the first method comprises the following steps: and if the fourth video data meets the fifth adjusting condition, continuing to reduce the second ROI QP value according to the first adjusting value.
The fifth adjusting condition includes that the third quality parameter is not less than the seventh preset parameter, the fourth quality parameter is less than the fourth preset parameter and greater than the third quality parameter, and the seventh preset parameter is less than the first preset parameter.
The fifth adjustment condition is used to indicate that the quality of the target area in the fourth video data is poor and the quality of the fourth video data is good, and at this time, the second ROI QP value needs to be continuously reduced, so that the quality of the target area of the video data is continuously improved and the overall quality of the video data is reduced.
The seventh preset parameter is set by a terminal, or set by an operator, or set in other manners. The seventh predetermined parameter may be 85, 86 or other values.
For example, if the seventh preset parameter is t7, the relationship between the parameters is as shown in fig. 7.
For another example, when the seventh preset parameter is 60, the fifth preset parameter is 85, the fourth preset parameter is 90, the first quality parameter is 80, the second quality parameter is 87, the adopted first ROI QP value is-9, when the first ROI QP value is reduced according to 1, the obtained third quality parameter is 76, the fourth quality parameter is 89, and the fourth quality parameter is still less than the fourth preset parameter 90, the second ROI value is continuously reduced.
And the second method comprises the following steps: and if the fourth video data meets the sixth adjusting condition, increasing the second ROI QP value according to the second adjusting numerical value.
The sixth adjusting condition includes that the third quality parameter is smaller than the seventh preset parameter, the fourth quality parameter is not smaller than the fourth preset parameter and larger than the third quality parameter, and the second adjusting value is smaller than the first adjusting value.
The sixth adjustment condition is used to indicate that the quality of the third video data is poor and the quality of the target area of the fourth video data is good, and the second ROI QP value needs to be increased, so that the quality of the target area of the video data is reduced and the overall quality of the video data is improved.
For example, when the seventh preset parameter is 60, the fifth preset parameter is 85, and the fourth preset parameter is 90, it is determined that the first quality parameter is 64, the second quality parameter is 87, and the adopted first ROI QP value is-8, when the first ROI QP value is reduced according to 1, the obtained third quality parameter is 58, the fourth quality parameter is 86, and it is determined that the third quality parameter is smaller than the seventh preset parameter 60, the second ROI value is continuously increased.
In another possible implementation manner, on the premise that the first quality parameter is not less than the fifth preset parameter and less than the second preset parameter, and the second quality parameter is less than the fourth preset parameter, the adjusting of the QP value of the second ROI includes two cases:
first, if the fourth video data satisfies the seventh adjustment condition, the QP value of the second ROI is decreased according to the first adjustment value.
The seventh adjusting condition includes that the third quality parameter is greater than the eighth preset parameter and the fourth quality parameter is less than the fourth preset parameter. The eighth preset parameter is smaller than the fifth preset parameter.
The seventh adjustment condition is used to indicate that the quality of the fourth video data is good, and the quality of the target area of the fourth video data is poor, at this time, the second ROI QP value needs to be reduced, so as to continue to improve the quality of the target area of the video data and reduce the overall quality of the video data.
The eighth preset parameter is set by a terminal, or set by an operator, or set in other manners. The eighth preset parameter may be 80, 81 or other values.
For example, if the eighth preset parameter is t8, the relationship between the parameters is shown in fig. 8.
For another example, when the eighth preset parameter is 80, the fifth preset parameter is 85, and the fourth preset parameter is 90, the first quality parameter is 86, the second quality parameter is 88, and the adopted first ROI QP value is-9, when the first ROI QP value is reduced according to 1, the obtained third quality parameter is 84, the fourth quality parameter is 89, and the fourth quality parameter is still less than the fourth preset parameter 90, the second ROI value is continuously reduced.
And the second method comprises the following steps: and if the fourth video data meets the eighth adjustment condition, increasing the second ROI QP value according to the second adjustment value.
The eighth adjusting condition includes that the third quality parameter is not greater than the eighth preset parameter and the fourth quality parameter is not less than the fourth preset parameter, and the first adjusting value is greater than the second adjusting value.
The eighth adjustment condition is used to indicate that the quality of the fourth video data is poor and the quality of the target area of the fourth video data is good, and at this time, the second ROI QP value needs to be increased, so that the quality of the target area of the video data is reduced and the overall quality of the video data is improved.
For example, when the eighth preset parameter is 80, the fifth preset parameter is 85, and the fourth preset parameter is 90, the first quality parameter is 86, the second quality parameter is 88, and the adopted first ROI QP value is-11, when the first ROI QP value is reduced according to 1, the obtained third quality parameter is 79, the fourth quality parameter is 92, and the third quality parameter is determined to be less than the eighth preset parameter 80, then the second ROI QP value is continuously increased.
The first point to be described in the embodiments of the present application is that the ROI QP value is adjusted only by the case where the third quality parameter and the fourth quality parameter satisfy the adjustment condition. In another embodiment, when it is determined that the third quality parameter and the fourth quality parameter do not satisfy the adjustment condition, the ROI QP value may not be adjusted any more.
The second point to be described is that the present embodiment is only described for adjusting the ROI QP value. In another embodiment, since the ROI QP value is obtained using multiple parameters, the parameters in the ROI QP value are actually adjusted when the ROI QP value is adjusted.
In one possible implementation, when the ROI QP value is obtained, a weighting coefficient of the ROI QP value, an intensity coefficient of the ROI QP value, a width of the video data, a length of the video data, a width of the target region, and a length of the target region are obtained, and the ROI QP value is determined according to the weighting coefficient of the ROI QP value, the intensity coefficient of the ROI QP value, the width of the video data, the length of the video data, the width of the target region, and the length of the target region.
Wherein the ROI QP value is inversely proportional to an intensity coefficient of the ROI QP value.
Optionally, the ROI QP value is determined using the following formula:
Figure BDA0002527225680000261
where α represents a weighting coefficient of the ROI QP value, β represents an intensity coefficient of the ROI QP value, video represents a width of the video data, video represents a length of the video data, roiW represents a width of the target region, and roiH represents a length of the target region.
Optionally, since the ROI QP value is inversely proportional to the intensity coefficient of the ROI QP value, in the adjusting of the ROI QP value, the intensity coefficient of the ROI QP value is adjusted according to the first quality parameter and the second quality parameter, and the adjusted ROI QP value is determined according to the adjusted intensity coefficient of the ROI QP value.
If the ROI QP value needs to be increased, the intensity coefficient of the ROI QP value is decreased, and if the ROI QP value needs to be decreased, the intensity coefficient of the ROI QP value is increased.
In addition, since the above-described procedures all describe the adjustment conditions for adjusting the ROI QP value, when it is determined that the adjustment conditions are satisfied, the intensity coefficient of the ROI QP value may be adjusted.
A third point to be described is that, in the embodiment of the present application, after the ROI QP value is adjusted, after a preset time interval, the quality parameter of the currently encoded video data and the quality parameter of the target region of the video data are continuously obtained, and the method of the embodiment of the present application is continuously adopted to adjust the ROI QP value.
A fourth point to be described is that, in the embodiment of the present application, the execution subject is only taken as an example to be described as a terminal, in another embodiment, the execution subject may be a server, the server acquires the first video data and the second video data, acquires the first quality parameter and the second quality parameter of the second video data according to the first video data and the second video data, and adjusts the first ROI QP value according to the first quality parameter and the second quality parameter, so as to obtain the adjusted second ROI QP value.
According to the method provided by the embodiment of the application, the first video data is encoded by adopting the first ROI QP value and then decoded to obtain the second video data, the first quality parameter of the second video data and the second quality parameter of the target area in the second video data are obtained, the second video data meet the first adjustment condition, the first ROI QP value is not in accordance with the quality requirement of video encoding, the first ROI QP value is adjusted according to the first quality parameter and the second quality parameter to obtain the adjusted second ROI QP value, the ROI QP value is adjusted adaptively according to the quality of the video data, so that when the code rate in the video data is determined according to the adjusted ROIQP value, the accuracy of the code rate distributed by the video data can be guaranteed, and the image quality of the video data is improved.
In addition, the method provided by the embodiment of the application can also continue to encode according to the adjusted second ROI QP value, and subsequently, can continue to adjust the second ROI QP value according to the quality parameter of the video data and the quality parameter of the target region in the video data, so that when the code rate in the video data is determined according to the adjusted ROI QP value, the accuracy of the code rate allocated in the video data can continue to be improved, and further, the image quality of the video data continues to be improved.
Fig. 9 is a flowchart of a video adjusting method according to an embodiment of the present application. An execution subject of the embodiment of the present application is a terminal, and referring to fig. 9, the method includes:
901. and coding the first video data based on the first ROI QP value and then decoding to obtain second video data.
902. And acquiring a first quality parameter of the second video data and a second quality parameter of a target area in the second video data according to the first video data and the second video data.
The process of steps 901-902 is similar to that of step 201-202, and is not described herein again.
903. And if the second video data meet the first adjusting condition, calling a parameter adjusting model, and adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value.
The parameter adjusting model is used for obtaining the ROI QP value according to the first quality parameter and the second quality parameter.
The first adjusting condition is used for determining that the first quality parameter and the second quality parameter of the second video data do not meet the requirements, and the first ROI QP value needs to be adjusted so that the quality parameter of the video data encoded according to the adjusted second ROI QP value meets the requirements.
In addition, when it is determined that the second video data does not satisfy the first adjustment condition, the first ROI QP value is not adjusted, and the subsequent video data is encoded by directly using the first ROI QP value.
Optionally, the first adjustment condition includes at least one of that the first quality parameter is greater than the first preset parameter and less than the second preset parameter, or the second quality parameter is greater than the third preset parameter, or the second quality parameter is less than the fourth preset parameter, the first preset parameter is less than the second preset parameter, and the third preset parameter is greater than the fourth preset parameter.
The first preset parameter, the second preset parameter, the third preset parameter and the fourth preset parameter are all set by a terminal, or set by an operator, or set by other modes. The first predetermined parameter may be 60, 65 or other values. The second predetermined parameter may be 90, 95 or other values. The third predetermined parameter may be 95, 96 or other values, and the fourth predetermined parameter may be 80, 85 or other values.
In addition, before the parameter adjustment model is called, the parameter adjustment model needs to be trained, before the parameter adjustment model is trained, an initial parameter adjustment model or a parameter adjustment model trained for one or more times is obtained, then a first sample intrinsic quantity parameter, a second sample quality parameter and a sample ROI QP value of the sample video data are obtained, and the parameter adjustment model is trained according to the first sample intrinsic quantity parameter, the second sample quality parameter and the sample ROI QP value to obtain the trained parameter adjustment model.
The first sample intrinsic quality parameter is a quality parameter of any sample video data, the second sample quality parameter is a quality parameter of a target area in the sample video data, and the sample ROI QP value is an ROI QP value adopted when the sample video data is coded.
In addition, when the first sample intrinsic quality parameter and the second sample quality parameter are obtained, the process of obtaining the first quality parameter and the second quality parameter is the same, and is not described herein again.
In the training process, the first sample intrinsic quality parameter and the second sample quality parameter are input into a parameter adjustment model to obtain a predicted ROI QP value, and then the parameters of the parameter adjustment model are corrected according to the error between the predicted ROI QP value and the sample ROI QP value, so that the error of the corrected parameter adjustment model is converged, and the trained parameter adjustment model is obtained.
In a possible implementation manner, a first sample intrinsic quantity parameter, a second sample quality parameter and a sample ROI QP value of sample video data, a code rate adopted by the sample video data, a pixel value of a contour region of the sample video data, and a motion vector between the sample video data and previous video data are obtained, and a parameter adjustment model is trained according to the first sample intrinsic quantity parameter, the second sample quality parameter, the sample ROI QP value, the code rate adopted by the sample video data, the pixel value of the contour region of the sample video data, and the motion vector between the sample video data and the previous video data, so as to obtain a trained quality parameter model.
In the training process, the first sample intrinsic quality parameter and the second sample quality parameter, the code rate adopted by the sample video data, the pixel value of the outline region of the sample video data and the motion vector between the sample video data and the previous video data are input into a parameter adjustment model to obtain a predicted ROI QP value, and then the parameters of the parameter adjustment model are corrected according to the error between the predicted ROI QP value and the sample ROI QP value, so that the error of the corrected parameter adjustment model is converged, and the trained parameter adjustment model is obtained.
Optionally, an edge contour extraction algorithm is adopted to extract a contour region in the sample video data, an average value of pixel values of a plurality of pixel points in the contour region is obtained, and the average value is determined as the pixel value of the contour region.
Optionally, a first motion intensity of the sample video data and a second motion intensity of previous video data of the sample video data are obtained, and a motion vector between the sample video data and the previous video data is obtained according to the first motion intensity and the second motion intensity.
Optionally, a position vector of each pixel block is determined according to a position of each pixel block in a plurality of pixel blocks in the sample video data, and a sum of squares of the position vectors of each pixel block is determined as the first motion strength.
The sample video data is composed of a plurality of pixel blocks, each pixel block has its own position in the video data, and then the position vector of each pixel block can be determined according to the position of each pixel block, and the sum of squares of the position vectors of each pixel block is determined to be the first motion intensity of the sample video data. In addition, the motion intensity of other video data is also obtained in the above manner.
For example, by calling a parameter adjustment model, the ROI QP value determined according to the first sample quality parameter and the second sample quality parameter, the bitrate adopted by the sample video data, the pixel value of the contour region of the sample video data, and the motion vector between the sample video data and the previous video data is shown in table 1.
TABLE 1
Figure BDA0002527225680000291
904. Video data subsequent to the first video data is encoded according to the second ROI QP value.
After the second ROI QP value is obtained, the video data after the first video data can be continuously coded according to the second ROI QP value, the code rate distributed to the video data by the second ROI QP value is accurate, and the image quality of the video data is improved.
The first point to be described is that, in the embodiment of the present application, after the ROI QP value is adjusted, after a preset time interval, the quality parameter of the currently encoded video data and the quality parameter of the target region of the video data are continuously obtained, and the method of the embodiment of the present application is continuously adopted to adjust the ROI QP value.
A second point to be described is that, in the embodiment of the present application, only the execution subject is taken as an example to be described as the terminal, in another embodiment, the execution subject may be a server, the server acquires the first video data and the second video data, and acquires the first quality parameter and the second quality parameter of the second video data according to the first video data and the second video data, and if the second video data satisfies the first adjustment condition, the parameter adjustment model is invoked, and the first ROI QP value is adjusted according to the first quality parameter and the second quality parameter, so as to obtain the adjusted second ROI QP value.
According to the method provided by the embodiment of the application, the adjusted second ROI QP value can be determined according to the first quality parameter and the second quality parameter of the second video data, the automatic adjustment of the ROI QP value is realized, and the parameter adjustment model has the capability of adjusting the ROI QP value, so that the obtained second ROI QP value can meet the coding requirement, the accuracy of the ROIQP value is improved, and the image quality of the video data is further improved.
In addition, when the parameter adjustment model is trained, the accuracy of the trained parameter adjustment model can be improved by adopting the first quality parameter and the second quality parameter of the sample video data, the pixel value of the outline region of the sample video data and the motion vector between the sample video data and the previous video data, and the accuracy of calling the parameter adjustment model to determine the adjusted ROI QP value is further improved.
Fig. 10 is a schematic structural diagram of a video adjusting apparatus according to an embodiment of the present application, and referring to fig. 10, the apparatus includes:
the encoding and decoding module 1001 is configured to encode the first video data by using the first ROI QP value and then decode the first video data to obtain second video data;
a quality obtaining module 1002, configured to obtain a first quality parameter of second video data and a second quality parameter of a target area in the second video data according to the first video data and the second video data;
an adjusting module 1003, configured to adjust the first ROI QP value according to the first quality parameter and the second quality parameter if the second video data meets a first adjusting condition, so as to obtain an adjusted second ROI QP value, where the first adjusting condition includes at least one of the first quality parameter being greater than a first preset parameter and being smaller than a second preset parameter, or the second quality parameter being greater than a third preset parameter, or the second quality parameter being smaller than a fourth preset parameter, the first preset parameter being smaller than the second preset parameter, and the third preset parameter being greater than the fourth preset parameter.
The device provided by the embodiment of the application decodes the first video data after encoding the first video data by using the first ROI QP value to obtain the second video data, obtains the first quality parameter of the second video data and the second quality parameter of the target area in the second video data, and the second video data meets the first adjustment condition, which indicates that the first ROI QP value does not meet the quality requirement of video encoding.
Optionally, referring to fig. 11, the adjusting module 1003 includes:
and an increasing unit 10031, configured to increase the first ROI QP value according to the first adjustment value when the first quality parameter is greater than the first preset parameter and less than the second preset parameter, and the second quality parameter is greater than the third preset parameter, so as to obtain a second ROIQP value.
Optionally, the encoding and decoding module 1001 is configured to encode and decode third video data after the first video data according to the second ROI QP value to obtain fourth video data;
the quality obtaining module 1002 is configured to obtain a third quality parameter of the fourth video data and a fourth quality parameter of a target area in the fourth video data according to the third video data and the fourth video data.
Optionally, the first quality parameter is greater than the first preset parameter and less than the fifth preset parameter, and the second quality parameter is greater than the third preset parameter, and the increasing unit 10031 is configured to:
if the fourth video data meets a second adjustment condition, continuing to increase the second ROI QP value according to the first adjustment value, wherein the second adjustment condition comprises that the third quality parameter is greater than the fourth quality parameter or the fourth quality parameter is greater than a third preset parameter;
the fifth preset parameter is smaller than the second preset parameter.
Optionally, the first quality parameter is not less than a fifth preset parameter and less than a second preset parameter, and the second quality parameter is greater than a third preset parameter:
a improving unit 10031, configured to continue to improve the second ROI QP value according to the first adjustment value if the fourth video data meets a third adjustment condition, where the third adjustment condition includes that the fourth quality parameter is not less than a sixth preset parameter, the third quality parameter is greater than a fifth preset parameter, and the third quality parameter is less than the fourth quality parameter; the sixth preset parameter is smaller than the third preset parameter, or,
referring to fig. 11, the adjusting module further includes: lowering unit 10032;
a reducing unit 10032, configured to reduce the second ROI QP value according to a second adjustment value if the fourth video data meets a fourth adjustment condition, where the fourth adjustment condition includes that the fourth quality parameter is smaller than a sixth preset parameter and the third quality parameter is larger than a fifth preset parameter, or the third quality parameter is not smaller than the fourth quality parameter, or the fourth quality parameter is not smaller than the sixth preset parameter and the third quality parameter is not larger than the fifth preset parameter.
Optionally, the adjusting module 1003 includes:
a reducing unit 10032, configured to reduce the first ROI value according to the first adjustment value when the first quality parameter is greater than the first preset parameter and smaller than the second preset parameter, and the second quality parameter is smaller than the fourth preset parameter, to obtain a second ROI QP value.
Optionally, the encoding and decoding module 1001 is configured to encode and decode third video data after the first video data according to the second ROI QP value to obtain fourth video data;
the quality obtaining module 1002 is configured to obtain a third quality parameter of the fourth video data and a fourth quality parameter of a target area of the fourth video data according to the third video data and the fourth video data.
Optionally, the first quality parameter is larger than the first preset parameter and smaller than the fifth preset parameter, the second quality parameter is smaller than the fourth preset parameter,
a reducing unit 10032, configured to continue to reduce the second ROI QP value according to the first adjustment value if the fourth video data meets a fifth adjustment condition, where the fifth adjustment condition includes that the third quality parameter is not less than a seventh preset parameter, the fourth quality parameter is less than the fourth preset parameter and greater than the third quality parameter, and the seventh preset parameter is less than the first preset parameter; alternatively, the first and second electrodes may be,
the adjusting module 1003 further includes: the increasing unit 10031;
the improving unit 10031 is configured to improve the second ROI QP value according to a second adjustment value if the fourth video data meets a sixth adjustment condition, where the sixth adjustment condition includes that the third quality parameter is smaller than a seventh preset parameter, the fourth quality parameter is not smaller than the fourth preset parameter and is larger than the third quality parameter, and the second adjustment value is smaller than the first adjustment value.
Optionally, the first quality parameter is not less than the fifth preset parameter and less than the second preset parameter, the second quality parameter is less than the fourth preset parameter,
a reducing unit 10032, configured to continue to reduce the second ROI QP value according to the first adjustment value if the fourth video data meets a seventh adjustment condition, where the seventh adjustment condition includes that the third quality parameter is greater than the eighth preset parameter and the fourth quality parameter is less than the fourth preset parameter; alternatively, the first and second electrodes may be,
the adjusting module 1003 further includes: the increasing unit 10031;
the improving unit 10031 is configured to, if the fourth video data meets an eighth adjustment condition, improve the second ROI QP value according to the second adjustment value, where the eighth adjustment condition includes that the third quality parameter is not greater than an eighth preset parameter and the fourth quality parameter is not less than the fourth preset parameter, the first adjustment value is greater than the second adjustment value, and the eighth preset parameter is less than the fifth preset parameter.
Optionally, the apparatus further comprises:
a parameter obtaining module 1004, configured to obtain a weighting coefficient of the ROI QP value, an intensity coefficient of the ROI QP value, a width of the video data, a length of the video data, a width of the target region, and a length of the target region;
a numerical value determining module 1005, configured to determine a ROI QP value according to a weighting coefficient of the ROI QP value, an intensity coefficient of the ROI QP value, a width of the video data, a length of the video data, a width of the target region, and a length of the target region; the ROI QP value is inversely proportional to the intensity coefficient of the ROI QP value;
an adjusting module 1003, configured to adjust an intensity coefficient of the ROI QP value according to the first quality parameter and the second quality parameter, and determine the adjusted ROI QP value according to the adjusted intensity coefficient of the ROI QP value.
Optionally, a numerical determination module 1005, configured to:
the ROI QP value is determined using the following formula:
Figure BDA0002527225680000331
where α represents a weighting coefficient of the ROI QP value, β represents an intensity coefficient of the ROI QP value, video represents a width of the video data, video represents a length of the video data, roiW represents a width of the target region, and roiH represents a length of the target region.
Optionally, the adjusting module 1003 is further configured to invoke a parameter adjustment model if the second video data meets the first adjustment condition, and adjust the first ROI QP value according to the first quality parameter and the second quality parameter, so as to obtain an adjusted second ROI QP value.
Optionally, the apparatus further comprises:
a sample obtaining module 1006, configured to obtain a first sample quality parameter, a second sample quality parameter, and a sample ROI QP value of the sample video data; the first sample quality parameter is the quality parameter of any sample video data in the sample video data, the second sample quality parameter is the quality parameter of a target area in the sample video data, and the sample ROI QP value is the ROI QP value adopted when the sample video data is coded;
the training module 1007 is configured to train the parameter adjustment model according to the first sample intrinsic quantity parameter, the second sample quality parameter, and the sample ROI QP value, so as to obtain a trained parameter adjustment model.
Optionally, the sample obtaining module 1006 is configured to obtain a first sample quality parameter, a second sample quality parameter, and a sample ROI QP value of the sample video data, as well as a code rate adopted by the sample video data, a pixel value of a contour region of the sample video data, and a motion vector between the sample video data and previous video data;
the training module 1007 is configured to train the parameter adjustment model according to the first sample intrinsic quantity parameter, the second sample quality parameter, the sample ROI QP value, the code rate used by the sample video data, the pixel value of the outline region of the sample video data, and the motion vector between the sample video data and the previous video data, so as to obtain a trained quality parameter model.
Optionally, the sample acquiring module 1006 is configured to:
extracting a contour region in the sample video data by adopting an edge contour extraction algorithm;
and obtaining the average value of the pixel values of a plurality of pixel points in the contour region, and determining the average value as the pixel value of the contour region.
Optionally, the sample acquiring module 1006 is configured to:
acquiring a first motion intensity of sample video data and a second motion intensity of previous video data of the sample video data;
and acquiring a motion vector between the sample video data and the previous video data according to the first motion intensity and the second motion intensity.
Optionally, the sample acquiring module 1006 is configured to:
determining a position vector of each pixel block according to the position of each pixel block in a plurality of pixel blocks in the sample video data;
the sum of the squares of the position vectors of each pixel block is determined as a first motion strength.
All the above optional technical solutions may be combined arbitrarily to form optional embodiments of the present application, and are not described herein again.
It should be noted that: in the video adjusting apparatus provided in the foregoing embodiment, when playing audio information, only the division of the functional modules is illustrated, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the terminal is divided into different functional modules to complete all or part of the functions described above. In addition, the video adjusting apparatus and the video adjusting method provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments in detail and are not described herein again.
Fig. 12 is a schematic structural diagram of a terminal according to an embodiment of the present application. The terminal 1200 may be a portable mobile terminal such as: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group audio Layer III, motion Picture Experts compression standard audio Layer 3), an MP4 player (Moving Picture Experts Group audio Layer IV, motion Picture Experts compression standard audio Layer 4), a notebook computer, a desktop computer, a head-mounted device, or any other intelligent terminal. Terminal 1200 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, and so forth.
In general, terminal 1200 includes: a processor 1201 and a memory 1202.
The processor 1201 may include one or more processing cores, such as a 4-core processor, an 8-core processor, or the like. The processor 1201 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 1201 may also include a main processor and a coprocessor, where the main processor is a processor for processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 1201 may be integrated with a GPU (Graphics Processing Unit, image Processing interactor) for rendering and drawing content required to be displayed on the display screen. In some embodiments, the processor 1201 may further include an AI (Artificial Intelligence) processor for processing a computing operation related to machine learning.
Memory 1202 may include one or more computer-readable storage media, which may be non-transitory. Memory 1202 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 1202 is used to store at least one instruction for being possessed by processor 1201 to implement the video adaptation methods provided by method embodiments herein.
In some embodiments, the terminal 1200 may further optionally include: a peripheral interface 1203 and at least one peripheral. The processor 1201, memory 1202, and peripheral interface 1203 may be connected by a bus or signal line. Various peripheral devices may be connected to peripheral interface 1203 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 1204, touch display 1205, camera assembly 1206, audio circuitry 1207, positioning assembly 1208, and power supply 1209.
The peripheral interface 1203 may be used to connect at least one peripheral associated with I/O (Input/Output) to the processor 1201 and the memory 1202. In some embodiments, the processor 1201, memory 1202, and peripheral interface 1203 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1201, the memory 1202 and the peripheral device interface 1203 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
The Radio Frequency circuit 1204 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuit 1204 communicates with a communication network and other communication devices by electromagnetic signals. The radio frequency circuit 1204 converts an electric signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electric signal. Optionally, the radio frequency circuit 1204 comprises: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuit 1204 may communicate with other terminals through at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: metropolitan area networks, various generation mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the rf circuit 1204 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 1205 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 1205 is a touch display screen, the display screen 1205 also has the ability to acquire touch signals on or over the surface of the display screen 1205. The touch signal may be input to the processor 1201 as a control signal for processing. At this point, the display 1205 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 1205 may be one, providing the front panel of the terminal 1200; in other embodiments, the display 1205 can be at least two, respectively disposed on different surfaces of the terminal 1200 or in a folded design; in still other embodiments, the display 1205 may be a flexible display disposed on a curved surface or on a folded surface of the terminal 1200. Even further, the display screen 1205 may be arranged in a non-rectangular irregular figure, i.e., a shaped screen. The Display panel 1205 can be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), or other materials.
Camera assembly 1206 is used to capture images or video. Optionally, camera assembly 1206 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 1206 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
The audio circuitry 1207 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals into the processor 1201 for processing or inputting the electric signals into the radio frequency circuit 1204 to achieve voice communication. For stereo capture or noise reduction purposes, multiple microphones may be provided at different locations of terminal 1200. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 1201 or the radio frequency circuit 1204 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, the audio circuitry 1207 may also include a headphone jack.
The positioning component 1208 is used to locate a current geographic location of the terminal 1200 to implement navigation or LBS (location based Service). The positioning component 1208 may be a positioning component based on the GPS (global positioning System) in the united states, the beidou System in china, the graves System in russia, or the galileo System in the european union.
The power supply 1209 is used to provide power to various components within the terminal 1200. The power source 1209 may be alternating current, direct current, disposable or rechargeable. When the power source 1209 includes a rechargeable battery, the rechargeable battery may support wired or wireless charging. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, terminal 1200 also includes one or more sensors 1210. The one or more sensors 1210 include, but are not limited to: acceleration sensor 1211, gyro sensor 1212, pressure sensor 1213, fingerprint sensor 1214, optical sensor 1215, and proximity sensor 1216.
The acceleration sensor 1211 can detect magnitudes of accelerations on three coordinate axes of the coordinate system established with the terminal 1200. For example, the acceleration sensor 1211 may be used to detect components of the gravitational acceleration in three coordinate axes. The processor 1201 may control the touch display 1205 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 1211. The acceleration sensor 1211 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 1212 may detect a body direction and a rotation angle of the terminal 1200, and the gyro sensor 1212 may collect a 3D motion of the user on the terminal 1200 in cooperation with the acceleration sensor 1211. The processor 1201 can implement the following functions according to the data collected by the gyro sensor 1212: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
Pressure sensors 1213 may be disposed on a side bezel of terminal 1200 and/or an underlying layer of touch display 1205. When the pressure sensor 1213 is disposed on the side frame of the terminal 1200, the user's holding signal of the terminal 1200 can be detected, and the processor 1201 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 1213. When the pressure sensor 1213 is disposed at a lower layer of the touch display screen 1205, the processor 1201 controls the operability control on the UI interface according to the pressure operation of the user on the touch display screen 1205. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 1214 is used for collecting a fingerprint of the user, and the processor 1201 identifies the user according to the fingerprint collected by the fingerprint sensor 1214, or the fingerprint sensor 1214 identifies the user according to the collected fingerprint. Upon recognizing that the user's identity is a trusted identity, the processor 1201 authorizes the user to have relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings, etc. The fingerprint sensor 1214 may be provided on the front, back, or side of the terminal 1200. When a physical button or vendor Logo is provided on the terminal 1200, the fingerprint sensor 1214 may be integrated with the physical button or vendor Logo.
The optical sensor 1215 is used to collect the ambient light intensity. In one embodiment, the processor 1201 may control the display brightness of the touch display 1205 according to the ambient light intensity collected by the optical sensor 1215. Specifically, when the ambient light intensity is high, the display brightness of the touch display panel 1205 is increased; when the ambient light intensity is low, the display brightness of the touch display panel 1205 is turned down. In another embodiment, processor 1201 may also dynamically adjust the camera head 1206 shooting parameters based on the ambient light intensity collected by optical sensor 1215.
A proximity sensor 1216, also known as a distance sensor, is typically disposed on the front panel of the terminal 1200. The proximity sensor 1216 is used to collect a distance between the user and the front surface of the terminal 1200. In one embodiment, when the proximity sensor 1216 detects that the distance between the user and the front surface of the terminal 1200 gradually decreases, the processor 1201 controls the touch display 1205 to switch from the bright screen state to the dark screen state; when the proximity sensor 1216 detects that the distance between the user and the front surface of the terminal 1200 gradually becomes larger, the processor 1201 controls the touch display 1205 to switch from the breath screen state to the bright screen state.
Those skilled in the art will appreciate that the configuration shown in fig. 12 is not intended to be limiting of terminal 1200 and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used.
Fig. 13 is a schematic structural diagram of a server 1300 according to an embodiment of the present application, where the server 1300 may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 1301 and one or more memories 1302, where the memory 1302 stores at least one instruction, and the at least one instruction is loaded and executed by the processor 1301 to implement the methods provided by the foregoing method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input/output, and the server may also include other components for implementing the functions of the device, which are not described herein again.
The server 1300 can be used for executing the steps executed by the server in the video adjusting method.
The embodiment of the present application further provides a computer device, where the computer device includes a processor and a memory, where the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the operations performed in the video adjusting method of the foregoing embodiment.
The embodiment of the present application further provides a computer-readable storage medium, where at least one instruction is stored in the computer-readable storage medium, and the at least one instruction is loaded and executed by a processor to implement the operations performed in the video adjusting method of the foregoing embodiment.
The embodiment of the present application further provides a computer program, where at least one instruction is stored in the computer program, and the at least one instruction is loaded and executed by a processor, so as to implement the operations executed in the video adjusting method of the foregoing embodiment.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (20)

1. A method for video adaptation, the method comprising:
the first video data is encoded by adopting a first ROI QP value and then decoded to obtain second video data;
acquiring a first quality parameter of the second video data and a second quality parameter of a target area in the second video data according to the first video data and the second video data;
and if the second video data meets a first adjusting condition, adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value, wherein the first adjusting condition comprises that the first quality parameter is greater than a first preset parameter and less than a second preset parameter, or the second quality parameter is greater than a third preset parameter, or the second quality parameter is less than at least one of fourth preset parameters, the first preset parameter is less than the second preset parameter, and the third preset parameter is greater than the fourth preset parameter.
2. The method of claim 1, wherein the adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value comprises:
and when the first quality parameter is greater than the first preset parameter and less than the second preset parameter, and the second quality parameter is greater than the third preset parameter, increasing the first ROI QP value according to a first adjustment value to obtain the second ROI QP value.
3. The method of claim 2, wherein after adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value, the method further comprises:
according to the second ROI QP value, encoding and then decoding third video data behind the first video data to obtain fourth video data;
and acquiring a third quality parameter of the fourth video data and a fourth quality parameter of a target area in the fourth video data according to the third video data and the fourth video data.
4. The method of claim 3, wherein the first quality parameter is greater than the first preset parameter and less than a fifth preset parameter, the second quality parameter is greater than the third preset parameter, and after the third quality parameter of the fourth video data and the fourth quality parameter of the target area in the fourth video data are obtained, the method further comprises:
if the fourth video data meets a second adjustment condition, continuing to increase the second ROI QP value according to the first adjustment value, wherein the second adjustment condition comprises that the third quality parameter is greater than the fourth quality parameter or the fourth quality parameter is greater than the third preset parameter;
the fifth preset parameter is smaller than the second preset parameter.
5. The method according to claim 3, wherein the first quality parameter is not less than the fifth preset parameter and less than the second preset parameter, the second quality parameter is greater than the third preset parameter, and after the third quality parameter of the fourth video data and the fourth quality parameter of the target area in the fourth video data are obtained, the method further comprises:
if the fourth video data meets a third adjustment condition, continuing to increase the second ROI QP value according to the first adjustment value, wherein the third adjustment condition comprises that the fourth quality parameter is not less than a sixth preset parameter, the third quality parameter is greater than the fifth preset parameter, and the third quality parameter is less than the fourth quality parameter; the sixth preset parameter is smaller than the third preset parameter, or,
and if the fourth video data meets a fourth adjustment condition, reducing the second ROI QP value according to a second adjustment value, wherein the fourth adjustment condition comprises that the fourth quality parameter is smaller than a sixth preset parameter and the third quality parameter is larger than a fifth preset parameter, or the third quality parameter is not smaller than the fourth quality parameter, or the fourth quality parameter is not smaller than the sixth preset parameter and the third quality parameter is not larger than the fifth preset parameter.
6. The method of claim 1, wherein the adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value comprises:
and when the first quality parameter is greater than the first preset parameter and less than the second preset parameter, and the second quality parameter is less than the fourth preset parameter, reducing the first ROI value according to a first adjustment value to obtain a second ROI QP value.
7. The method of claim 6, wherein the adjusting the first ROI QP value according to the first quality parameter and the second quality parameter, after obtaining an adjusted second ROI QP value, the method further comprises:
according to the second ROI QP value, encoding and then decoding third video data behind the first video data to obtain fourth video data;
and acquiring a third quality parameter of the fourth video data and a fourth quality parameter of a target area of the fourth video data according to the third video data and the fourth video data.
8. The method according to claim 7, wherein the first quality parameter is greater than the first preset parameter and less than a fifth preset parameter, the second quality parameter is less than the fourth preset parameter, and after the third quality parameter of the fourth video data and the fourth quality parameter of the target area in the fourth video data are obtained, the method further comprises:
if the fourth video data meets a fifth adjustment condition, continuing to reduce the second ROI QP value according to the first adjustment value, wherein the fifth adjustment condition comprises that the third quality parameter is not less than a seventh preset parameter, the fourth quality parameter is less than the fourth preset parameter and is greater than the third quality parameter, and the seventh preset parameter is less than the first preset parameter; alternatively, the first and second electrodes may be,
and if the fourth video data meets a sixth adjustment condition, increasing the second ROI QP value according to a second adjustment value, wherein the sixth adjustment condition comprises that the third quality parameter is smaller than the seventh preset parameter, the fourth quality parameter is not smaller than the fourth preset parameter and is larger than the third quality parameter, and the second adjustment value is smaller than the first adjustment value.
9. The method according to claim 7, wherein the first quality parameter is not less than the fifth preset parameter and less than the second preset parameter, the second quality parameter is less than the fourth preset parameter, and after the third quality parameter of the fourth video data and the fourth quality parameter of the target area in the fourth video data are obtained, the method further comprises:
if the fourth video data meets a seventh adjustment condition, continuing to reduce the second ROI QP value according to the first adjustment value, wherein the seventh adjustment condition comprises that the third quality parameter is greater than an eighth preset parameter and the fourth quality parameter is less than the fourth preset parameter; alternatively, the first and second electrodes may be,
and if the fourth video data meets an eighth adjustment condition, increasing the second ROI QP value according to a second adjustment value, wherein the eighth adjustment condition comprises that the third quality parameter is not more than an eighth preset parameter and the fourth quality parameter is not less than the fourth preset parameter, the first adjustment value is greater than the second adjustment value, and the eighth preset parameter is less than the fifth preset parameter.
10. The method of claim 1, further comprising:
acquiring a weighting coefficient, an intensity coefficient, the width of video data, the length of the video data, the width of the target area and the length of the target area;
determining the first ROI QP value according to the weighting coefficient, the intensity coefficient, the width of the video data, the length of the video data, the width of the target region and the length of the target region; the first ROI QP value is inversely proportional to the intensity coefficient;
the adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value comprises the following steps:
and adjusting the intensity coefficient according to the first quality parameter and the second quality parameter, and determining the second ROI QP value according to the adjusted intensity coefficient.
11. The method of claim 10, wherein determining the ROI QP value based on the weighting factor for the ROI QP value, the intensity factor for the ROI QP value, the width of the video data, the length of the video data, the width of the target region, and the length of the target region comprises:
determining the ROI QP value using the following formula:
Figure FDA0002527225670000041
wherein α represents a weighting coefficient of the ROI QP value, β represents an intensity coefficient of the ROI QP value, video represents a width of the video data, video represents a length of the video data, roiW represents a width of the target region, and roiH represents a length of the target region.
12. The method of claim 1, wherein if the second video data satisfies a first adjustment condition, adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value, comprising:
and if the second video data meet a first adjusting condition, calling a parameter adjusting model, and adjusting the first ROI QP value according to the first quality parameter and the second quality parameter to obtain an adjusted second ROI QP value.
13. The method of claim 12, further comprising:
obtaining a first sample quality parameter, a second sample quality parameter and a sample ROI QP value of sample video data; the first sample quality parameter is a quality parameter of any sample video data in the sample video data, the second sample quality parameter is a quality parameter of a target area in the sample video data, and the sample ROI QP value is an ROI QP value adopted when the sample video data is coded;
and training the parameter adjustment model according to the first sample intrinsic quantity parameter, the second sample quality parameter and the sample ROI QP value to obtain a trained parameter adjustment model.
14. The method of claim 13, wherein obtaining the first sample quality parameter, the second sample quality parameter, and the sample ROI QP value for the sample video data comprises:
obtaining a first sample intrinsic quality parameter, a second sample quality parameter and a sample ROI QP value of the sample video data, as well as a code rate adopted by the sample video data, a pixel value of an outline area of the sample video data and a motion vector between the sample video data and previous video data;
the training the parameter adjustment model according to the first sample intrinsic quality parameter, the second sample quality parameter and the sample ROI QP value to obtain a trained parameter adjustment model, comprising:
and training the parameter adjustment model according to the first sample intrinsic quality parameter, the second sample quality parameter, the sample ROI QP value, the code rate adopted by the sample video data, the pixel value of the outline area of the sample video data and the motion vector between the sample video data and the previous video data to obtain a trained quality parameter model.
15. The method of claim 14, wherein the obtaining pixel values of the outline region of the sample video data comprises:
extracting a contour region in the sample video data by adopting an edge contour extraction algorithm;
and acquiring the average value of the pixel values of a plurality of pixel points in the contour region, and determining the average value as the pixel value of the contour region.
16. The method of claim 14, wherein obtaining the motion vector between the sample video data and previous video data comprises:
acquiring a first motion intensity of the sample video data and a second motion intensity of a previous video data of the sample video data;
and acquiring a motion vector between the sample video data and the previous video data according to the first motion intensity and the second motion intensity.
17. The method of claim 16, wherein said obtaining a first motion intensity of the sample video data comprises:
determining a position vector of each pixel block in a plurality of pixel blocks according to the position of each pixel block in the sample video data;
determining a sum of squares of the position vectors of each of the pixel blocks as the first motion strength.
18. A video adaptation apparatus, characterized in that the apparatus comprises:
the coding and decoding module is used for coding the first video data by adopting a first ROI QP value and then decoding the first video data to obtain second video data;
the quality acquisition module is used for acquiring a first quality parameter of the second video data and a second quality parameter of a target area in the second video data according to the first video data and the second video data;
and the adjusting module is used for adjusting the first ROI QP value according to the first quality parameter and the second quality parameter when the second video data meets a first adjusting condition to obtain an adjusted second ROI QP value, wherein the first adjusting condition comprises that the first quality parameter is greater than a first preset parameter and less than a second preset parameter, or the second quality parameter is greater than a third preset parameter, or the second quality parameter is less than at least one of fourth preset parameters, the first preset parameter is less than the second preset parameter, and the third preset parameter is greater than the fourth preset parameter.
19. A computer device comprising a processor and a memory, the memory having stored therein at least one instruction, the at least one instruction being loaded and executed by the processor to perform operations performed in the video adaptation method of any of claims 1 to 17.
20. A computer-readable storage medium having stored therein at least one instruction, which is loaded and executed by a processor, to implement the operations performed in the video adaptation method according to any one of claims 1 to 17.
CN202010507974.4A 2020-06-05 2020-06-05 Video adjusting method and device, computer equipment and storage medium Active CN111586413B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010507974.4A CN111586413B (en) 2020-06-05 2020-06-05 Video adjusting method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010507974.4A CN111586413B (en) 2020-06-05 2020-06-05 Video adjusting method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111586413A true CN111586413A (en) 2020-08-25
CN111586413B CN111586413B (en) 2022-07-15

Family

ID=72125576

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010507974.4A Active CN111586413B (en) 2020-06-05 2020-06-05 Video adjusting method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111586413B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115225961A (en) * 2022-04-22 2022-10-21 上海赛连信息科技有限公司 No-reference network video quality evaluation method and device
CN115908503A (en) * 2023-01-30 2023-04-04 沐曦集成电路(南京)有限公司 Game video ROI detection method and system
WO2023082904A1 (en) * 2021-11-09 2023-05-19 京东科技信息技术有限公司 Video encoding method and apparatus

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103369349A (en) * 2012-03-28 2013-10-23 中国移动通信集团公司 Digital video quality control method and device thereof
CN108810538A (en) * 2018-06-08 2018-11-13 腾讯科技(深圳)有限公司 Method for video coding, device, terminal and storage medium
CN109660801A (en) * 2018-11-08 2019-04-19 建湖云飞数据科技有限公司 The method for video coding that quantization parameter is limited
US20190238849A1 (en) * 2018-01-31 2019-08-01 Qualcomm Incorporated Delta quantization parameter (qp) coding options for video
CN110267037A (en) * 2019-06-21 2019-09-20 腾讯科技(深圳)有限公司 Method for video coding, device, electronic equipment and computer readable storage medium
CN111131825A (en) * 2019-10-28 2020-05-08 华为技术有限公司 Video processing method and related device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103369349A (en) * 2012-03-28 2013-10-23 中国移动通信集团公司 Digital video quality control method and device thereof
US20190238849A1 (en) * 2018-01-31 2019-08-01 Qualcomm Incorporated Delta quantization parameter (qp) coding options for video
CN108810538A (en) * 2018-06-08 2018-11-13 腾讯科技(深圳)有限公司 Method for video coding, device, terminal and storage medium
CN109660801A (en) * 2018-11-08 2019-04-19 建湖云飞数据科技有限公司 The method for video coding that quantization parameter is limited
CN110267037A (en) * 2019-06-21 2019-09-20 腾讯科技(深圳)有限公司 Method for video coding, device, electronic equipment and computer readable storage medium
CN111131825A (en) * 2019-10-28 2020-05-08 华为技术有限公司 Video processing method and related device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023082904A1 (en) * 2021-11-09 2023-05-19 京东科技信息技术有限公司 Video encoding method and apparatus
CN115225961A (en) * 2022-04-22 2022-10-21 上海赛连信息科技有限公司 No-reference network video quality evaluation method and device
CN115225961B (en) * 2022-04-22 2024-01-16 上海赛连信息科技有限公司 No-reference network video quality evaluation method and device
CN115908503A (en) * 2023-01-30 2023-04-04 沐曦集成电路(南京)有限公司 Game video ROI detection method and system

Also Published As

Publication number Publication date
CN111586413B (en) 2022-07-15

Similar Documents

Publication Publication Date Title
CN110881136B (en) Video frame rate control method and device, computer equipment and storage medium
CN110502954B (en) Video analysis method and device
CN111372126B (en) Video playing method, device and storage medium
CN108401124B (en) Video recording method and device
CN110022489B (en) Video playing method, device and storage medium
CN111586413B (en) Video adjusting method and device, computer equipment and storage medium
CN109120933B (en) Method, device and equipment for dynamically adjusting code rate and storage medium
CN112907725B (en) Image generation, training of image processing model and image processing method and device
CN111586431B (en) Method, device and equipment for live broadcast processing and storage medium
CN111753784A (en) Video special effect processing method and device, terminal and storage medium
CN113038165B (en) Method, apparatus and storage medium for determining encoding parameter set
CN111813367A (en) Method, device and equipment for adjusting volume and storage medium
CN111586444B (en) Video processing method and device, electronic equipment and storage medium
CN111083554A (en) Method and device for displaying live gift
CN107888975B (en) Video playing method, device and storage medium
CN110543403B (en) Power consumption assessment method and device
CN112419143A (en) Image processing method, special effect parameter setting method, device, equipment and medium
CN112235650A (en) Video processing method, device, terminal and storage medium
CN111586433B (en) Code rate adjusting method, device, equipment and storage medium
CN108540732B (en) Method and device for synthesizing video
CN112153404B (en) Code rate adjusting method, code rate detecting method, code rate adjusting device, code rate detecting device, code rate adjusting equipment and storage medium
CN109040753B (en) Prediction mode selection method, device and storage medium
CN114384466A (en) Sound source direction determining method, sound source direction determining device, electronic equipment and storage medium
CN110109813B (en) Information determination method and device for GPU (graphics processing Unit) performance, terminal and storage medium
CN111757146B (en) Method, system and storage medium for video splicing

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