WO2020062184A1 - Image processing method and device, movable platform and storage medium - Google Patents

Image processing method and device, movable platform and storage medium Download PDF

Info

Publication number
WO2020062184A1
WO2020062184A1 PCT/CN2018/108866 CN2018108866W WO2020062184A1 WO 2020062184 A1 WO2020062184 A1 WO 2020062184A1 CN 2018108866 W CN2018108866 W CN 2018108866W WO 2020062184 A1 WO2020062184 A1 WO 2020062184A1
Authority
WO
WIPO (PCT)
Prior art keywords
frame
code stream
target
frames
idr
Prior art date
Application number
PCT/CN2018/108866
Other languages
French (fr)
Chinese (zh)
Inventor
刘细华
Original Assignee
深圳市大疆创新科技有限公司
大疆互娱科技(北京)有限公司
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 深圳市大疆创新科技有限公司, 大疆互娱科技(北京)有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to CN201880037071.5A priority Critical patent/CN110741647A/en
Priority to PCT/CN2018/108866 priority patent/WO2020062184A1/en
Publication of WO2020062184A1 publication Critical patent/WO2020062184A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/184Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being bits, e.g. of the compressed video stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • 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

Definitions

  • the present invention relates to the field of computer technology, and in particular, to an image processing method, device, movable platform, and storage medium.
  • GDR Gradual Decoding Refresh
  • the receiving device Due to the characteristics of the inter-frame encoding frame used to record the difference between the current frame and the previous frame, after the receiving device receives and stores the bit stream transmitted via GDR, if the receiving device needs to perform image processing operations such as editing or random position playback of the original video , It needs to be decoded frame by frame for the code stream transmitted through GDR, which results in low image processing efficiency.
  • Embodiments of the present invention provide an image processing method, a device, a movable platform, and a storage medium, which are beneficial to improving image processing efficiency.
  • a first aspect of an embodiment of the present invention is to provide an image processing method, including:
  • the original code stream of the target video file where the original code stream includes the code streams of multiple frames obtained by encoding the target video file, and the first frame in the frame sequence corresponding to any one of the multiple frames is intra-frame encoding Frames, other frames are inter-coded frames;
  • a second aspect of an embodiment of the present invention is another image processing method provided, including:
  • a third aspect of the embodiments of the present invention is still another image processing method, including:
  • a fourth aspect of the embodiments of the present invention is to provide an image processing apparatus, including:
  • the memory is used to store program code
  • the processor calls the program code, and when the program code is executed, is used to perform the following operations:
  • the original code stream of the target video file where the original code stream includes the code streams of multiple frames obtained by encoding the target video file, and the first frame in the frame sequence corresponding to any one of the multiple frames is intra-frame encoding Frames, other frames are inter-coded frames;
  • a fifth aspect of the embodiments of the present invention provides another image processing apparatus, including:
  • the memory is used to store program code
  • the processor calls the program code, and when the program code is executed, is used to perform the following operations:
  • Obtaining a current code stream of a target video file where the current code stream is a code stream including at least one inter-coded frame and at least two instant decoding refresh IDR frames;
  • a sixth aspect of the embodiments of the present invention provides another image processing apparatus, including:
  • the memory is used to store program code
  • the processor calls the program code, and when the program code is executed, is used to perform the following operations:
  • a power system mounted on the fuselage and configured to provide power to the movable platform
  • the image processing method, device, and mobile platform provided by the embodiments of the present invention can obtain the decoded data of each frame included in the original bitstream by decoding the obtained original bitstream of the target video file, so as to further analyze the original bitstream.
  • the decoded data is encoded to obtain the current code stream of the target video file, so that the user can decode the image of any position in the target video file and obtain the position according to the intra-coded frames and IDR frames included in the current code stream.
  • the corresponding decoded image makes the image processing efficiency improve.
  • FIG. 1 is a schematic flowchart of an image processing method according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of an image processing method according to another embodiment of the present invention.
  • FIG. 3 is a schematic flowchart of an image processing method according to another embodiment of the present invention.
  • FIG. 4 is a schematic diagram of an original code stream provided by an embodiment of the present invention.
  • 5a is a schematic diagram of a target frame sequence according to an embodiment of the present invention.
  • 5b is a schematic diagram of a target frame sequence according to another embodiment of the present invention.
  • FIG. 6 is a schematic diagram of an image processing method according to an embodiment of the present invention.
  • FIG. 7 is a schematic flowchart of an image processing method according to another embodiment of the present invention.
  • FIG. 8 is a schematic block diagram of an image processing apparatus of a movable platform provided by an embodiment of the present invention.
  • FIG. 9 is a schematic block diagram of an image processing apparatus of a movable platform according to another embodiment of the present invention.
  • FIG. 10 is a schematic block diagram of an image processing apparatus of a movable platform according to another embodiment of the present invention.
  • a component when a component is called “fixed to” another component, it may be directly on another component or a centered component may exist. When a component is considered to be “connected” to another component, it can be directly connected to another component or a centered component may exist at the same time.
  • the image processing method, device, and mobile platform provided by the embodiments of the present invention can obtain the decoded data of each frame included in the original bitstream by decoding the obtained original bitstream of the target video file, so as to further analyze the original bitstream.
  • the decoded data is encoded to obtain the current code stream of the target video file, so that the user can decode the image of any position in the target video file and obtain the position according to the intra-coded frames and IDR frames included in the current code stream.
  • the corresponding decoded image makes the image processing efficiency improve.
  • the original bitstream of the transmitted video file (such as the target video file) includes only frames.
  • Inter-coded frames such as B-frames and / or P-frames, excluding intra-frame coded frames, which may be, for example, I-frames and / or instantaneous decode refreshes IDR frame (Instantaneous Decoding, Refresh, Fram, IDR frame), in one embodiment, I frame, which is a kind of independent ordinary intra frame encoded I frame with all the information, ordinary I frame can be independently decoded, without reference to other frames The decoded image is obtained.
  • the first ordinary I frame is an IDR frame.
  • the role of the IDR frame is to refresh immediately. Since a new sequence is recalculated from the IDR frame to start encoding, sequence errors do not continue to propagate during decoding, and I Frames do not have the capability of random access, this function is only undertaken by the IDR.
  • IDR frames will cause DPB (Decoded Picture Buffer, Reference Frame List) to be emptied, but I frames will not.
  • IDR frames must be I frames, but I frames are not necessarily IDR frames.
  • the P frame is a forward predictive coding frame, and the P frame represents the difference between this frame and the previous frame. Therefore, when decoding a P frame to obtain a decoded image, the image needs to be decoded from the beginning until it is decoded to P The decoded image is obtained at the corresponding position of the frame; the B frame is a bidirectional predictive interpolation coded frame. The B frame records the difference between the current frame and the previous and subsequent frames. When decoding the B frame to decode the image, you need to refer to the code before and after the B frame. Stream and decode to get the decoded image corresponding to the B frame.
  • the data size of each frame is relatively stable, but only the first frame in the original code stream is an intra-coded frame.
  • Mobile terminals such as drones
  • After decoding the original bitstream if you want to decode a part of the file to obtain a decoded image, you must decode from the first intra-coded frame to the frame position corresponding to the required decoded image. It can be seen that the code that uses GDR for image transmission When decoding a stream, decoding at any position in the target video file needs to refer to the first intra-coded frame of the corresponding sequence, resulting in inefficient decoding of the video file.
  • the present invention proposes an image processing method, which can replace one or more inter-encoded frames in the H264 code stream transmitted by the GDR image with intra-encoded frames ( (Ie IDR frame), so that when the mobile platform decodes frames at any position in the H264 code stream, it does not need to refer to the first intra-coded frame in the sequence every time, and it can start decoding from the middle position of the H264 code stream.
  • Ie IDR frame intra-encoded frames
  • the movable platform When the movable platform detects that the encoder is initialized, it obtains the original code stream of the target video file and determines the original code. The stream is decoded to obtain decoded data.
  • the decoded data may be, for example, YUV data, so as to determine whether the data amount of the obtained decoded data meets a preset condition.
  • the preset condition may be, for example, a multiple of 45 frames.
  • YUV data is a color coding method, which is mainly used in the field of television systems and analog video. It refers to separating luminance parameters (Y: Luminance or Luma) and chrominance parameters (UV: Chrominance or Chroma). The pixel encoding format for the representation.
  • the corresponding encoder when the mobile platform performs an encoding operation, may be initialized according to the first parameter information of the H264 stream data, where the first parameter information includes a sequence parameter set SPS (Sequence Paramater Set, SPS) and picture parameter set PPS (Picture, Paramter Set, PPS).
  • SPS Sequence Paramater Set
  • PPS Picture parameter set
  • the encoder is initialized, the SPS and PPS data such as profile, level, num_ref_frames, pic_init_qp_minus26 and other parameters must be completely consistent, and then set the encoder to encode YUV data as For IDR frames, the encoded data needs to be reparsed and repacked according to the SPS and PPS of the original bitstream, and then stored in the storage medium.
  • Subsequent stream data may be changed due to the insertion of a new IDR frame and log2_max_frame_num_minus4. You need to parse and update frame_num, modify it to new parameters, and then packetize it. Finally, mux becomes a playable mp4 file.
  • the above encoder may be implemented by software encoding, and the above software encoding may be libx264 or openh26, or any other software encoding scheme.
  • the general display saving process includes four major modules: split analysis, decoder decoding, display, and encoder re-encoding.
  • the data parsing module receives the stream of H264 packets, it needs to unpack and merge the same frame of the stream into a complete stream data packet to prepare the decoder for decoding; the decoder module receives the stream data Then, according to the normal decoding sequence and decoding logic, the code stream data is decoded into the correct YUV data; then the display module converts the YUV data into RGB data that the display can normally display, and displays it on the display end; finally the encoder re-encodes the module The YUV data decoded by the decoder is re-encoded into a H264 code stream.
  • the working mode of the encoder re-encoding module is: the encoder needs some information related to the original code stream, because the original code stream is not completely re-encoded, but only re-encoded after a certain data frame, generally
  • the encoder needs some information related to the original code stream, because the original code stream is not completely re-encoded, but only re-encoded after a certain data frame, generally
  • This time interval is generally 1-2s.
  • the value can be 1.5. s.
  • an IDR frame is required approximately every 45 frames, that is, every 45 frames, the decoded YUV data is re-encoded.
  • the encoder may perform specific steps when re-encoding: the first frame of the original H264 code stream and the decoded YUV data are transmitted to the encoding module at the same time. If the encoder has not been initialized, the SPS in the H264 code stream is used And / or PPS information, initialize the encoder to encode YUV data, generate new H264 data, modify the new H264's packet parameters and repack with the parameters of the original stream, and hand them to the multiplexer (mux, mux ) The module writes to the file. If the number of frames is not a multiple of 45, modify the parameters of the old code stream, such as frame_num and other parameters, then perform entropy encoding, and then write to the file by mux.
  • the image processing method of the movable platform in the embodiment of the present invention is described as an example below.
  • FIG. 2 is a flowchart of an image processing method for a mobile platform according to an embodiment of the present invention. As shown in FIG. 2, the method includes the following steps:
  • S201 Obtain an original code stream of a target video file, where the original code stream includes code streams of multiple frames obtained by encoding the target video file, and any one of the multiple frames corresponds to a first frame in a frame sequence as a frame. Intra-coded frames, other frames are inter-coded frames.
  • the mobile platform can obtain the original code stream of the target video file transmitted through GDR (Gradual Decoding, Refresh, GDR), and can use the GDR format to encode the transmitted target video file.
  • the original code stream Corresponds to the H264 code stream, in which the GDR is completely refreshed from a frame, which realizes the gradual refresh by the method of P frames including I block groups, which will bring better network adaptability.
  • the first frame of any frame sequence is an intra-frame encoded frame, such as an I frame, and the other frames are inter-frame encoded frames, such as a P frame and / or a B frame.
  • inter-coded frames such as B-frames and / or P-frames
  • the mobile platform decodes any frame sequence in the original code stream to obtain a decoded image.
  • the frame to be decoded may be the closest I to the frame to be decoded.
  • the number of frames spaced between frames is large, which results in a low decoding efficiency of the mobile platform for the decoded frames, making the mobile platform's random access speed to the target video file lower, and weakening the user experience. Therefore, subsequent steps S202 and S203 may be performed to obtain a new code stream (that is, the current code stream), thereby improving the access speed of the target video file.
  • intra-coded frames can be independently decoded, and the characteristics of decoded images can be obtained without reference to other frames.
  • Intra-coded frames can be inserted into the original code stream. Therefore, in order to achieve The intra-coded frame is inserted into the original code stream to achieve random access to the target video file. After the original code stream is obtained, the original code stream is decoded to obtain decoded data of each of the multiple frames. .
  • the decoded data may be, for example, YUV data, and the YUV data may be converted into RGB data that can be normally displayed by a display and displayed on the display end.
  • the movable platform may The target video file is re-encoded, that is, S203 is performed instead, and an intra-coded frame is inserted into the current code stream obtained by re-encoding the target video file.
  • the original code stream When the original code stream is decoded, the original code stream may be parsed and processed to obtain the code stream of each frame, so that the code stream of each frame may be decoded and decoded for each of the frames. data.
  • S203 Encode the decoded data according to the first parameter information of the original code stream to obtain a current code stream of the target video file, where the current code stream includes at least one inter-encoded frame and at least two Instant decoding refreshes the bit stream of the IDR frame.
  • the first parameter information includes code stream parameters, such as sequence parameter set SPS and / or image parameter set PPS, used to encode decoded data, and the sequence parameter set SPS and / or image parameter set PPS Both are important parameter sets in the H264 stream, and are saved together in the header file of the video file.
  • code stream parameters such as sequence parameter set SPS and / or image parameter set PPS
  • the sequence parameter set SPS contains parameters for a continuously encoded video sequence, such as frame number, reference frame number, decoded image Size and frame field coding mode selection identification;
  • the image parameter set PPS corresponds to a certain image or several images in a sequence, parameters such as identifier, entropy encoding mode selection identification, number of slices, initial quantization parameters Wait, if there is no PPS or SPS in the H264 stream, the decoder will not be able to parse the stream data, which will cause the target video file to be unplayable.
  • the related parameters included in the PPS and / or SPS may also be used to initialize an encoder, so that the encoder re-encodes decoded data (such as YUV data) obtained by decoding the original bitstream.
  • decoded data such as YUV data
  • the interval at which each frame sequence is inserted into the intra-coded frame can be determined, and the decoded data at the corresponding position is encoded into the intra-frame based on the interval Encode frames so that each frame sequence includes at least two intra-encoded frames.
  • the two intra-encoded frames included can be, for example, instant decode refresh IDR frames, and other frames of the current code stream obtained by re-encoding are intra.
  • Encoded frames such as the P and / or B frames described above.
  • the current bitstream obtained after encoding the decoded data includes at least two IDR frames, based on the characteristics of the IDR frame immediately refreshed, when decoding any frame to be decoded in the frame sequence to obtain a decoded image, refer to the frame sequence
  • the IDR frame closest to the frame to be decoded, and decoding is started from the latest IDR frame until it is decoded to the corresponding position of the frame to be decoded, so that the decoded image corresponding to the frame to be decoded can be decoded without using the original stream frame sequence
  • the first intra-coded frame is decoded to obtain a decoded image, which realizes random access to the target video file and can improve the processing efficiency of the image.
  • the image processing method, device, and mobile platform provided by the embodiments of the present invention can obtain the decoded data of each frame included in the original bitstream by decoding the obtained original bitstream of the target video file, so as to further analyze the original bitstream.
  • the decoded data is encoded to obtain the current code stream of the target video file, so that the user can decode the image of any position in the target video file and obtain the position according to the intra-coded frames and IDR frames included in the current code stream.
  • the corresponding decoded image makes the image processing efficiency improve.
  • FIG. 3 is a flowchart of an image processing method for a mobile platform according to another embodiment of the present invention. As shown in FIG. 3, the method includes the following steps:
  • S301-S302 can be referred to the descriptions of S201-S202, which will not be repeated here.
  • the specific execution steps are:
  • the target frame sequence is any frame sequence in the original code stream of the target video file.
  • the length of the target frame sequence refers to the target frame sequence.
  • the number of all frames included in the frame, the length of the target frame sequence corresponds to the playback duration of the target video file means: the duration required to finish playing all the frames in the target frame sequence, correspondingly, the first
  • the insertion period is a time period. For example, if the length of the target frame sequence corresponds to a playback duration of the target video file of 2 seconds, the first insertion period may correspond to 1s or 1.5s, etc.
  • the target frame sequence length corresponds to the playback duration of the target video file and the first insertion cycle, and a target frame that needs to be encoded into an IDR frame is determined from the plurality of frames.
  • the original bitstream of any of the target video files includes at least one frame sequence
  • the at least one frame sequence may be determined by the first parameter information (the first (The parameter information includes PPS and / or SPS), and / or the at least one frame sequence may also be distinguished by second parameter information included in the code stream, and when distinguished by the second parameter information,
  • the second parameter information may be set to 0 to identify a start position of each frame sequence included in the code stream.
  • the mobile platform when the mobile platform determines a target frame that needs to be encoded into an IDR frame among the multiple frames, it may further perform steps:
  • S23 Determine a target frame to be encoded into an IDR frame among the multiple frames according to the second insertion period and the sum of the number of frames.
  • the total number of frames of the target frame sequence refers to: the number of all frames included in the target frame sequence.
  • coding needs to be obtained according to the total number of frames of the target frame sequence.
  • the second insertion cycle of the completed IDR frame in the target frame sequence is a frame number cycle.
  • the second insertion cycle refers to the insertion of a target frame sequence every frame number indicated by the second insertion cycle.
  • the IDR frame is to determine the position of the IDR frame to be encoded in the multiple frames, that is, to determine the target frame to be encoded into the IDR frame in the multiple frames.
  • the total number of frames of the target frame sequence is assumed to be 50, and the corresponding second insertion period is 45 or the like.
  • the mobile platform when the mobile platform determines a target frame to be encoded into an IDR frame among the multiple frames, it may further perform steps:
  • s32 Determine a target frame to be encoded into an IDR frame among the multiple frames according to a sum of the third insertion period and the number of the multiple frames.
  • the number of frames spaced between any two IDR frames inserted may also be determined according to the total number of frames included in the code stream, that is, among multiple frames of the original code stream. , Inserting at least one IDR frame according to the third insertion period.
  • S304 may be performed again.
  • a step may be performed first: determining that the length of the target frame sequence corresponds to the playback duration of the target video file divided by the first Whether the first remainder obtained during an insertion period is zero; when the first remainder is not zero, the IDR frame (that is, the IDR frame that needs to be encoded) required for insertion determined according to the first insertion period is described
  • the position cannot guarantee that the required IDR frame is inserted in each insertion cycle and / or each frame sequence, and then the second parameter information of the original code stream needs to be adjusted, and the second parameter information is adjusted, that is, The position where the required IDR frame is inserted is adjusted, that is, the target frame that needs to be encoded into the IDR frame is re-determined among the multiple frames.
  • the second parameter information corresponding to the position where the required IDR frame is inserted may be set to 0, and the second parameter information corresponding to the frame after the required IDR frame that is
  • the decoded data of the target frame at the determined position may be performed according to the first parameter information of the original code stream and the adjusted second parameter information of the original code stream. Encoding to obtain the code stream of the at least one IDR frame, and inserting the obtained code stream of the at least one IDR frame into a desired position.
  • the target frame sequence length is 50, and if the target frame sequence length corresponds to the playback time of the target video file is 3 seconds, the required The first insertion cycle of the IDR frame in the target frame sequence is 1.2 seconds, because the length of the target frame sequence corresponds to the playback duration of the target video file of 2 seconds divided by the first insertion cycle of 1.2 seconds If the remainder is not 0, the second parameter information of the original bitstream is adjusted.
  • the adjusted second parameter information of the target frame sequence may be as shown in FIG. 5b. As shown in FIG. 5b, The position of the target frame sequence whose original second parameter information is 45 is adjusted to 0, and the second parameter information of the subsequent frame position is modified. In one embodiment, the position adjusted to 0 is the IDR frame inserted. Position, that is, the position in the original code stream where the target frame to be encoded into the IDR frame is located.
  • a step may further be performed: determining the total number of frames of the target frame sequence divided by the second insertion period. Whether the second remainder is zero; when the second remainder is not zero, it also indicates that the position of the IDR frame required for insertion determined according to the second insertion period cannot guarantee each insertion period and / or each frame
  • the required IDR frames are inserted in the sequence, and the second parameter information of the original bitstream needs to be adjusted.
  • the second parameter information corresponding to the position corresponding to the required IDR frame may also be inserted. Set it to 0, and sequentially adjust the second parameter information corresponding to the second parameter information corresponding to the frame after the inserted required IDR frame.
  • the frames at the determined positions may also be paired according to the first parameter information of the original code stream and the adjusted second parameter information of the original code stream.
  • Encode the decoded data to obtain a code stream of at least one IDR frame, and insert the obtained code stream of the at least one IDR frame into a desired position.
  • the second parameter information may be, for example, fram_num, and the modification process of the second parameter information may refer to the description in FIG. 5a and FIG. 5b, and details are not described herein again.
  • a step may further be performed: determining a sum of the number of the plurality of frames divided by a third remainder obtained by a third insertion cycle. Whether it is 0, and when the third is then not 0, adjusting the second parameter information of the original code stream so that the sum of the number of the plurality of frames divided by the adjusted third insertion period is the remainder It is 0, that is, IDR frames are inserted at a certain interval among multiple frames of the original code stream, and the interval may be 45, for example.
  • the movable platform executes S304, first obtain the first parameter information of the code stream of the first frame in the frame sequence corresponding to the multiple frames of the original code stream, and according to the first of the code streams of the first frame, Parameter information to initialize the encoder; and then use the encoder after the initialization process to encode the decoded data of the target frame to obtain an updated code stream, so that it can be based on the first parameter information of the original code stream,
  • the first parameter information of the updated code stream is adjusted, and the updated code stream is further encapsulated according to the adjusted first parameter information, so as to obtain a code stream of at least one IDR frame.
  • the first remainder when the first remainder is not zero, it can be further judged whether the insertion position corresponding to the first insertion period is an intra-coded frame. If so, the original code stream is indicated according to the first insertion period. There are already one or more intra-frame encoding frames in the determined insertion position, so it is not necessary to re-insert IDR frames at this insertion position, so the corresponding positions of the existing intra-frame encoding frames in the original code stream are not required. If the second parameter information of the original bitstream is not adjusted, the second parameter information of the original bitstream is adjusted. If the second remainder or the third remainder is not zero, the adjustment may also be performed. First determine whether there is an intra-coded frame at the insertion position determined according to the second insertion cycle or the insertion position determined according to the third insertion cycle, and if not, perform the above-mentioned step of adjusting the second parameter information.
  • each frame sequence included in the original bitstream may be processed sequentially according to the foregoing steps.
  • the encoder Before processing any frame sequence, the encoder needs to be processed according to the first parameter information corresponding to the sequence. Initialization processing.
  • the current code stream including the IDR frame can also be entropy-coded, so that a multiplexer (mux) is written to a file for storage.
  • a multiplexer multiplexer
  • the decoded data of the target frame is encoded according to the first parameter information of the original code stream to obtain a code stream of at least one IDR frame, so that the code of the at least one IDR frame can be
  • the position of the target frame in the original bitstream is replaced by the stream to obtain the current bitstream of the target video file, so that the target video file can be decoded according to the IDR frame included in the current bitstream to quickly obtain a decoded image and improve The efficiency of image processing.
  • the mobile device may obtain the target video file from a device (such as a camera) or a module having a video camera function, and perform the image processing method according to the image processing method shown in FIG. 2 or FIG. 3.
  • the target video file is processed to obtain a current bitstream of the target video file.
  • decoding starts with the first IDR frame before the target frame, and With reference to the inter-encoded frame between the target true and the first IDR frame, the decoded image corresponding to the target frame is decoded to achieve fast decoding of the target video file's current bitstream at any position, thereby improving mobility Image processing efficiency of the terminal.
  • the device with a video camera function may be, for example, a smart terminal that establishes a communication connection with the mobile platform, such as a smart phone, a tablet computer, or a smart wearable device.
  • the movable platform may be, for example, a drone or a car.
  • the movable platform and the device with a video camera function are not limited.
  • the movable platform obtains a current stream of a target video file, and when a selection operation of a target frame in the target video file is detected, it is determined to be located before the target frame.
  • the first IDR frame and the inter-frame encoded frame between the target frame and the IDR frame decode the code stream of the target frame to obtain the image corresponding to the target frame, and achieve the target frame at any position in the current code stream Fast decoding, because the decoding of a target frame at an arbitrary position can no longer refer to the first intra-coded frame of the frame sequence corresponding to the target frame, which improves the image processing efficiency of the mobile platform.
  • the method includes the following steps:
  • a target frame that needs to be encoded into an instant decoding and refreshing IDR frame is determined according to an effect position of the selected operation on an original bitstream of the target video file.
  • S702 Perform decoding processing on the original code stream until the decoded data of the target frame is obtained.
  • S703 Encode the decoded data of the target frame according to the first parameter information of the original code stream to obtain the current code stream of the target frame.
  • S704 Replace the code stream of the target frame in the original code stream with the current code stream to obtain the current code stream of the target video file.
  • the selected operation may be sent to the mobile platform by a smart terminal that establishes a communication connection with the mobile platform, or may be a selected operation directly acting on the mobile platform.
  • the detection of the selection operation of the target video file indicates that the user has a need to edit the target file.
  • the selection operation inserts an IDR frame at the position of the original stream of the target video file.
  • the position at which the selected operation acts is the desired position for inserting the IDR frame
  • the frame that the selected operation plays in the original code stream is the target frame for inserting the IDR frame. Therefore, at the desired position When inserting an IDR frame, only the original code stream can be decoded to the target frame to obtain the target frame and the decoded data of all frames before the target frame, so that the target frame can be decoded according to the first parameter information of the original code stream
  • the data is encoded to obtain the current code stream of the target frame, so that the target code stream in the original code stream can be replaced with the re-encoded current code stream to obtain the current code stream of the target video file, according to the actual needs of users Processing of the target video file.
  • the movable platform when the movable platform detects the selected operation on the target video file, it can determine the action position of the selected operation on the original stream of the target video file, that is, determine the selected operation.
  • the original code stream After the target frame acting in the original code stream, the original code stream is decoded until the decoded data of the target frame is obtained, and then the decoded data is encoded and processed according to the first parameter information to obtain the current code stream of the target frame.
  • the bitstream of the target frame in the original bitstream is replaced with the current bitstream obtained by re-encoding, which realizes the personalized processing of the target video file according to user needs and improves user satisfaction.
  • FIG. 8 is a structural diagram of an image processing apparatus of a movable platform provided by an embodiment of the present invention.
  • the image processing apparatus 800 of the movable platform includes The memory 801 and the processor 802.
  • the memory 802 stores program code.
  • the processor 802 calls the program code in the memory.
  • the processor 802 performs the following operations:
  • the original code stream of the target video file where the original code stream includes the code streams of multiple frames obtained by encoding the target video file, and the first frame in the frame sequence corresponding to any one of the multiple frames is intra-frame encoding Frames, other frames are inter-coded frames;
  • the first parameter information includes a sequence parameter set SPS and / or an image parameter set PPS
  • the processor 802 encodes the decoded data according to the first parameter information of the original code stream, When the current bitstream of the target video file is obtained, the following operations are performed:
  • the processor 802 when the processor 802 determines a target frame to be encoded into an IDR frame among the multiple frames, the processor 802 performs the following operations:
  • a target frame that needs to be encoded into an IDR frame is determined among the multiple frames.
  • processor 802 when the processor 802 calls the program code, it also performs the following operations:
  • And encoding the decoded data of the target frame according to the first parameter information of the original code stream to obtain the code stream of the at least one IDR frame includes:
  • the processor 802 when the processor 802 determines a target frame to be encoded into an IDR frame among the multiple frames, the processor 802 performs the following operations:
  • a target frame that needs to be encoded into an IDR frame is determined among the multiple frames.
  • processor 802 when the processor 802 calls the program code, it also performs the following operations:
  • the encoding the decoded data of the target frame according to the first parameter information of the original code stream to obtain the code stream of the at least one IDR frame includes:
  • the processor 802 when the processor 802 encodes the decoded data of the target frame according to the first parameter information of the original code stream to obtain the code stream of the at least one IDR frame, it performs the following operations :
  • processor 802 when the processor 802 calls the program code, it also performs the following operations:
  • the decoded data of the target frame is encoded by using the encoder after the initialization process to obtain the updated code stream.
  • processor 802 when the processor 802 calls the program code, it also performs the following operations:
  • processor 802 when the processor 802 calls the program code, it also performs the following operations:
  • Decoding the original bitstream to obtain decoded data of each of the frames includes:
  • the image processing apparatus of the movable platform provided by this embodiment can execute the image processing methods shown in FIG. 2 and FIG. 3 provided by the foregoing embodiments, and the execution manners and beneficial effects thereof are similar, and will not be repeated here.
  • FIG. 9 is a structural diagram of an image processing apparatus for a movable platform according to another embodiment of the present invention.
  • the image processing apparatus 900 includes a memory 901 and a processor 902.
  • the memory 902 stores program code.
  • the processor 902 calls the program code in the memory.
  • the processor 902 performs the following operations:
  • Obtaining a current code stream of a target video file where the current code stream is a code stream including at least one inter-coded frame and at least two instant decoding refresh IDR frames;
  • the image processing apparatus of the movable platform provided by this embodiment can execute the image processing method shown in FIG. 6 provided by the foregoing embodiment, and the execution manner and beneficial effects thereof are similar, and will not be repeated here.
  • FIG. 10 is a structural diagram of an image processing apparatus for a movable platform according to another embodiment of the present invention.
  • the image processing apparatus 100 includes a memory 101 and a processor 102.
  • the memory 102 stores program code.
  • the processor 102 calls the program code in the memory.
  • the processor 102 performs the following operations:
  • the image processing apparatus of the movable platform provided by this embodiment can execute the image processing method shown in FIG. 7 provided by the foregoing embodiment, and the execution manner and beneficial effects thereof are similar, and will not be repeated here.
  • An embodiment of the present invention further provides a movable platform.
  • the movable platform includes:
  • a power system mounted on the fuselage and configured to provide power to the movable platform
  • an image processing device of a movable platform as shown in FIG. 8 or an image processing device of a movable platform as shown in FIG. 9, or an image processing device of a movable platform as shown in FIG. 10.
  • the movable platform further includes:
  • An image sensor is mounted on the body and used to obtain a target video file.
  • the image sensor includes a video image sensor and / or a text image sensor.
  • the movable platform further includes:
  • a communication device is installed on the fuselage and is used for information interaction with the control terminal.
  • the movable platform includes at least one of the following: a drone and a car.

Abstract

Disclosed by the embodiments of the present invention are an image processing method for a movable platform, comprising: acquiring an original code stream of a target video file, the original code stream comprising code streams of multiple frames obtained by encoding the target video file, a first frame in a frame sequence corresponding to any one of the multiple frames being an intra-frame encoded frame, and the other frames being inter-frame encoded frames; decoding the original code stream to obtain decoded data of each of the frames; and encoding the decoded data according to first parameter information of the original code stream to obtain a current code stream of the target video file, wherein the current code stream is a code stream comprising at least one inter-frame encoded frame and at least two instantaneous decoding refresh (IDR) frames. Thus, the present invention is beneficial in improving the image processing efficiency of the mobile platform.

Description

一种图像处理方法、装置、可移动平台及存储介质Image processing method, device, movable platform and storage medium 技术领域Technical field
本发明涉及计算机技术领域,尤其涉及一种图像处理方法、装置、可移动平台及存储介质。The present invention relates to the field of computer technology, and in particular, to an image processing method, device, movable platform, and storage medium.
背景技术Background technique
在视频传输过程中,由于数据带宽的限制以及数据平稳性的要求,大多传输设备(例如摄像头)都采用逐渐刷新(Gradual Decoding Refresh,GDR)的图像传输方式。若视频经由GDR方式进行传输,那么得到的码流的帧类型都是帧间编码帧帧,且每帧的数据大小比较稳定,因此GDR传输方式非常适用于进行实时传输。In the video transmission process, due to the limitation of data bandwidth and the requirement of data stability, most transmission devices (such as cameras) use Gradual Decoding Refresh (GDR) image transmission methods. If the video is transmitted via the GDR method, the frame type of the resulting code stream is inter-frame coded frames, and the data size of each frame is relatively stable, so the GDR transmission method is very suitable for real-time transmission.
由于帧间编码帧用于记录当前帧与前一帧之间差异的特性,接收设备接收并存储经由GDR传输的码流后,若接收设备需要对原始视频进行剪辑或者随机位置播放等图像处理操作,需要对经由GDR传输的码流进行逐帧解码才能实现,导致图像处理效率低下。Due to the characteristics of the inter-frame encoding frame used to record the difference between the current frame and the previous frame, after the receiving device receives and stores the bit stream transmitted via GDR, if the receiving device needs to perform image processing operations such as editing or random position playback of the original video , It needs to be decoded frame by frame for the code stream transmitted through GDR, which results in low image processing efficiency.
发明内容Summary of the Invention
本发明实施例提供了一种图像处理方法、装置、可移动平台及存储介质,有利于提高图像处理效率。Embodiments of the present invention provide an image processing method, a device, a movable platform, and a storage medium, which are beneficial to improving image processing efficiency.
本发明实施例的第一方面是提供的一种图像处理方法,包括:A first aspect of an embodiment of the present invention is to provide an image processing method, including:
获取目标视频文件的原始码流,所述原始码流包括对所述目标视频文件进行编码得到的多个帧的码流,任一所述多个帧对应帧序列中第一帧为帧内编码帧,其他帧为帧间编码帧;Obtain the original code stream of the target video file, where the original code stream includes the code streams of multiple frames obtained by encoding the target video file, and the first frame in the frame sequence corresponding to any one of the multiple frames is intra-frame encoding Frames, other frames are inter-coded frames;
对所述原始码流进行解码处理,得到各个所述帧的解码数据;Decoding the original code stream to obtain decoded data of each of the frames;
根据所述原始码流的第一参数信息对所述解码数据进行编码,得到所述目标视频文件的当前码流,其中,所述当前码流为包括至少一个帧间编码帧和至少两个即时解码刷新IDR帧的码流。Encode the decoded data according to the first parameter information of the original code stream to obtain a current code stream of the target video file, where the current code stream includes at least one inter-coded frame and at least two real-time Decode the code stream of the refresh IDR frame.
本发明实施例的第二方面是提供的另一种图像处理方法,包括:A second aspect of an embodiment of the present invention is another image processing method provided, including:
获取目标视频文件的当前码流,所述当前码流为包括至少一个帧间编码帧 帧和至少两个即时解码刷新IDR帧的码流;Obtaining a current stream of a target video file, where the current stream is a stream including at least one inter-encoded frame and at least two instant decoding refresh IDR frames;
当检测到对所述目标视频文件中的目标帧的选定操作时,确定位于所述目标帧之前的第一个IDR帧,以及所述第一个IDR帧与所述目标帧之间的所有帧间编码帧;When a selection operation of a target frame in the target video file is detected, a first IDR frame located before the target frame, and all the IDR frames between the first IDR frame and the target frame are determined. Inter-frame coding
根据所述第一个IDR帧的码流、所述确定得到的帧间编码帧的码流和所述目标帧的码流,得到所述目标帧的图像。Obtaining an image of the target frame according to the code stream of the first IDR frame, the determined code stream of the inter-frame encoded frame, and the code stream of the target frame.
本发明实施例的第三方面是提供的又一种图像处理方法,包括:A third aspect of the embodiments of the present invention is still another image processing method, including:
当检测到对目标视频文件的选定操作时,根据所述选定操作在所述目标视频文件的原始码流的作用位置确定需要编码成即时解码刷新IDR帧的目标帧;When a selection operation on the target video file is detected, determining a target frame that needs to be encoded into an instant decoding refresh IDR frame according to the selected operation position of the original bitstream of the target video file;
对所述原始码流进行解码处理,直到得到所述目标帧的解码数据;Perform decoding processing on the original code stream until the decoded data of the target frame is obtained;
根据所述原始码流的第一参数信息对所述目标帧的解码数据进行编码,得到所述目标帧的当前码流;Encode the decoded data of the target frame according to the first parameter information of the original code stream to obtain the current code stream of the target frame;
将所述原始码流中所述目标帧的码流替换为所述当前码流,得到所述目标视频文件的当前码流。Replacing the stream of the target frame in the original stream with the current stream to obtain the current stream of the target video file.
本发明实施例的第四方面是提供的一种图像处理装置,包括:A fourth aspect of the embodiments of the present invention is to provide an image processing apparatus, including:
存储器和处理器;Memory and processor;
所述存储器用于存储程序代码;The memory is used to store program code;
所述处理器,调用所述程序代码,当程序代码被执行时,用于执行以下操作:The processor calls the program code, and when the program code is executed, is used to perform the following operations:
获取目标视频文件的原始码流,所述原始码流包括对所述目标视频文件进行编码得到的多个帧的码流,任一所述多个帧对应帧序列中第一帧为帧内编码帧,其他帧为帧间编码帧;Obtain the original code stream of the target video file, where the original code stream includes the code streams of multiple frames obtained by encoding the target video file, and the first frame in the frame sequence corresponding to any one of the multiple frames is intra-frame encoding Frames, other frames are inter-coded frames;
对所述原始码流进行解码处理,得到各个所述帧的解码数据;Decoding the original code stream to obtain decoded data of each of the frames;
根据所述原始码流的第一参数信息对所述解码数据进行编码,得到所述目标视频文件的当前码流,其中,所述当前码流为包括至少一个帧间编码帧和至少两个即时解码刷新IDR帧的码流。Encode the decoded data according to the first parameter information of the original code stream to obtain a current code stream of the target video file, where the current code stream includes at least one inter-coded frame and at least two real-time Decode the code stream of the refresh IDR frame.
本发明实施例的第五方面是提供的另一种图像处理装置,包括:A fifth aspect of the embodiments of the present invention provides another image processing apparatus, including:
存储器和处理器;Memory and processor;
所述存储器用于存储程序代码;The memory is used to store program code;
所述处理器,调用所述程序代码,当程序代码被执行时,用于执行以下操作:The processor calls the program code, and when the program code is executed, is used to perform the following operations:
获取目标视频文件的当前码流,所述当前码流为包括至少一个帧间编码帧帧和至少两个即时解码刷新IDR帧的码流;Obtaining a current code stream of a target video file, where the current code stream is a code stream including at least one inter-coded frame and at least two instant decoding refresh IDR frames;
当检测到对所述目标视频文件中的目标帧的选定操作时,确定位于所述目标帧之前的第一个IDR帧,以及所述第一个IDR帧与所述目标帧之间的所有帧间编码帧;When a selection operation of a target frame in the target video file is detected, a first IDR frame located before the target frame, and all the IDR frames between the first IDR frame and the target frame are determined. Inter-frame coding
根据所述第一个IDR帧的码流、所述确定得到的帧间编码帧的码流和所述目标帧的码流,得到所述目标帧的图像。Obtaining an image of the target frame according to the code stream of the first IDR frame, the determined code stream of the inter-frame encoded frame, and the code stream of the target frame.
本发明实施例的第六方面是提供的又一种图像处理装置,包括:A sixth aspect of the embodiments of the present invention provides another image processing apparatus, including:
存储器和处理器;Memory and processor;
所述存储器用于存储程序代码;The memory is used to store program code;
所述处理器,调用所述程序代码,当程序代码被执行时,用于执行以下操作:The processor calls the program code, and when the program code is executed, is used to perform the following operations:
当检测到对目标视频文件的选定操作时,根据所述选定操作在所述目标视频文件的原始码流的作用位置确定需要编码成即时解码刷新IDR帧的目标帧;When a selection operation on the target video file is detected, determining a target frame that needs to be encoded into an instant decoding refresh IDR frame according to the selected operation position of the original bitstream of the target video file;
对所述原始码流进行解码处理,直到得到所述目标帧的解码数据;Perform decoding processing on the original code stream until the decoded data of the target frame is obtained;
根据所述原始码流的第一参数信息对所述目标帧的解码数据进行编码,得到所述目标帧的当前码流;Encode the decoded data of the target frame according to the first parameter information of the original code stream to obtain the current code stream of the target frame;
将所述原始码流中所述目标帧的码流替换为所述当前码流,得到所述目标视频文件的当前码流。Replacing the stream of the target frame in the original stream with the current stream to obtain the current stream of the target video file.
本发明实施例的第七方面提供的一种可移动平台,包括:A movable platform provided by a seventh aspect of the embodiments of the present invention includes:
机身;body;
动力系统,安装在所述机身,用于为所述可移动平台提供动力;A power system mounted on the fuselage and configured to provide power to the movable platform;
以及上述第四、第五和第六方面提供的可移动平台的图像处理装置。And the image processing apparatus of the movable platform provided by the above fourth, fifth and sixth aspects.
本发明实施例提供的图像处理方法、装置及可移动平台,通过将获取的目标视频文件的原始码流进行解码处理,得到所述原始码流包括的各个帧的解码数据,从而可进一步对该解码数据进行编码,从而得到该目标视频文件的当前码流,使得用户可根据该当前码流包括的帧内编码帧以及IDR帧,实现对目 标视频文件中任何位置图像的解码,并得到该位置对应的解码图像,使得图像处理效率的提高。The image processing method, device, and mobile platform provided by the embodiments of the present invention can obtain the decoded data of each frame included in the original bitstream by decoding the obtained original bitstream of the target video file, so as to further analyze the original bitstream. The decoded data is encoded to obtain the current code stream of the target video file, so that the user can decode the image of any position in the target video file and obtain the position according to the intra-coded frames and IDR frames included in the current code stream. The corresponding decoded image makes the image processing efficiency improve.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是本发明实施例提供的一种图像处理方法的流程示意图;FIG. 1 is a schematic flowchart of an image processing method according to an embodiment of the present invention;
图2是本发明另一实施例提供的一种图像处理方法的流程示意图;2 is a schematic flowchart of an image processing method according to another embodiment of the present invention;
图3是本发明又一实施例提供的一种图像处理方法的流程示意图;3 is a schematic flowchart of an image processing method according to another embodiment of the present invention;
图4是本发明实施例提供的一种原始码流的示意图;4 is a schematic diagram of an original code stream provided by an embodiment of the present invention;
图5a是本发明实施例提供的一种目标帧序列的示意图;5a is a schematic diagram of a target frame sequence according to an embodiment of the present invention;
图5b是本发明另一实施例提供的一种目标帧序列的示意图;5b is a schematic diagram of a target frame sequence according to another embodiment of the present invention;
图6是本发明实施例提供的一种图像处理方法的示意图;6 is a schematic diagram of an image processing method according to an embodiment of the present invention;
图7是本发明又一实施例提供的一种图像处理方法的流程示意图;7 is a schematic flowchart of an image processing method according to another embodiment of the present invention;
图8是本发明实施例提供的一种可移动平台的图像处理装置的示意性框图;8 is a schematic block diagram of an image processing apparatus of a movable platform provided by an embodiment of the present invention;
图9是本发明另一实施例提供的一种可移动平台的图像处理装置的示意性框图;FIG. 9 is a schematic block diagram of an image processing apparatus of a movable platform according to another embodiment of the present invention; FIG.
图10是本发明又一实施例提供的一种可移动平台的图像处理装置的示意性框图。FIG. 10 is a schematic block diagram of an image processing apparatus of a movable platform according to another embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
需要说明的是,当组件被称为“固定于”另一个组件,它可以直接在另一个组件上或者也可以存在居中的组件。当一个组件被认为是“连接”另一个组件,它可以是直接连接到另一个组件或者可能同时存在居中组件。It should be noted that when a component is called "fixed to" another component, it may be directly on another component or a centered component may exist. When a component is considered to be "connected" to another component, it can be directly connected to another component or a centered component may exist at the same time.
除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的技术领域的技术人员通常理解的含义相同。本文中在本发明的说明书中所使用的术 语只是为了描述具体的实施例的目的,不是旨在于限制本发明。本文所使用的术语“及/或”包括一个或多个相关的所列项目的任意的和所有的组合。Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
下面结合附图,对本发明的一些实施方式作详细说明。在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。Hereinafter, some embodiments of the present invention will be described in detail with reference to the drawings. In the case of no conflict, the following embodiments and features in the embodiments can be combined with each other.
本发明实施例提供的图像处理方法、装置及可移动平台,通过将获取的目标视频文件的原始码流进行解码处理,得到所述原始码流包括的各个帧的解码数据,从而可进一步对该解码数据进行编码,从而得到该目标视频文件的当前码流,使得用户可根据该当前码流包括的帧内编码帧以及IDR帧,实现对目标视频文件中任何位置图像的解码,并得到该位置对应的解码图像,使得图像处理效率的提高。The image processing method, device, and mobile platform provided by the embodiments of the present invention can obtain the decoded data of each frame included in the original bitstream by decoding the obtained original bitstream of the target video file, so as to further analyze the original bitstream. The decoded data is encoded to obtain the current code stream of the target video file, so that the user can decode the image of any position in the target video file and obtain the position according to the intra-coded frames and IDR frames included in the current code stream. The corresponding decoded image makes the image processing efficiency improve.
当前由于数据带宽限制以及数据平稳性的要求,大多设备采用的GDR图传方式对视频文件进行传输,基于GDR图传的特性,传输的视频文件(如目标视频文件)原始码流中只包括帧间编码帧,如B帧(B Fram)和/或P帧(P Fram),而不包括帧内编码帧,所述帧内编码帧例如可以是I帧(I Frame)和/或即时解码刷新IDR帧(Instantaneous Decoding Refresh Fram,IDR帧),在一个实施例中,I帧,其是一种自带全部信息的独立普通帧内编码I帧,普通I帧可进行独立解码,无须参考其他帧并得到解码图像,首个所述普通I帧为IDR帧,IDR帧的作用是立刻刷新,由于从IDR帧开始重新算一个新的序列开始编码,使序列错误在解码时不持续传播,而I帧不具有随机访问的能力,这个功能只由IDR承担。Currently, due to data bandwidth limitations and data stability requirements, most devices use GDR image transmission to transmit video files. Based on the characteristics of GDR image transmission, the original bitstream of the transmitted video file (such as the target video file) includes only frames. Inter-coded frames, such as B-frames and / or P-frames, excluding intra-frame coded frames, which may be, for example, I-frames and / or instantaneous decode refreshes IDR frame (Instantaneous Decoding, Refresh, Fram, IDR frame), in one embodiment, I frame, which is a kind of independent ordinary intra frame encoded I frame with all the information, ordinary I frame can be independently decoded, without reference to other frames The decoded image is obtained. The first ordinary I frame is an IDR frame. The role of the IDR frame is to refresh immediately. Since a new sequence is recalculated from the IDR frame to start encoding, sequence errors do not continue to propagate during decoding, and I Frames do not have the capability of random access, this function is only undertaken by the IDR.
IDR帧会导致DPB(Decoded Picture Buffer,参考帧列表)清空,而I帧不会,其中,IDR帧一定是I帧,但I帧不一定是IDR帧。在一个实施例中,P帧为前向预测编码帧,P帧表示这一帧与前一帧之间的差别,因此解码P帧得到解码图像时,需要对图像从头开始解码,直到解码到P帧对应位置得到解码图像;B帧为双向预测内插编码帧,B帧记录有本帧与前后帧之间的差别,当解码B帧得打解码图像时,需要参考B帧之前和之后的码流,解码得到B帧对应的解码图像。IDR frames will cause DPB (Decoded Picture Buffer, Reference Frame List) to be emptied, but I frames will not. IDR frames must be I frames, but I frames are not necessarily IDR frames. In one embodiment, the P frame is a forward predictive coding frame, and the P frame represents the difference between this frame and the previous frame. Therefore, when decoding a P frame to obtain a decoded image, the image needs to be decoded from the beginning until it is decoded to P The decoded image is obtained at the corresponding position of the frame; the B frame is a bidirectional predictive interpolation coded frame. The B frame records the difference between the current frame and the previous and subsequent frames. When decoding the B frame to decode the image, you need to refer to the code before and after the B frame. Stream and decode to get the decoded image corresponding to the B frame.
采用GDR进行图传的方式,每一帧的数据大小都比较稳定,但是原始码流中只有第一帧为帧内编码帧,可移动终端(如无人机等)在接收到经由GDR 图传的原始码流后,如果要对部分文件进行解码得到解码图像,必须从第一个帧内编码帧一直解码到需要的解码图像对应的帧位置,可见,在对采用GDR方式进行图传的码流进行解码时,对目标视频文件中任意位置的解码均需要参考对应序列的第一个帧内编码帧,导致对视频文件的解码效率低下。Using GDR for image transmission, the data size of each frame is relatively stable, but only the first frame in the original code stream is an intra-coded frame. Mobile terminals (such as drones) receive the image transmission via GDR. After decoding the original bitstream, if you want to decode a part of the file to obtain a decoded image, you must decode from the first intra-coded frame to the frame position corresponding to the required decoded image. It can be seen that the code that uses GDR for image transmission When decoding a stream, decoding at any position in the target video file needs to refer to the first intra-coded frame of the corresponding sequence, resulting in inefficient decoding of the video file.
为了提高可移动平台对图像的处理效率,本发明提出了一种图像处理方法,可将经有GDR图传过来的H264码流中的一个或多个帧间编码帧替换为帧内编码帧(即IDR帧),使得该可移动平台在对H264码流中任意位置帧进行解码时,可不必每次都参考序列中的第一个帧内编码帧,实现从H264码流的中间位置开始解码图像,提高可移动平台对图像的处理效率。在一个实施例中,可参见如图1所示的一种图像处理方法的流程示意图,在可移动平台检测到编码器完成初始化时,获取目标视频文件的原始码流,并确定对该原始码流进行解码得到解码数据,该解码数据例如可以YUV数据,从而可确定得到的解码数据的数据量是否满足预设条件,其中,该预设条件例如可以是帧数为45的倍数,并在该数据量满足预设条件时,将得到的解码数据进行重编码,并在将重编码后的当前码流进行熵编码以及封装后,保存到存储介质中。In order to improve the processing efficiency of the image by the movable platform, the present invention proposes an image processing method, which can replace one or more inter-encoded frames in the H264 code stream transmitted by the GDR image with intra-encoded frames ( (Ie IDR frame), so that when the mobile platform decodes frames at any position in the H264 code stream, it does not need to refer to the first intra-coded frame in the sequence every time, and it can start decoding from the middle position of the H264 code stream. Images to improve the efficiency of mobile platforms for image processing. In an embodiment, reference may be made to a schematic flowchart of an image processing method as shown in FIG. 1. When the movable platform detects that the encoder is initialized, it obtains the original code stream of the target video file and determines the original code. The stream is decoded to obtain decoded data. The decoded data may be, for example, YUV data, so as to determine whether the data amount of the obtained decoded data meets a preset condition. The preset condition may be, for example, a multiple of 45 frames. When the amount of data meets a preset condition, the decoded data obtained is re-encoded, and the re-encoded current code stream is entropy-encoded and encapsulated, and then stored in a storage medium.
由于进行重编码后得到的当前码流中包含多个帧内编码帧,因此,在对该目标视频文件的当前码流进行解码时,可参考离待解码的目标帧最近的帧内编码帧对所述目标帧进行解码处理,也就实现了对目标视频文件的随机访问。在一个实施例中,YUV数据是一种颜色编码方法,主要用于电视系统以及模拟视频领域,它是指将亮度参量(Y:Luminance或Luma)和色度参量(UV:Chrominance或Chroma)分开进行表示的像素编码格式。Because the current code stream obtained after re-encoding includes multiple intra-coded frames, when decoding the current code stream of the target video file, reference may be made to the intra-coded frame pair closest to the target frame to be decoded. The target frame is decoded to achieve random access to the target video file. In one embodiment, YUV data is a color coding method, which is mainly used in the field of television systems and analog video. It refers to separating luminance parameters (Y: Luminance or Luma) and chrominance parameters (UV: Chrominance or Chroma). The pixel encoding format for the representation.
在一个实施例中,可移动平台在进行编码操作时,可先根据H264码流数据的第一参数信息初始化对应的编码器,其中,该第一参数信息包括序列参数集SPS(Sequence Paramater Set,SPS)和图像参数集PPS(Picture Paramater Set,PPS),在对编码器进行初始化时,SPS和PPS的数据例如profile、level、num_ref_frames、pic_init_qp_minus26等参数必须完全一致,然后设置编码器编码YUV数据为IDR帧,编码后的数据需要再根据原始码流的SPS和PPS重新解析再封包,再保存到存储介质中。随后的码流数据由于插入了新的IDR帧,以及log2_max_frame_num_minus4有可能变更了,需要解析更新 frame_num,修改为新参数后再封包,最终mux成可播放的mp4文件。In one embodiment, when the mobile platform performs an encoding operation, the corresponding encoder may be initialized according to the first parameter information of the H264 stream data, where the first parameter information includes a sequence parameter set SPS (Sequence Paramater Set, SPS) and picture parameter set PPS (Picture, Paramter Set, PPS). When the encoder is initialized, the SPS and PPS data such as profile, level, num_ref_frames, pic_init_qp_minus26 and other parameters must be completely consistent, and then set the encoder to encode YUV data as For IDR frames, the encoded data needs to be reparsed and repacked according to the SPS and PPS of the original bitstream, and then stored in the storage medium. Subsequent stream data may be changed due to the insertion of a new IDR frame and log2_max_frame_num_minus4. You need to parse and update frame_num, modify it to new parameters, and then packetize it. Finally, mux becomes a playable mp4 file.
上述编码器可采用软件编码实现,上述软件编码可以是libx264或者openh26,或者其他任意一种软件编码方案。The above encoder may be implemented by software encoding, and the above software encoding may be libx264 or openh26, or any other software encoding scheme.
对于GDR格式的码流,一般的显示保存流程包括拆分解析,解码器解码、显示,编码器重编码四大模块。首先,数据解析模块接到H264封包的码流后,需要拆包并把同一帧的码流合并成一个完整的码流数据包,为解码器解码做好准备;解码器模块接收到码流数据后,按照正常的解码顺序和解码逻辑,把码流数据解码成正确的YUV数据;然后显示器模块把YUV数据转换成显示器能正常显示的RGB数据,并在显示端显示出来;最后编码器重编码模块把解码器解码后的YUV数据,重新编码成H264码流。For the GDR format stream, the general display saving process includes four major modules: split analysis, decoder decoding, display, and encoder re-encoding. First, after the data parsing module receives the stream of H264 packets, it needs to unpack and merge the same frame of the stream into a complete stream data packet to prepare the decoder for decoding; the decoder module receives the stream data Then, according to the normal decoding sequence and decoding logic, the code stream data is decoded into the correct YUV data; then the display module converts the YUV data into RGB data that the display can normally display, and displays it on the display end; finally the encoder re-encodes the module The YUV data decoded by the decoder is re-encoded into a H264 code stream.
在一个实施例中,编码器重编码模块的工作方式为:编码器需要原始码流相关的一些信息,因为并不是对原始码流完全进行重新编码,而只是隔一定的数据帧后重新编码,一般情况下,正常IDR格式的视频文件,为了任意时间点的随机播放,会隔一定的时间后有一个IDR帧,这个时间间隔一般以1-2s居多,在一个实施例中,可取值为1.5s,对于30帧每秒(fps)的视频,大约每45帧需要一个IDR帧,也就是每隔45帧,对解码后的YUV数据进行重编码一次。In one embodiment, the working mode of the encoder re-encoding module is: the encoder needs some information related to the original code stream, because the original code stream is not completely re-encoded, but only re-encoded after a certain data frame, generally In the case, for a normal IDR format video file, for random playback at any point in time, there will be an IDR frame after a certain period of time. This time interval is generally 1-2s. In one embodiment, the value can be 1.5. s. For 30 frames per second (fps) video, an IDR frame is required approximately every 45 frames, that is, every 45 frames, the decoded YUV data is re-encoded.
在一个实施例中,编码器重编码时可具体执行步骤:第一帧原始H264码流与解码后的YUV数据,同时传输到编码模块,如果编码器还没有初始化,则使用H264码流中的SPS和/或PPS信息,初始化编码器,从而编码YUV数据,生成新的H264数据,从而以原始码流的参数,修改新的H264的封包参数并重新封包,交给多路选择器(multiplexer,mux)模块写入到文件,如果帧数不是45的倍数,则修改旧码流的参数,如frame_num等参数,再进行熵编码,再由mux写入到文件。In an embodiment, the encoder may perform specific steps when re-encoding: the first frame of the original H264 code stream and the decoded YUV data are transmitted to the encoding module at the same time. If the encoder has not been initialized, the SPS in the H264 code stream is used And / or PPS information, initialize the encoder to encode YUV data, generate new H264 data, modify the new H264's packet parameters and repack with the parameters of the original stream, and hand them to the multiplexer (mux, mux ) The module writes to the file. If the number of frames is not a multiple of 45, modify the parameters of the old code stream, such as frame_num and other parameters, then perform entropy encoding, and then write to the file by mux.
下面对本发明实施例中的可移动平台的图像处理方法进行举例描述。The image processing method of the movable platform in the embodiment of the present invention is described as an example below.
本发明实施例提供的一种可移动平台的图像处理方法。图2是本发明实施例提供的可移动平台的图像处理方法的流程图,如图2所示,该方法包括如下步骤:An image processing method for a movable platform provided by an embodiment of the present invention. FIG. 2 is a flowchart of an image processing method for a mobile platform according to an embodiment of the present invention. As shown in FIG. 2, the method includes the following steps:
S201,获取目标视频文件的原始码流,所述原始码流包括对所述目标视频文件进行编码得到的多个帧的码流,任一所述多个帧对应帧序列中第一帧为帧内编码帧,其他帧为帧间编码帧。S201: Obtain an original code stream of a target video file, where the original code stream includes code streams of multiple frames obtained by encoding the target video file, and any one of the multiple frames corresponds to a first frame in a frame sequence as a frame. Intra-coded frames, other frames are inter-coded frames.
在一个实施例中,可移动平台可获取通过GDR(Gradual Decoding Refresh,GDR)方式传输的目标视频文件的原始码流,即可采用GDR格式对传输的目标视频文件进行编码,所述原始码流对应为H264码流,其中,GDR是相对一帧完整刷新而来的,其通过P帧包括I块组的方法来实现逐渐刷新,会带来更优的网络适应性,在一个实施例中,采用GDR的传输方式得到的原始码流的帧序列中,任一帧序列的第一帧为帧内编码帧,例如I帧,其他帧为帧间编码帧,例如P帧和/或B帧。In one embodiment, the mobile platform can obtain the original code stream of the target video file transmitted through GDR (Gradual Decoding, Refresh, GDR), and can use the GDR format to encode the transmitted target video file. The original code stream Corresponds to the H264 code stream, in which the GDR is completely refreshed from a frame, which realizes the gradual refresh by the method of P frames including I block groups, which will bring better network adaptability. In one embodiment, In the frame sequence of the original code stream obtained by the GDR transmission method, the first frame of any frame sequence is an intra-frame encoded frame, such as an I frame, and the other frames are inter-frame encoded frames, such as a P frame and / or a B frame.
基于通过GDR方式传输目标视频文件得到的原始码流包括帧序列的排列方式,以及帧内编码帧及帧间编码帧的特性,当需要对原始码流中任一帧序列的某一帧进行解码得到解码图像时,均需要从该某一帧所属的帧序列的第一个帧内编码帧开始解码,即对该帧序列从头开始解码,直至解码到所述某一帧对应位置,才能解码得到所述某一帧对应的解码图像,可见,采用通过GDR方式传输的所述目标视频文件的原始码流不能实现对目标视频文件的随机访问,即不能对原始码流进行随机解码得到解码图像。Based on the original code stream obtained by transmitting the target video file by GDR, including the arrangement of the frame sequence, and the characteristics of intra-frame and inter-frame encoded frames, when a frame of any frame sequence in the original code stream needs to be decoded When a decoded image is obtained, it needs to be decoded from the first intra-coded frame of the frame sequence to which the certain frame belongs, that is, the frame sequence is decoded from the beginning until it is decoded to the corresponding position of the certain frame. It can be seen that, for the decoded image corresponding to a certain frame, the original code stream of the target video file transmitted through the GDR method cannot achieve random access to the target video file, that is, the original code stream cannot be randomly decoded to obtain a decoded image.
在另一实施例中,当可移动平台获取的目标视频文件的原始码流中包括的帧内编码帧,如I帧的数量较少,但帧间编码帧,如B帧和/或P帧的数量较多时,该可移动平台对原始码流中任一帧序列进行解码得到解码图像,由于原始码流中I帧数量较少,因此可能使得待解码帧与离该待解码帧最近的I帧之间间隔的帧数量很多,从而导致可移动平台对待解码帧的解码效率低下,使得该可移动平台对目标视频文件的随机访问速度下降,削弱用户体验。因此,可执行后续步骤S202和S203,以得到新的码流(即当前码流),从而提升对目标视频文件的访问速度。In another embodiment, when the number of intra-coded frames, such as I-frames, included in the original bitstream of the target video file obtained by the mobile platform is small, inter-coded frames, such as B-frames and / or P-frames When the number is large, the mobile platform decodes any frame sequence in the original code stream to obtain a decoded image. Because the number of I frames in the original code stream is small, the frame to be decoded may be the closest I to the frame to be decoded. The number of frames spaced between frames is large, which results in a low decoding efficiency of the mobile platform for the decoded frames, making the mobile platform's random access speed to the target video file lower, and weakening the user experience. Therefore, subsequent steps S202 and S203 may be performed to obtain a new code stream (that is, the current code stream), thereby improving the access speed of the target video file.
S202,对所述原始码流进行解码处理,得到各个所述帧的解码数据。S202. Decode the original bitstream to obtain decoded data of each frame.
为了实现对目标视频文件的随机访问,基于帧内编码帧可实现独立解码,且无需参考其他帧即可得到解码图像的特性,可在原始码流中插入帧内编码帧,因此,为了实现在原始码流中插入帧内编码帧,以实现对目标视频文件的 随机访问,可在获取到原始码流后,对所述原始码流进行解码处理,以得到各个所述多个帧的解码数据。In order to achieve random access to the target video file, intra-coded frames can be independently decoded, and the characteristics of decoded images can be obtained without reference to other frames. Intra-coded frames can be inserted into the original code stream. Therefore, in order to achieve The intra-coded frame is inserted into the original code stream to achieve random access to the target video file. After the original code stream is obtained, the original code stream is decoded to obtain decoded data of each of the multiple frames. .
在一个实施例中,所述解码数据例如可以是YUV数据,所述YUV数据可转换成显示器能正常显示的RGB数据,并在显示端显示出来,此外,可移动平台可基于YUV数据对所述目标视频文件进行重编码,即转而执行S203,从而在对该目标视频文件进行重编码得到的当前码流中插入帧内编码帧。In one embodiment, the decoded data may be, for example, YUV data, and the YUV data may be converted into RGB data that can be normally displayed by a display and displayed on the display end. In addition, the movable platform may The target video file is re-encoded, that is, S203 is performed instead, and an intra-coded frame is inserted into the current code stream obtained by re-encoding the target video file.
在对所述原始码流进行解码处理时,可先对所述原始码流进行解析处理,得到各个帧的码流,从而可对各个帧的码流进行解码处理,得到各个所述帧的解码数据。When the original code stream is decoded, the original code stream may be parsed and processed to obtain the code stream of each frame, so that the code stream of each frame may be decoded and decoded for each of the frames. data.
S203,根据所述原始码流的第一参数信息对所述解码数据进行编码,得到所述目标视频文件的当前码流,其中,所述当前码流为包括至少一个帧间编码帧和至少两个即时解码刷新IDR帧的码流。S203: Encode the decoded data according to the first parameter information of the original code stream to obtain a current code stream of the target video file, where the current code stream includes at least one inter-encoded frame and at least two Instant decoding refreshes the bit stream of the IDR frame.
在一个实施例中,所述第一参数信息包括序列参数集SPS和/或图像参数集PPS等用于对解码数据进行编码的码流参数,所述序列参数集SPS和/或图像参数集PPS均为H264码流中的重要参数集,且一起保存在视频文件的头文件中,所述序列参数集SPS包含的是针对一连续编码视频序列的参数,如帧数、参考帧数码、解码图像尺寸及帧场编码模式选择标识等;所述图像参数集PPS对应的是一个序列中某一幅图像或者某几幅图像,参数如标识符、熵编码模式选择标识、片组数目、初始量化参数等,如果H264码流中没有PPS或者SPS,解码器将无法解析码流数据,也就导致目标视频文件无法播放。In one embodiment, the first parameter information includes code stream parameters, such as sequence parameter set SPS and / or image parameter set PPS, used to encode decoded data, and the sequence parameter set SPS and / or image parameter set PPS Both are important parameter sets in the H264 stream, and are saved together in the header file of the video file. The sequence parameter set SPS contains parameters for a continuously encoded video sequence, such as frame number, reference frame number, decoded image Size and frame field coding mode selection identification; the image parameter set PPS corresponds to a certain image or several images in a sequence, parameters such as identifier, entropy encoding mode selection identification, number of slices, initial quantization parameters Wait, if there is no PPS or SPS in the H264 stream, the decoder will not be able to parse the stream data, which will cause the target video file to be unplayable.
在一个实施例中,所述PPS和/或SPS中包括的相关参数还可用于对编码器进行初始化,使得编码器对原始码流解码得到的解码数据(如YUV数据)进行重编码。其中,在根据PPS以及SPS对解码数据进行编码得到目标视频文件的当前码流时,可确定每个帧序列插入帧内编码帧的间隔,并基于该间隔将对应位置的解码数据编码为帧内编码帧,从而使得每个帧序列中包括至少两个帧内编码帧,其包括的两个帧内编码帧例如可以是即时解码刷新IDR帧,重编码得到的当前码流的其他帧为帧内编码帧,如上述的P帧和/或B帧。In an embodiment, the related parameters included in the PPS and / or SPS may also be used to initialize an encoder, so that the encoder re-encodes decoded data (such as YUV data) obtained by decoding the original bitstream. Among them, when encoding the decoded data according to the PPS and SPS to obtain the current stream of the target video file, the interval at which each frame sequence is inserted into the intra-coded frame can be determined, and the decoded data at the corresponding position is encoded into the intra-frame based on the interval Encode frames so that each frame sequence includes at least two intra-encoded frames. The two intra-encoded frames included can be, for example, instant decode refresh IDR frames, and other frames of the current code stream obtained by re-encoding are intra. Encoded frames, such as the P and / or B frames described above.
由于对解码数据进行编码后得到的当前码流中包括至少两个IDR帧,基于IDR帧立即刷新的特性,在对帧序列任一待解码帧进行解码得到解码图像 时,可参考该帧序列中离所述待解码帧最近的IDR帧,并从该最近IDR帧开始解码,直至解码到该待解码帧对应位置,从而可解码得到待解码帧对应的解码图像,而不用从原始码流帧序列的第一个帧内编码帧开始解码得到解码图像,实现了对目标视频文件的随机访问,可提高图像的处理效率。Because the current bitstream obtained after encoding the decoded data includes at least two IDR frames, based on the characteristics of the IDR frame immediately refreshed, when decoding any frame to be decoded in the frame sequence to obtain a decoded image, refer to the frame sequence The IDR frame closest to the frame to be decoded, and decoding is started from the latest IDR frame until it is decoded to the corresponding position of the frame to be decoded, so that the decoded image corresponding to the frame to be decoded can be decoded without using the original stream frame sequence The first intra-coded frame is decoded to obtain a decoded image, which realizes random access to the target video file and can improve the processing efficiency of the image.
本发明实施例提供的图像处理方法、装置及可移动平台,通过将获取的目标视频文件的原始码流进行解码处理,得到所述原始码流包括的各个帧的解码数据,从而可进一步对该解码数据进行编码,从而得到该目标视频文件的当前码流,使得用户可根据该当前码流包括的帧内编码帧以及IDR帧,实现对目标视频文件中任何位置图像的解码,并得到该位置对应的解码图像,使得图像处理效率的提高。The image processing method, device, and mobile platform provided by the embodiments of the present invention can obtain the decoded data of each frame included in the original bitstream by decoding the obtained original bitstream of the target video file, so as to further analyze the original bitstream. The decoded data is encoded to obtain the current code stream of the target video file, so that the user can decode the image of any position in the target video file and obtain the position according to the intra-coded frames and IDR frames included in the current code stream. The corresponding decoded image makes the image processing efficiency improve.
图3是本发明另一实施例提供的可移动平台的图像处理方法的流程图,如图3所示,该方法包括如下步骤:FIG. 3 is a flowchart of an image processing method for a mobile platform according to another embodiment of the present invention. As shown in FIG. 3, the method includes the following steps:
S301,获取目标视频文件的原始码流,所述原始码流包括对所述目标视频文件进行编码得到的多个帧的码流,任一所述多个帧对应帧序列中第一帧为帧内编码帧,其他帧为帧间编码帧。S301. Obtain an original code stream of a target video file, where the original code stream includes code streams of multiple frames obtained by encoding the target video file, and any one of the multiple frames corresponds to a first frame in a frame sequence as a frame. Intra-coded frames, other frames are inter-coded frames.
S302,对所述原始码流进行解码处理,得到各个所述帧的解码数据。S302. Decode the original code stream to obtain decoded data of each frame.
在一个实施例中,S301-S302具体实时方式可参见上述S201-S202的叙述,在此不再赘述。In one embodiment, the specific real-time manners of S301-S302 can be referred to the descriptions of S201-S202, which will not be repeated here.
S303,在所述多个帧中确定需要编码成IDR帧的目标帧。S303. Determine a target frame to be encoded into an IDR frame among the multiple frames.
在对解码数据进行编码得到当前码流时,需要首先确定需要编码成IDR帧在所述多个帧中的插入位置,并用该需要编码成的IDR帧替换原始码流中插入位置对应的帧,也即需要从多个帧中确定出需要编码成IDR帧的目标帧,该目标帧在原始码流中的位置即为需要编码成的IDR帧在所述多个帧中的插入位置,在用所述需要编码成的IDR帧替换所述原始码流中的目标帧,在一个实施例中,可移动平台在从多个帧中确定需要编码成IDR帧的目标帧时,具体执行步骤:When encoding the decoded data to obtain the current bitstream, it is necessary to first determine the insertion position of the IDR frame in the multiple frames that need to be encoded, and replace the frame corresponding to the insertion position in the original bitstream with the IDR frame that needs to be encoded. That is, a target frame to be encoded into an IDR frame needs to be determined from multiple frames. The position of the target frame in the original code stream is the insertion position of the IDR frame to be encoded in the multiple frames. The IDR frame that needs to be encoded replaces the target frame in the original code stream. In one embodiment, when the mobile platform determines the target frame that needs to be encoded into an IDR frame from multiple frames, the specific execution steps are:
s11,选取任一所述多个帧对应帧序列为目标帧序列;s11, selecting a frame sequence corresponding to any one of the multiple frames as a target frame sequence;
s12,根据所述目标帧序列长度确定所述目标帧序列长度对应于所述目标 视频文件的播放时长;s12, determining that the target frame sequence length corresponds to the playback duration of the target video file according to the target frame sequence length;
s13,获取需要编码成的IDR帧在所述目标帧序列中的第一插入周期;S13: Obtain a first insertion cycle of the IDR frame to be encoded in the target frame sequence;
s14,根据所述第一插入周期和所述目标帧序列长度,在所述多个帧中确定需要编码成IDR帧的目标帧。s14. Determine a target frame to be encoded into an IDR frame among the multiple frames according to the first insertion period and the target frame sequence length.
步骤s11-步骤s14是对上述S303的具体细化,所述目标帧序列为所述目标视频文件的原始码流中的任一帧序列,所述目标帧序列长度是指:所述目标帧序列中包括的所有帧的数量,则所述目标帧序列长度对应于所述目标视频文件的播放时长是指:播放完所述目标帧序列中所有帧所需的时长,对应的,所述第一插入周期为时间周期,例如,如果所述目标帧序列长度对应于所述目标视频文件的播放时长为2秒,所述第一插入周期对应可以为1s或者1.5s等等,从而可根据所述目标帧序列长度对应于所述目标视频文件的播放时长与所述第一插入周期,在所述多个帧中确定需要编码成IDR帧的目标帧。Steps s11 to s14 are specific refinements of the above S303. The target frame sequence is any frame sequence in the original code stream of the target video file. The length of the target frame sequence refers to the target frame sequence. The number of all frames included in the frame, the length of the target frame sequence corresponds to the playback duration of the target video file means: the duration required to finish playing all the frames in the target frame sequence, correspondingly, the first The insertion period is a time period. For example, if the length of the target frame sequence corresponds to a playback duration of the target video file of 2 seconds, the first insertion period may correspond to 1s or 1.5s, etc. The target frame sequence length corresponds to the playback duration of the target video file and the first insertion cycle, and a target frame that needs to be encoded into an IDR frame is determined from the plurality of frames.
在一个实施例中,任一所述目标视频文件的原始码流中包括至少一个帧序列如图4所示,所述至少一个帧序列可由每个帧序列中的第一参数信息(所述第一参数信息包括PPS和/或SPS)进行区分,和/或所述至少一个帧序列也可由所述码流中包括的第二参数信息进行区分,在由所述第二参数信息进行区分时,可用第二参数信息置0标识所述码流包括的每个帧序列的起始位置。In an embodiment, as shown in FIG. 4, the original bitstream of any of the target video files includes at least one frame sequence, and the at least one frame sequence may be determined by the first parameter information (the first (The parameter information includes PPS and / or SPS), and / or the at least one frame sequence may also be distinguished by second parameter information included in the code stream, and when distinguished by the second parameter information, The second parameter information may be set to 0 to identify a start position of each frame sequence included in the code stream.
在另一实施例中,可移动平台在所述多个帧中确定需要编码成IDR帧的目标帧时,还可执行步骤:In another embodiment, when the mobile platform determines a target frame that needs to be encoded into an IDR frame among the multiple frames, it may further perform steps:
s21,选取任一所述多个帧对应帧序列为目标帧序列;s21, selecting a frame sequence corresponding to any one of the multiple frames as a target frame sequence;
s22,获取所述目标帧序列的帧数量总和,以及需要编码成的IDR帧在所述目标帧序列中的第二插入周期;S22: Acquire the total number of frames of the target frame sequence and the second insertion cycle of the IDR frame to be encoded in the target frame sequence;
s23,根据所述第二插入周期和所述帧数量总和,在所述多个帧中确定需要编码成IDR帧的目标帧。S23: Determine a target frame to be encoded into an IDR frame among the multiple frames according to the second insertion period and the sum of the number of frames.
在步骤s21-步骤s23中,所述目标帧序列的帧数量总和是指:所述目标帧序列中包括的所有帧的数量,对应的,根据所述目标帧序列的帧数量总和获取的需要编码成的IDR帧在所述目标帧序列中的第二插入周期为帧数量周期,所述第二插入周期即是指在一个目标帧序列中,每隔第二插入周期所指示的帧数量,插入IDR帧,即确定需要编码成的IDR帧在所述多个帧中的位置,也 就是在所述多个帧中确定需要编码成IDR帧的目标帧。在一个实施例中,所述目标帧序列的帧数量总和假设为50,对应的所述第二插入周期为45等。In step s21 to step s23, the total number of frames of the target frame sequence refers to: the number of all frames included in the target frame sequence. Correspondingly, coding needs to be obtained according to the total number of frames of the target frame sequence. The second insertion cycle of the completed IDR frame in the target frame sequence is a frame number cycle. The second insertion cycle refers to the insertion of a target frame sequence every frame number indicated by the second insertion cycle. The IDR frame is to determine the position of the IDR frame to be encoded in the multiple frames, that is, to determine the target frame to be encoded into the IDR frame in the multiple frames. In one embodiment, the total number of frames of the target frame sequence is assumed to be 50, and the corresponding second insertion period is 45 or the like.
在又一个实施例中,可移动平台在所述多个帧中确定需要编码成IDR帧的目标帧时,还可执行步骤:In another embodiment, when the mobile platform determines a target frame to be encoded into an IDR frame among the multiple frames, it may further perform steps:
s31,获取所述码流中多个帧的数量总和,以及需要编码成的IDR帧在所述多个帧中的第三插入周期;S31: Acquire the sum of the number of multiple frames in the code stream and the third insertion period of the IDR frames to be encoded in the multiple frames;
s32,根据所述第三插入周期和所述多个帧的数量总和,在所述多个帧中确定需要编码成IDR帧的目标帧。s32. Determine a target frame to be encoded into an IDR frame among the multiple frames according to a sum of the third insertion period and the number of the multiple frames.
在步骤s31-步骤s32中,还可根据所述码流中包括的帧数量总和,确定插入的任意两个IDR帧之间间隔的帧数量,即是在所述原始码流的多个帧中,按照所述第三插入周期插入至少一个IDR帧。在一个实施例中,在所述多个帧中确定需要编码成IDR帧的目标帧之后,可再执行S304。In step s31 to step s32, the number of frames spaced between any two IDR frames inserted may also be determined according to the total number of frames included in the code stream, that is, among multiple frames of the original code stream. , Inserting at least one IDR frame according to the third insertion period. In one embodiment, after a target frame that needs to be encoded into an IDR frame is determined in the multiple frames, S304 may be performed again.
S304,根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流。S304. Encode the decoded data of the target frame according to the first parameter information of the original code stream to obtain a code stream of the at least one IDR frame.
在一个实施例中,在执行S304之前,为了得到所述至少一个IDR帧的码流,可先执行步骤:判断所述目标帧序列长度对应于所述目标视频文件的播放时长除以所述第一插入周期得到的第一余数是否为零;在所述第一余数不为零时,说明按照所述第一插入周期确定的插入所需IDR帧(即需要编码成的IDR帧)的位置不能保证每个插入周期和/或每个帧序列中均插入了所需的IDR帧,则需要对所述原始码流的第二参数信息进行调整,调整所述第二参数信息,即是调整插入所需IDR帧的位置,也即在所述多个帧中重新确定需要编码成IDR帧的目标帧。在一个实施例中,可将插入所需IDR帧对应位置的第二参数信息置为0,并依次调整处于插入的所需IDR帧之后帧对应的第二参数信息。In one embodiment, before executing S304, in order to obtain the code stream of the at least one IDR frame, a step may be performed first: determining that the length of the target frame sequence corresponds to the playback duration of the target video file divided by the first Whether the first remainder obtained during an insertion period is zero; when the first remainder is not zero, the IDR frame (that is, the IDR frame that needs to be encoded) required for insertion determined according to the first insertion period is described The position cannot guarantee that the required IDR frame is inserted in each insertion cycle and / or each frame sequence, and then the second parameter information of the original code stream needs to be adjusted, and the second parameter information is adjusted, that is, The position where the required IDR frame is inserted is adjusted, that is, the target frame that needs to be encoded into the IDR frame is re-determined among the multiple frames. In one embodiment, the second parameter information corresponding to the position where the required IDR frame is inserted may be set to 0, and the second parameter information corresponding to the frame after the required IDR frame that is inserted may be adjusted sequentially.
在调整所述原始码流的第二参数信息后,可根据原始码流的第一参数信息和调整后的原始码流的第二参数信息,对位于确定得到的位置的目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流,并将得到的所述至少一个IDR帧的码流插入所需位置中。After adjusting the second parameter information of the original code stream, the decoded data of the target frame at the determined position may be performed according to the first parameter information of the original code stream and the adjusted second parameter information of the original code stream. Encoding to obtain the code stream of the at least one IDR frame, and inserting the obtained code stream of the at least one IDR frame into a desired position.
举例来说,若选取的目标帧序列如图5a所示,所述目标帧序列长度为50,若所述目标帧序列长度对应于所述目标视频文件的播放时长为3秒,获取的所 需IDR帧在所述目标帧序列中的第一插入周期为1.2秒,由于所述目标帧序列长度对应于所述目标视频文件的播放时长2秒除以所述第一插入周期1.2秒得到的第一余数不为0,则对所述原始码流的第二参数信息进行调整,调整后的所述目标帧序列的第二参数信息可如图5b所示的,如图5b所示,将所述目标帧序列原先第二参数信息为45的位置调整为0,并对应修改了之后帧位置的第二参数信息,在一个实施例中,所述调整为0的位置即是插入IDR帧的位置,也即原始码流中需要编码成IDR帧的目标帧所处的位置。For example, if the selected target frame sequence is shown in FIG. 5a, the target frame sequence length is 50, and if the target frame sequence length corresponds to the playback time of the target video file is 3 seconds, the required The first insertion cycle of the IDR frame in the target frame sequence is 1.2 seconds, because the length of the target frame sequence corresponds to the playback duration of the target video file of 2 seconds divided by the first insertion cycle of 1.2 seconds If the remainder is not 0, the second parameter information of the original bitstream is adjusted. The adjusted second parameter information of the target frame sequence may be as shown in FIG. 5b. As shown in FIG. 5b, The position of the target frame sequence whose original second parameter information is 45 is adjusted to 0, and the second parameter information of the subsequent frame position is modified. In one embodiment, the position adjusted to 0 is the IDR frame inserted. Position, that is, the position in the original code stream where the target frame to be encoded into the IDR frame is located.
在另一实施例中,在执行S304之前,为了得到所述至少一个IDR帧的码流,还可先执行步骤:判断所述目标帧序列的帧数量总和除以所述第二插入周期得到的第二余数是否为零;在所述第二余数不为零时,也说明按照所述第二插入周期确定的插入所需IDR帧的位置不能保证每个插入周期和/或每个帧序列中均有插入了所需的IDR帧,则需要对所述原始码流的第二参数信息进行调整,在一个实施例中,也可按照将插入所需IDR帧对应位置的第二参数信息置为0,并依次调整处于插入的所需IDR帧之后帧对应的第二参数信息的方法调整所述第二参数信息。In another embodiment, before performing S304, in order to obtain the code stream of the at least one IDR frame, a step may further be performed: determining the total number of frames of the target frame sequence divided by the second insertion period. Whether the second remainder is zero; when the second remainder is not zero, it also indicates that the position of the IDR frame required for insertion determined according to the second insertion period cannot guarantee each insertion period and / or each frame The required IDR frames are inserted in the sequence, and the second parameter information of the original bitstream needs to be adjusted. In one embodiment, the second parameter information corresponding to the position corresponding to the required IDR frame may also be inserted. Set it to 0, and sequentially adjust the second parameter information corresponding to the second parameter information corresponding to the frame after the inserted required IDR frame.
对应的,在调整所述原始码流的第二参数信息后,也可根据所述原始码流的第一参数信息和调整后的原始码流的第二参数信息对位于确定得到的位置的帧的解码数据进行编码,得到至少一个IDR帧的码流,并将得到的所述至少一个IDR帧的码流插入所需位置中。其中,所述第二参数信息例如可以是fram_num等,对所述第二参数信息的修改过程可参见如图5a和图5b的叙述,在此不再赘述。Correspondingly, after adjusting the second parameter information of the original code stream, the frames at the determined positions may also be paired according to the first parameter information of the original code stream and the adjusted second parameter information of the original code stream. Encode the decoded data to obtain a code stream of at least one IDR frame, and insert the obtained code stream of the at least one IDR frame into a desired position. The second parameter information may be, for example, fram_num, and the modification process of the second parameter information may refer to the description in FIG. 5a and FIG. 5b, and details are not described herein again.
再一个实施例中,在执行S304之前,为了得到所述至少一个IDR帧的码流,还可先执行步骤:判断所述多个帧的数量总和除以第三插入周期得到的第三余数是否为0,在所述第三于是不为0时,对所述原始码流的第二参数信息进行调整,使得所述多个帧的数量总和除以调整后的第三插入周期得到的余数为0,即是在所述原始码流的多个帧中,按照一定的间隔插入IDR帧,所述间隔例如可以是45。In another embodiment, before executing S304, in order to obtain the code stream of the at least one IDR frame, a step may further be performed: determining a sum of the number of the plurality of frames divided by a third remainder obtained by a third insertion cycle. Whether it is 0, and when the third is then not 0, adjusting the second parameter information of the original code stream so that the sum of the number of the plurality of frames divided by the adjusted third insertion period is the remainder It is 0, that is, IDR frames are inserted at a certain interval among multiple frames of the original code stream, and the interval may be 45, for example.
所述可移动平台在执行S304时,首先获取所述原始码流多个帧对应帧序列中的第一帧的码流的第一参数信息,并根据所述第一帧的码流的第一参数信 息,对编码器进行初始化处理;再使用初始化处理后的编码器对所述目标帧的解码数据进行编码,得到更新后的码流,从而可根据所述原始码流的第一参数信息,对所述更新后的码流的第一参数信息进行调整,并进一步地根据调整后的第一参数信息,对所述更新后的码流进行封装,从而得到至少一个IDR帧的码流。When the movable platform executes S304, first obtain the first parameter information of the code stream of the first frame in the frame sequence corresponding to the multiple frames of the original code stream, and according to the first of the code streams of the first frame, Parameter information to initialize the encoder; and then use the encoder after the initialization process to encode the decoded data of the target frame to obtain an updated code stream, so that it can be based on the first parameter information of the original code stream, The first parameter information of the updated code stream is adjusted, and the updated code stream is further encapsulated according to the adjusted first parameter information, so as to obtain a code stream of at least one IDR frame.
需要说明的是,当所述第一余数不为零时,可进一步判断按照该第一插入周期对应的插入位置是否为帧内编码帧,若是,则说明原始码流按照该第一插入周期确定的插入位置中已有一个或多个插入位置帧内编码帧,那么此时没有在该插入位置处再重新插入IDR帧的必要,因此则不对原始码流中已有帧内编码帧对应位置的第二参数信息进行调整,若否,则执行上述对原始码流的第二参数信息进行调整的步骤;同理,当所述第二余数或者第三余数不为零时,也可先判断按照第二插入周期确定的插入位置或者按照第三插入周期确定的插入位置处是否已经有帧内编码帧,并在没有时,执行上述对第二参数信息进行调整的步骤。It should be noted that when the first remainder is not zero, it can be further judged whether the insertion position corresponding to the first insertion period is an intra-coded frame. If so, the original code stream is indicated according to the first insertion period. There are already one or more intra-frame encoding frames in the determined insertion position, so it is not necessary to re-insert IDR frames at this insertion position, so the corresponding positions of the existing intra-frame encoding frames in the original code stream are not required. If the second parameter information of the original bitstream is not adjusted, the second parameter information of the original bitstream is adjusted. If the second remainder or the third remainder is not zero, the adjustment may also be performed. First determine whether there is an intra-coded frame at the insertion position determined according to the second insertion cycle or the insertion position determined according to the third insertion cycle, and if not, perform the above-mentioned step of adjusting the second parameter information.
在一个实施例中,可按前述步骤依次对所述原始码流包括的各个帧序列进行处理,在对任一帧序列进行处理之前,均需要根据该序列对应的第一参数信息对编码器进行初始化处理。In one embodiment, each frame sequence included in the original bitstream may be processed sequentially according to the foregoing steps. Before processing any frame sequence, the encoder needs to be processed according to the first parameter information corresponding to the sequence. Initialization processing.
在执行S304之后,还可对得到的包括IDR帧的当前码流进行熵编码,使得多路选择器(multiplexer,mux)写入到文件中进行存储。After executing S304, the current code stream including the IDR frame can also be entropy-coded, so that a multiplexer (mux) is written to a file for storage.
在本发明实施例中,在获取目标视频文件的原始码流,并对该原始码流进行解码处理,得到各个所述帧的解码数据后,进一步地可在所述多个帧中确定需要编码成IDR帧的目标帧,从而根据该原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到至少一个IDR帧的码流,从而可将所述至少一个IDR帧的码流替换该目标帧在原始码流中的位置,得到该目标视频文件的当前码流,使得可根据当前码流包括的IDR帧对所述目标视频文件进行解码处理,以快速得到解码图像,提高了对图像处理的效率。In the embodiment of the present invention, after obtaining the original bitstream of the target video file and decoding the original bitstream to obtain the decoded data of each of the frames, it may be further determined that encoding is required in the multiple frames. Into a target frame of an IDR frame, so that the decoded data of the target frame is encoded according to the first parameter information of the original code stream to obtain a code stream of at least one IDR frame, so that the code of the at least one IDR frame can be The position of the target frame in the original bitstream is replaced by the stream to obtain the current bitstream of the target video file, so that the target video file can be decoded according to the IDR frame included in the current bitstream to quickly obtain a decoded image and improve The efficiency of image processing.
下面对本发明实施例中可移动平台对目标视频文件的当前码流进行解码时的图像处理方法进行具体描述,如图6所示,包括如下步骤:The following specifically describes the image processing method when the mobile platform decodes the current bitstream of the target video file in the embodiment of the present invention, as shown in FIG. 6, including the following steps:
S601,获取目标视频文件的当前码流,所述当前码流为包括至少一个帧间编码帧帧和至少两个即时解码刷新IDR帧的码流;S601. Acquire a current code stream of a target video file, where the current code stream is a code stream including at least one inter-encoded frame and at least two instant decoding refresh IDR frames;
S602,当检测到对所述目标视频文件中的目标帧的选定操作时,确定位于所述目标帧之前的第一个IDR帧,以及所述第一个IDR帧与所述目标帧之间的所有帧间编码帧;S602. When a selection operation of a target frame in the target video file is detected, determine a first IDR frame located before the target frame, and between the first IDR frame and the target frame. All inter-encoded frames of
S603,根据所述第一个IDR帧的码流、所述确定得到的帧间编码帧的码流和所述目标帧的码流,得到所述目标帧的图像。S603. Obtain an image of the target frame according to the code stream of the first IDR frame, the determined code stream of the inter-frame encoded frame, and the code stream of the target frame.
在步骤S601-步骤S603中,所述可移动设备可从具有视频摄像功能的装置(如摄像头)或者模块中获取目标视频文件,并按照如图2或者图3所示的图像处理方法对所述目标视频文件进行处理,得到所述目标视频文件的当前码流。进一步地,在检测到对所述目标视频文件的编辑操作,即是检测到对所述目标视频文件中目标帧的选定操作时,以该目标帧之前的第一个IDR帧开始解码,并参考该目标真和该第一个IDR帧之间的帧间编码帧,解码得到该目标帧对应的解码图像,实现了对该目标视频文件当前码流任意位置的快速解码,从而提高了可移动终端的图像处理效率。In step S601-step S603, the mobile device may obtain the target video file from a device (such as a camera) or a module having a video camera function, and perform the image processing method according to the image processing method shown in FIG. 2 or FIG. 3. The target video file is processed to obtain a current bitstream of the target video file. Further, when an editing operation on the target video file is detected, that is, a selection operation of a target frame in the target video file is detected, decoding starts with the first IDR frame before the target frame, and With reference to the inter-encoded frame between the target true and the first IDR frame, the decoded image corresponding to the target frame is decoded to achieve fast decoding of the target video file's current bitstream at any position, thereby improving mobility Image processing efficiency of the terminal.
在一个实施例中,所述具有视频摄像功能的装置例如可以是与该可移动平台建立通信连接的智能终端,如智能手机、平板电脑或者智能可穿戴设备等,也可以是自身携带的具有摄像功能的摄像头等等,所述可移动平台例如可以是无人机或者汽车等,在本发明实施例中,不对所述可移动平台以及所述具有视频摄像功能的装置进行限定。In one embodiment, the device with a video camera function may be, for example, a smart terminal that establishes a communication connection with the mobile platform, such as a smart phone, a tablet computer, or a smart wearable device. A functional camera and the like, the movable platform may be, for example, a drone or a car. In the embodiment of the present invention, the movable platform and the device with a video camera function are not limited.
在本发明实施例中,所述可移动平台通过获取目标视频文件的当前码流,并在检测到对所述目标视频文件中的目标帧的选定操作时,根据确定的位于该目标帧之前的第一个IDR帧以及该目标帧与该IDR帧之间的帧间编码帧,解码该目标帧的码流,得到该目标帧对应的图像,实现了对当前码流中处于任意位置目标帧的快速解码,由于对处于任意位置的目标帧的解码可不再参考该目标帧对应帧序列的第一个帧内编码帧,提高了该移动平台的图像处理效率。In the embodiment of the present invention, the movable platform obtains a current stream of a target video file, and when a selection operation of a target frame in the target video file is detected, it is determined to be located before the target frame. The first IDR frame and the inter-frame encoded frame between the target frame and the IDR frame, decode the code stream of the target frame to obtain the image corresponding to the target frame, and achieve the target frame at any position in the current code stream Fast decoding, because the decoding of a target frame at an arbitrary position can no longer refer to the first intra-coded frame of the frame sequence corresponding to the target frame, which improves the image processing efficiency of the mobile platform.
下面对本发明实施例中可移动平台对目标视频文件的原始码流进行处理时的另一图像处理方法进行具体描述,如图7所示,包括如下步骤:The following further describes another image processing method when the mobile platform processes the original bitstream of the target video file in the embodiment of the present invention. As shown in FIG. 7, the method includes the following steps:
S701,当检测到对目标视频文件的选定操作时,根据所述选定操作在所述目标视频文件的原始码流的作用位置确定需要编码成即时解码刷新IDR帧的目标帧。S701. When a selection operation on a target video file is detected, a target frame that needs to be encoded into an instant decoding and refreshing IDR frame is determined according to an effect position of the selected operation on an original bitstream of the target video file.
S702,对所述原始码流进行解码处理,直到得到所述目标帧的解码数据。S702: Perform decoding processing on the original code stream until the decoded data of the target frame is obtained.
S703,根据所述原始码流的第一参数信息对所述目标帧的解码数据进行编码,得到所述目标帧的当前码流。S703: Encode the decoded data of the target frame according to the first parameter information of the original code stream to obtain the current code stream of the target frame.
S704,将所述原始码流中所述目标帧的码流替换为所述当前码流,得到所述目标视频文件的当前码流。S704: Replace the code stream of the target frame in the original code stream with the current code stream to obtain the current code stream of the target video file.
在步骤S701-步骤S704中,所述选定操作可由和可移动平台建立通信连接的智能终端发送到该可移动平台,也可为直接作用在该可移动平台上的选定操作,可移动平台检测到对目标视频文件的选定操作,说明用户有编辑目标是文件的需求,则可按照用户的需求指示,即该选定操作作用在该目标视频文件的原始码流的位置插入IDR帧。In step S701-step S704, the selected operation may be sent to the mobile platform by a smart terminal that establishes a communication connection with the mobile platform, or may be a selected operation directly acting on the mobile platform. The detection of the selection operation of the target video file indicates that the user has a need to edit the target file. According to the user's demand instruction, the selection operation inserts an IDR frame at the position of the original stream of the target video file.
在一个实施例中,该选定操作作用的位置即为插入IDR帧的所需位置,该选定操作在原始码流中作用的帧为插入IDR帧的目标帧,因此,在所需位置处插入IDR帧时,可只将原始码流解码到目标帧处,得到该目标帧以及该目标帧之前的所有帧的解码数据,从而可根据原始码流的第一参数信息对该目标帧的解码数据进行编码得到该目标帧的当前码流,从而可将原始码流中目标帧的码流替换为重新编码得到的当前码流,从而得到该目标视频文件的当前码流,实现按照用户实际需求对目标视频文件的处理。In one embodiment, the position at which the selected operation acts is the desired position for inserting the IDR frame, and the frame that the selected operation plays in the original code stream is the target frame for inserting the IDR frame. Therefore, at the desired position When inserting an IDR frame, only the original code stream can be decoded to the target frame to obtain the target frame and the decoded data of all frames before the target frame, so that the target frame can be decoded according to the first parameter information of the original code stream The data is encoded to obtain the current code stream of the target frame, so that the target code stream in the original code stream can be replaced with the re-encoded current code stream to obtain the current code stream of the target video file, according to the actual needs of users Processing of the target video file.
在本发明实施例中,当可移动平台检测到对目标视频文件的选定操作时,可在确定该选定操作在目标视频文件的原始码流的作用位置,也即在确定该选定操作在原始码流中作用的目标帧后,解码该原始码流直到得到该目标帧的解码数据,再根据第一参数信息对该解码数据进行编码处理得到该目标帧的当前码流,从而可将原始码流中目标帧的码流替换为重新编码得到的当前码流,实现了根据用户需求,对目标视频文件的个性化处理,提升用户满意度。In the embodiment of the present invention, when the movable platform detects the selected operation on the target video file, it can determine the action position of the selected operation on the original stream of the target video file, that is, determine the selected operation. After the target frame acting in the original code stream, the original code stream is decoded until the decoded data of the target frame is obtained, and then the decoded data is encoded and processed according to the first parameter information to obtain the current code stream of the target frame. The bitstream of the target frame in the original bitstream is replaced with the current bitstream obtained by re-encoding, which realizes the personalized processing of the target video file according to user needs and improves user satisfaction.
本发明实施例提供一种可移动平台的图像处理装置,图8是本发明实施例提供的可移动平台的图像处理装置的结构图,如图8所示,可移动平台的图像 处理装置800包括存储器801和处理器802,其中,存储器802中存储有程序代码,处理器802调用存储器中的程序代码,当程序代码被执行时,处理器802执行如下操作:An embodiment of the present invention provides an image processing apparatus of a movable platform. FIG. 8 is a structural diagram of an image processing apparatus of a movable platform provided by an embodiment of the present invention. As shown in FIG. 8, the image processing apparatus 800 of the movable platform includes The memory 801 and the processor 802. The memory 802 stores program code. The processor 802 calls the program code in the memory. When the program code is executed, the processor 802 performs the following operations:
获取目标视频文件的原始码流,所述原始码流包括对所述目标视频文件进行编码得到的多个帧的码流,任一所述多个帧对应帧序列中第一帧为帧内编码帧,其他帧为帧间编码帧;Obtain the original code stream of the target video file, where the original code stream includes the code streams of multiple frames obtained by encoding the target video file, and the first frame in the frame sequence corresponding to any one of the multiple frames is intra-frame encoding Frames, other frames are inter-coded frames;
对所述原始码流进行解码处理,得到各个所述帧的解码数据;Decoding the original code stream to obtain decoded data of each of the frames;
根据所述原始码流的第一参数信息对所述解码数据进行编码,得到所述目标视频文件的当前码流,其中,所述当前码流为包括至少一个帧间编码帧和至少两个即时解码刷新IDR帧的码流。Encode the decoded data according to the first parameter information of the original code stream to obtain a current code stream of the target video file, where the current code stream includes at least one inter-coded frame and at least two real-time Decode the code stream of the refresh IDR frame.
在一个实施例中,所述第一参数信息包括序列参数集SPS和/或图像参数集PPS,所述处理器802在根据所述原始码流的第一参数信息对所述解码数据进行编码,得到所述目标视频文件的当前码流时,执行如下操作:In an embodiment, the first parameter information includes a sequence parameter set SPS and / or an image parameter set PPS, and the processor 802 encodes the decoded data according to the first parameter information of the original code stream, When the current bitstream of the target video file is obtained, the following operations are performed:
在所述多个帧中确定需要编码成IDR帧的目标帧;Determining a target frame to be encoded into an IDR frame among the multiple frames;
根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流。Encode the decoded data of the target frame according to the first parameter information of the original code stream to obtain a code stream of the at least one IDR frame.
在一个实施例中,所述处理器802在在所述多个帧中确定需要编码成IDR帧的目标帧时,执行如下操作:In one embodiment, when the processor 802 determines a target frame to be encoded into an IDR frame among the multiple frames, the processor 802 performs the following operations:
选取任一所述多个帧对应帧序列为目标帧序列;Selecting a frame sequence corresponding to any one of the multiple frames as a target frame sequence;
根据所述目标帧序列长度确定所述目标帧序列长度对应于所述目标视频文件的播放时长;Determining, according to the target frame sequence length, that the target frame sequence length corresponds to a playback duration of the target video file;
获取需要编码成的IDR帧在所述目标帧序列中的第一插入周期;Acquiring a first insertion cycle of an IDR frame to be encoded in the target frame sequence;
根据所述第一插入周期和所述目标帧序列长度对应于所述目标视频文件的播放时长,在所述多个帧中确定需要编码成IDR帧的目标帧。According to the first insertion cycle and the length of the target frame sequence corresponding to the playback duration of the target video file, a target frame that needs to be encoded into an IDR frame is determined among the multiple frames.
在一个实施例中,所述处理器802调用所述程序代码时,还执行如下操作:In one embodiment, when the processor 802 calls the program code, it also performs the following operations:
判断所述目标帧序列长度对应于所述目标视频文件的播放时长除以所述第一插入周期得到的第一余数是否为零;Judging whether the length of the target frame sequence corresponds to a playback duration of the target video file divided by the first insertion period and whether the first remainder is zero;
在所述第一余数不为零时,对所述原始码流的第二参数信息进行调整;When the first remainder is not zero, adjusting the second parameter information of the original code stream;
所述根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编 码,得到所述至少一个IDR帧的码流,包括:And encoding the decoded data of the target frame according to the first parameter information of the original code stream to obtain the code stream of the at least one IDR frame includes:
根据所述原始码流的第一参数信息和调整后的原始码流的第二参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流。Encoding the decoded data of the target frame according to the first parameter information of the original code stream and the second parameter information of the adjusted original code stream to obtain the code stream of the at least one IDR frame.
在一个实施例中,所述处理器802在所述多个帧中确定需要编码成IDR帧的目标帧时,执行如下操作:In one embodiment, when the processor 802 determines a target frame to be encoded into an IDR frame among the multiple frames, the processor 802 performs the following operations:
选取任一所述多个帧对应帧序列为目标帧序列;Selecting a frame sequence corresponding to any one of the multiple frames as a target frame sequence;
获取所述目标帧序列的帧数量总和,以及需要编码成的IDR帧在所述多个帧中的第二插入周期;Acquiring a total number of frames of the target frame sequence and a second insertion cycle of the IDR frame to be encoded in the multiple frames;
根据所述第二插入周期和所述帧数量总和,在所述多个帧中确定需要编码成IDR帧的目标帧。According to the second insertion period and the sum of the number of frames, a target frame that needs to be encoded into an IDR frame is determined among the multiple frames.
在一个实施例中,所述处理器802调用所述程序代码时,还执行如下操作:In one embodiment, when the processor 802 calls the program code, it also performs the following operations:
判断所述目标帧序列的帧数量总和除以所述第二插入周期得到的第二余数是否为零;Determining whether a second remainder obtained by dividing the total number of frames of the target frame sequence by the second insertion period is zero;
在所述第二余数不为零时,对所述原始码流的第二参数信息进行调整;When the second remainder is not zero, adjusting the second parameter information of the original code stream;
所述根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流,包括:The encoding the decoded data of the target frame according to the first parameter information of the original code stream to obtain the code stream of the at least one IDR frame includes:
根据所述原始码流的第一参数信息和调整后的原始码流的第二参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流。Encoding the decoded data of the target frame according to the first parameter information of the original code stream and the second parameter information of the adjusted original code stream to obtain the code stream of the at least one IDR frame.
在一个实施例中,所述处理器802在根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流时,执行如下操作:In one embodiment, when the processor 802 encodes the decoded data of the target frame according to the first parameter information of the original code stream to obtain the code stream of the at least one IDR frame, it performs the following operations :
对所述目标帧的解码数据进行编码,得到更新后的码流;Encoding the decoded data of the target frame to obtain an updated code stream;
根据所述原始码流的第一参数信息,对所述更新后的码流的第一参数信息进行调整;Adjusting the first parameter information of the updated code stream according to the first parameter information of the original code stream;
根据调整后的第一参数信息,对所述更新后的码流进行封装,得到所述至少一个IDR帧的码流。Encapsulating the updated code stream according to the adjusted first parameter information to obtain the code stream of the at least one IDR frame.
在一个实施例中,所述处理器802调用所述程序代码时,还执行如下操作:In one embodiment, when the processor 802 calls the program code, it also performs the following operations:
获取所述多个帧对应帧序列中第一帧的码流的第一参数信息;Acquiring first parameter information of a code stream of a first frame in a frame sequence corresponding to the multiple frames;
根据所述第一帧的码流的第一参数信息,对编码器进行初始化处理;Initialize the encoder according to the first parameter information of the code stream of the first frame;
使用初始化处理后的编码器对所述目标帧的解码数据进行编码,得到所述更新后的码流。The decoded data of the target frame is encoded by using the encoder after the initialization process to obtain the updated code stream.
在一个实施例中,所述处理器802调用所述程序代码时,还执行如下操作:In one embodiment, when the processor 802 calls the program code, it also performs the following operations:
对所述当前码流进行熵编码。Performing entropy coding on the current code stream.
在一个实施例中,所述处理器802调用所述程序代码时,还执行如下操作:In one embodiment, when the processor 802 calls the program code, it also performs the following operations:
对所述原始码流进行解析处理,得到各个所述帧的码流;Performing analysis processing on the original code stream to obtain a code stream of each of the frames;
所述对所述原始码流进行解码处理,得到各个所述帧的解码数据,包括:Decoding the original bitstream to obtain decoded data of each of the frames includes:
对各个所述帧的码流进行解码处理,得到各个所述帧的解码数据。Decode the code stream of each frame to obtain decoded data of each frame.
本实施例提供的可移动平台的图像处理装置能够执行前述实施例提供的如图2和图3所示的图像处理方法,其执行方式和有益效果类似,在这里不再赘述。The image processing apparatus of the movable platform provided by this embodiment can execute the image processing methods shown in FIG. 2 and FIG. 3 provided by the foregoing embodiments, and the execution manners and beneficial effects thereof are similar, and will not be repeated here.
本发明另一实施例提供的一种可移动平台的图像处理装置,图9是本发明另一实施例提供的可移动平台的图像处理装置的结构图,如图9所示,可移动平台的图像处理装置900包括存储器901和处理器902,其中,存储器902中存储有程序代码,处理器902调用存储器中的程序代码,当程序代码被执行时,处理器902执行如下操作:An image processing apparatus for a movable platform according to another embodiment of the present invention. FIG. 9 is a structural diagram of an image processing apparatus for a movable platform according to another embodiment of the present invention. As shown in FIG. The image processing apparatus 900 includes a memory 901 and a processor 902. The memory 902 stores program code. The processor 902 calls the program code in the memory. When the program code is executed, the processor 902 performs the following operations:
获取目标视频文件的当前码流,所述当前码流为包括至少一个帧间编码帧帧和至少两个即时解码刷新IDR帧的码流;Obtaining a current code stream of a target video file, where the current code stream is a code stream including at least one inter-coded frame and at least two instant decoding refresh IDR frames;
当检测到对所述目标视频文件中的目标帧的选定操作时,确定位于所述目标帧之前的第一个IDR帧,以及所述第一个IDR帧与所述目标帧之间的所有帧间编码帧;When a selection operation of a target frame in the target video file is detected, a first IDR frame located before the target frame, and all the IDR frames between the first IDR frame and the target frame are determined. Inter-frame coding
根据所述第一个IDR帧的码流、所述确定得到的帧间编码帧的码流和所述目标帧的码流,得到所述目标帧的图像。Obtaining an image of the target frame according to the code stream of the first IDR frame, the determined code stream of the inter-frame encoded frame, and the code stream of the target frame.
本实施例提供的可移动平台的图像处理装置能够执行前述实施例提供的如图6所示的图像处理方法,其执行方式和有益效果类似,在这里不再赘述。The image processing apparatus of the movable platform provided by this embodiment can execute the image processing method shown in FIG. 6 provided by the foregoing embodiment, and the execution manner and beneficial effects thereof are similar, and will not be repeated here.
本发明另一实施例提供的一种可移动平台的图像处理装置,图10是本发明另一实施例提供的可移动平台的图像处理装置的结构图,如图10所示,可 移动平台的图像处理装置100包括存储器101和处理器102,其中,存储器102中存储有程序代码,处理器102调用存储器中的程序代码,当程序代码被执行时,处理器102执行如下操作:An image processing apparatus for a movable platform according to another embodiment of the present invention. FIG. 10 is a structural diagram of an image processing apparatus for a movable platform according to another embodiment of the present invention. As shown in FIG. The image processing apparatus 100 includes a memory 101 and a processor 102. The memory 102 stores program code. The processor 102 calls the program code in the memory. When the program code is executed, the processor 102 performs the following operations:
当检测到对目标视频文件的选定操作时,根据所述选定操作在所述目标视频文件的原始码流的作用位置确定需要编码成即时解码刷新IDR帧的目标帧;When a selection operation on the target video file is detected, determining a target frame that needs to be encoded into an instant decoding refresh IDR frame according to the selected operation position of the original bitstream of the target video file;
对所述原始码流进行解码处理,直到得到所述目标帧的解码数据;Perform decoding processing on the original code stream until the decoded data of the target frame is obtained;
根据所述原始码流的第一参数信息对所述目标帧的解码数据进行编码,得到所述目标帧的当前码流;Encode the decoded data of the target frame according to the first parameter information of the original code stream to obtain the current code stream of the target frame;
将所述原始码流中所述目标帧的码流替换为所述当前码流,得到所述目标视频文件的当前码流。Replacing the stream of the target frame in the original stream with the current stream to obtain the current stream of the target video file.
本实施例提供的可移动平台的图像处理装置能够执行前述实施例提供的如图7所示的图像处理方法,其执行方式和有益效果类似,在这里不再赘述。The image processing apparatus of the movable platform provided by this embodiment can execute the image processing method shown in FIG. 7 provided by the foregoing embodiment, and the execution manner and beneficial effects thereof are similar, and will not be repeated here.
本发明实施例还提供一种可移动平台,该可移动平台包括:An embodiment of the present invention further provides a movable platform. The movable platform includes:
机身;body;
动力系统,安装在所述机身,用于为所述可移动平台提供动力;A power system mounted on the fuselage and configured to provide power to the movable platform;
以及如图8所示的可移动平台的图像处理装置,或者,如图9所示的可移动平台的图像处理装置,又或者,如图10所示的可移动平台的图像处理装置。And an image processing device of a movable platform as shown in FIG. 8, or an image processing device of a movable platform as shown in FIG. 9, or an image processing device of a movable platform as shown in FIG. 10.
可选的,所述可移动平台还包括:Optionally, the movable platform further includes:
图像传感器,安装在所述机身,用于获取目标视频文件。An image sensor is mounted on the body and used to obtain a target video file.
可选的,所述图像传感器包括视频图像传感器和/或文本图像传感器。Optionally, the image sensor includes a video image sensor and / or a text image sensor.
可选的,所述可移动平台还包括:Optionally, the movable platform further includes:
通信设备,安装在所述机身,用于与控制终端进行信息交互。A communication device is installed on the fuselage and is used for information interaction with the control terminal.
可选的,所述可移动平台至少包括如下的一种:无人机、汽车。Optionally, the movable platform includes at least one of the following: a drone and a car.
本实施例提供的可移动平台其执行方式和有益效果与前述实施例提供的图像处理装置类似,在这里不再赘述。The implementation manner and beneficial effects of the movable platform provided by this embodiment are similar to those of the image processing apparatus provided by the foregoing embodiments, and details are not described herein again.
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者 对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, but not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: It is still possible to modify the technical solutions described in the foregoing embodiments, or to replace some or all of the technical features equivalently; and these modifications or replacements do not depart from the essence of the corresponding technical solutions of the technical solutions of the embodiments of the present invention. range.

Claims (30)

  1. 一种图像处理方法,其特征在于,包括:An image processing method, comprising:
    获取目标视频文件的原始码流,所述原始码流包括对所述目标视频文件进行编码得到的多个帧的码流,任一所述多个帧对应帧序列中第一帧为帧内编码帧,其他帧为帧间编码帧;Obtain the original code stream of the target video file, where the original code stream includes the code streams of multiple frames obtained by encoding the target video file, and the first frame in the frame sequence corresponding to any one of the multiple frames is intra-frame encoding Frames, other frames are inter-coded frames;
    对所述原始码流进行解码处理,得到各个所述帧的解码数据;Decoding the original code stream to obtain decoded data of each of the frames;
    根据所述原始码流的第一参数信息对所述解码数据进行编码,得到所述目标视频文件的当前码流,其中,所述当前码流为包括至少一个帧间编码帧和至少两个即时解码刷新IDR帧的码流。Encode the decoded data according to the first parameter information of the original code stream to obtain a current code stream of the target video file, where the current code stream includes at least one inter-coded frame and at least two real-time Decode the code stream of the refresh IDR frame.
  2. 根据权利要求1所述的方法,其特征在于,所述第一参数信息包括序列参数集SPS和/或图像参数集PPS,所述根据所述原始码流的第一参数信息对所述解码数据进行编码,得到所述目标视频文件的当前码流,包括:The method according to claim 1, wherein the first parameter information comprises a sequence parameter set SPS and / or an image parameter set PPS, and the decoded data is based on the first parameter information of the original code stream. Performing encoding to obtain a current bitstream of the target video file, including:
    在所述多个帧中确定需要编码成IDR帧的目标帧;Determining a target frame to be encoded into an IDR frame among the multiple frames;
    根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流。Encode the decoded data of the target frame according to the first parameter information of the original code stream to obtain a code stream of the at least one IDR frame.
  3. 根据权利要求2所述的方法,其特征在于,所述在所述多个帧中确定需要编码成IDR帧的目标帧,包括:The method according to claim 2, wherein determining the target frame to be encoded into an IDR frame among the multiple frames comprises:
    选取任一所述多个帧对应帧序列为目标帧序列;Selecting a frame sequence corresponding to any one of the multiple frames as a target frame sequence;
    根据所述目标帧序列长度确定所述目标帧序列长度对应于所述目标视频文件的播放时长;Determining, according to the target frame sequence length, that the target frame sequence length corresponds to a playback duration of the target video file;
    获取需要编码成的IDR帧在所述目标帧序列中的第一插入周期;Acquiring a first insertion cycle of an IDR frame to be encoded in the target frame sequence;
    根据所述第一插入周期和所述目标帧序列长度对应于所述目标视频文件的播放时长,在所述多个帧中确定需要编码成IDR帧的目标帧。According to the first insertion cycle and the length of the target frame sequence corresponding to the playback duration of the target video file, a target frame that needs to be encoded into an IDR frame is determined among the multiple frames.
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR 帧的码流之前,还包括:The method according to claim 3, wherein before encoding the decoded data of the target frame according to the first parameter information of the original code stream to obtain the code stream of the at least one IDR frame, Also includes:
    判断所述目标帧序列长度对应于所述目标视频文件的播放时长除以所述第一插入周期得到的第一余数是否为零;Judging whether the length of the target frame sequence corresponds to a playback duration of the target video file divided by the first insertion period and whether the first remainder is zero;
    在所述第一余数不为零时,对所述原始码流的第二参数信息进行调整;When the first remainder is not zero, adjusting the second parameter information of the original code stream;
    所述根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流,包括:The encoding the decoded data of the target frame according to the first parameter information of the original code stream to obtain the code stream of the at least one IDR frame includes:
    根据所述原始码流的第一参数信息和调整后的原始码流的第二参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流。Encoding the decoded data of the target frame according to the first parameter information of the original code stream and the second parameter information of the adjusted original code stream to obtain the code stream of the at least one IDR frame.
  5. 根据权利要求2所述的方法,其特征在于,所述在所述多个帧中确定需要编码成IDR帧的目标帧,包括:The method according to claim 2, wherein determining the target frame to be encoded into an IDR frame among the multiple frames comprises:
    选取任一所述多个帧对应帧序列为目标帧序列;Selecting a frame sequence corresponding to any one of the multiple frames as a target frame sequence;
    获取所述目标帧序列的帧数量总和,以及需要编码成的IDR帧在所述多个帧中的第二插入周期;Acquiring a total number of frames of the target frame sequence and a second insertion cycle of the IDR frame to be encoded in the multiple frames;
    根据所述第二插入周期和所述帧数量总和,在所述多个帧中确定需要编码成IDR帧的目标帧。According to the second insertion period and the sum of the number of frames, a target frame that needs to be encoded into an IDR frame is determined among the multiple frames.
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流之前,还包括:The method according to claim 5, characterized in that before encoding the decoded data of the target frame according to the first parameter information of the original code stream, before obtaining the code stream of the at least one IDR frame, Also includes:
    判断所述目标帧序列的帧数量总和除以所述第二插入周期得到的第二余数是否为零;Determining whether a second remainder obtained by dividing the total number of frames of the target frame sequence by the second insertion period is zero;
    在所述第二余数不为零时,对所述原始码流的第二参数信息进行调整;When the second remainder is not zero, adjusting the second parameter information of the original code stream;
    所述根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流,包括:The encoding the decoded data of the target frame according to the first parameter information of the original code stream to obtain the code stream of the at least one IDR frame includes:
    根据所述原始码流的第一参数信息和调整后的原始码流的第二参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流。Encoding the decoded data of the target frame according to the first parameter information of the original code stream and the second parameter information of the adjusted original code stream to obtain the code stream of the at least one IDR frame.
  7. 根据权利要求2所述的方法,其特征在于,所述根据所述原始码流的 第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流,包括:The method according to claim 2, wherein the encoding of the decoded data of the target frame according to the first parameter information of the original code stream to obtain the code stream of the at least one IDR frame includes: :
    对所述目标帧的解码数据进行编码,得到更新后的码流;Encoding the decoded data of the target frame to obtain an updated code stream;
    根据所述原始码流的第一参数信息,对所述更新后的码流的第一参数信息进行调整;Adjusting the first parameter information of the updated code stream according to the first parameter information of the original code stream;
    根据调整后的第一参数信息,对所述更新后的码流进行封装,得到所述至少一个IDR帧的码流。Encapsulating the updated code stream according to the adjusted first parameter information to obtain the code stream of the at least one IDR frame.
  8. 根据权利要求7所述的方法,其特征在于,所述对所述目标帧的解码数据进行编码,得到更新后的码流之前,还包括:The method according to claim 7, wherein before encoding the decoded data of the target frame to obtain an updated code stream, the method further comprises:
    获取所述多个帧对应帧序列中第一帧的码流的第一参数信息;Acquiring first parameter information of a code stream of a first frame in a frame sequence corresponding to the multiple frames;
    根据所述第一帧的码流的第一参数信息,对编码器进行初始化处理;Initialize the encoder according to the first parameter information of the code stream of the first frame;
    使用初始化处理后的编码器对所述目标帧的解码数据进行编码,得到所述更新后的码流。The decoded data of the target frame is encoded by using the encoder after the initialization process to obtain the updated code stream.
  9. 根据权利要求1所述的方法,其特征在于,所述根据所述原始码流的第一参数信息对所述解码数据进行编码,得到所述目标视频文件的当前码流之后,还包括:The method according to claim 1, wherein after the encoding the decoded data according to the first parameter information of the original code stream to obtain the current code stream of the target video file, further comprising:
    对所述当前码流进行熵编码。Performing entropy coding on the current code stream.
  10. 根据权利要求1所述的方法,其特征在于,所述对所述原始码流进行解码处理,得到各个所述帧的解码数据之前,还包括:The method according to claim 1, wherein before performing decoding processing on the original bitstream to obtain decoded data of each of the frames, further comprising:
    对所述原始码流进行解析处理,得到各个所述帧的码流;Performing analysis processing on the original code stream to obtain a code stream of each of the frames;
    所述对所述原始码流进行解码处理,得到各个所述帧的解码数据,包括:Decoding the original bitstream to obtain decoded data of each of the frames includes:
    对各个所述帧的码流进行解码处理,得到各个所述帧的解码数据。Decode the code stream of each frame to obtain decoded data of each frame.
  11. 一种图像处理方法,其特征在于,包括:An image processing method, comprising:
    获取目标视频文件的当前码流,所述当前码流为包括至少一个帧间编码帧帧和至少两个即时解码刷新IDR帧的码流;Obtaining a current code stream of a target video file, where the current code stream is a code stream including at least one inter-coded frame and at least two instant decoding refresh IDR frames;
    当检测到对所述目标视频文件中的目标帧的选定操作时,确定位于所述目标帧之前的第一个IDR帧,以及所述第一个IDR帧与所述目标帧之间的所有帧间编码帧;When a selection operation of a target frame in the target video file is detected, a first IDR frame located before the target frame, and all the IDR frames between the first IDR frame and the target frame are determined. Inter-frame coding
    根据所述第一个IDR帧的码流、所述确定得到的帧间编码帧的码流和所述目标帧的码流,得到所述目标帧的图像。Obtaining an image of the target frame according to the code stream of the first IDR frame, the determined code stream of the inter-frame encoded frame, and the code stream of the target frame.
  12. 一种图像处理方法,其特征在于,包括:An image processing method, comprising:
    当检测到对目标视频文件的选定操作时,根据所述选定操作在所述目标视频文件的原始码流的作用位置确定需要编码成即时解码刷新IDR帧的目标帧;When a selection operation on the target video file is detected, determining a target frame that needs to be encoded into an instant decoding refresh IDR frame according to the selected operation position of the original bitstream of the target video file;
    对所述原始码流进行解码处理,直到得到所述目标帧的解码数据;Perform decoding processing on the original code stream until the decoded data of the target frame is obtained;
    根据所述原始码流的第一参数信息对所述目标帧的解码数据进行编码,得到所述目标帧的当前码流;Encode the decoded data of the target frame according to the first parameter information of the original code stream to obtain the current code stream of the target frame;
    将所述原始码流中所述目标帧的码流替换为所述当前码流,得到所述目标视频文件的当前码流。Replacing the stream of the target frame in the original stream with the current stream to obtain the current stream of the target video file.
  13. 一种图像处理装置,其特征在于,包括存储器和处理器;An image processing device, comprising a memory and a processor;
    所述存储器用于存储程序代码;The memory is used to store program code;
    所述处理器,调用所述程序代码,当程序代码被执行时,用于执行以下操作:The processor calls the program code, and when the program code is executed, is used to perform the following operations:
    获取目标视频文件的原始码流,所述原始码流包括对所述目标视频文件进行编码得到的多个帧的码流,任一所述多个帧对应帧序列中第一帧为帧内编码帧,其他帧为帧间编码帧;Obtain the original code stream of the target video file, where the original code stream includes the code streams of multiple frames obtained by encoding the target video file, and the first frame in the frame sequence corresponding to any one of the multiple frames is intra-frame encoding Frames, other frames are inter-coded frames;
    对所述原始码流进行解码处理,得到各个所述帧的解码数据;Decoding the original code stream to obtain decoded data of each of the frames;
    根据所述原始码流的第一参数信息对所述解码数据进行编码,得到所述目标视频文件的当前码流,其中,所述当前码流为包括至少一个帧间编码帧和至少两个即时解码刷新IDR帧的码流。Encode the decoded data according to the first parameter information of the original code stream to obtain a current code stream of the target video file, where the current code stream includes at least one inter-coded frame and at least two real-time Decode the code stream of the refresh IDR frame.
  14. 根据权利要求13所述的装置,其特征在于,所述第一参数信息包括序列参数集SPS和/或图像参数集PPS,所述处理器根据所述原始码流的第一 参数信息对所述解码数据进行编码,得到所述目标视频文件的当前码流时,执行如下操作:The apparatus according to claim 13, wherein the first parameter information comprises a sequence parameter set SPS and / or an image parameter set PPS, and the processor performs the first parameter information on the original code stream to the first parameter information. When the decoded data is encoded and the current stream of the target video file is obtained, the following operations are performed:
    在所述多个帧中确定需要编码成IDR帧的目标帧;Determining a target frame to be encoded into an IDR frame among the multiple frames;
    根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流。Encode the decoded data of the target frame according to the first parameter information of the original code stream to obtain a code stream of the at least one IDR frame.
  15. 根据权利要求14所述的装置,其特征在于,所述处理器在在所述多个帧中确定需要编码成IDR帧的目标帧时,执行如下操作:The apparatus according to claim 14, wherein when the processor determines a target frame to be encoded into an IDR frame among the multiple frames, the processor performs the following operations:
    选取任一所述多个帧对应帧序列为目标帧序列;Selecting a frame sequence corresponding to any one of the multiple frames as a target frame sequence;
    根据所述目标帧序列长度确定所述目标帧序列长度对应于所述目标视频文件的播放时长;Determining, according to the target frame sequence length, that the target frame sequence length corresponds to a playback duration of the target video file;
    获取需要编码成的IDR帧在所述目标帧序列中的第一插入周期;Acquiring a first insertion cycle of an IDR frame to be encoded in the target frame sequence;
    根据所述第一插入周期和所述目标帧序列长度对应于所述目标视频文件的播放时长,所述多个帧中确定需要编码成IDR帧的目标帧。According to the first insertion cycle and the length of the target frame sequence corresponding to the playback duration of the target video file, a target frame that needs to be encoded into an IDR frame is determined from the plurality of frames.
  16. 根据权利要求15所述的装置,其特征在于,所述处理器调用所述程序代码时,还执行如下操作:The apparatus according to claim 15, wherein when the processor calls the program code, the following operations are further performed:
    判断所述目标帧序列长度对应于所述目标视频文件的播放时长除以所述第一插入周期得到的第一余数是否为零;Judging whether the length of the target frame sequence corresponds to a playback duration of the target video file divided by the first insertion period and whether the first remainder is zero;
    在所述第一余数不为零时,对所述原始码流的第二参数信息进行调整;When the first remainder is not zero, adjusting the second parameter information of the original code stream;
    所述根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流,包括:The encoding the decoded data of the target frame according to the first parameter information of the original code stream to obtain the code stream of the at least one IDR frame includes:
    根据所述原始码流的第一参数信息和调整后的原始码流的第二参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流。Encoding the decoded data of the target frame according to the first parameter information of the original code stream and the second parameter information of the adjusted original code stream to obtain the code stream of the at least one IDR frame.
  17. 根据权利要求14所述的装置,其特征在于,所述处理器在所述多个帧中确定需要编码成IDR帧的目标帧时,执行如下操作:The apparatus according to claim 14, wherein when the processor determines a target frame to be encoded into an IDR frame among the multiple frames, the processor performs the following operations:
    选取任一所述多个帧对应帧序列为目标帧序列;Selecting a frame sequence corresponding to any one of the multiple frames as a target frame sequence;
    获取所述目标帧序列的帧数量总和,以及需要编码成的IDR帧在所述多 个帧中的第二插入周期;Acquiring a total number of frames of the target frame sequence and a second insertion cycle of the IDR frame to be encoded in the multiple frames;
    根据所述第二插入周期和所述帧数量总和,在所述多个帧中确定需要编码成IDR帧的目标帧。According to the second insertion period and the sum of the number of frames, a target frame that needs to be encoded into an IDR frame is determined among the multiple frames.
  18. 根据权利要求17所述的装置,其特征在于,所述处理器调用所述程序代码时,还执行如下操作:The apparatus according to claim 17, wherein, when the processor calls the program code, it further performs the following operations:
    判断所述目标帧序列的帧数量总和除以所述第二插入周期得到的第二余数是否为零;Determining whether a second remainder obtained by dividing the total number of frames of the target frame sequence by the second insertion period is zero;
    在所述第二余数不为零时,对所述原始码流的第二参数信息进行调整;When the second remainder is not zero, adjusting the second parameter information of the original code stream;
    所述根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流,包括:The encoding the decoded data of the target frame according to the first parameter information of the original code stream to obtain the code stream of the at least one IDR frame includes:
    根据所述原始码流的第一参数信息和调整后的原始码流的第二参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流。Encoding the decoded data of the target frame according to the first parameter information of the original code stream and the second parameter information of the adjusted original code stream to obtain the code stream of the at least one IDR frame.
  19. 根据权利要求14所述的装置,其特征在于,所述处理器根据所述原始码流的第一参数信息,对所述目标帧的解码数据进行编码,得到所述至少一个IDR帧的码流时,执行如下操作:The apparatus according to claim 14, wherein the processor encodes the decoded data of the target frame according to the first parameter information of the original code stream to obtain the code stream of the at least one IDR frame , Perform the following operations:
    对所述目标帧的解码数据进行编码,得到更新后的码流;Encoding the decoded data of the target frame to obtain an updated code stream;
    根据所述原始码流的第一参数信息,对所述更新后的码流的第一参数信息进行调整;Adjusting the first parameter information of the updated code stream according to the first parameter information of the original code stream;
    根据调整后的第一参数信息,对所述更新后的码流进行封装,得到所述至少一个IDR帧的码流。Encapsulating the updated code stream according to the adjusted first parameter information to obtain the code stream of the at least one IDR frame.
  20. 根据权利要求19所述的装置,其特征在于,所述处理器调用所述程序代码时,还执行如下操作:The apparatus according to claim 19, wherein, when the processor calls the program code, it further performs the following operations:
    获取所述多个帧对应帧序列中第一帧的码流的第一参数信息;Acquiring first parameter information of a code stream of a first frame in a frame sequence corresponding to the multiple frames;
    根据所述第一帧的码流的第一参数信息,对编码器进行初始化处理;Initialize the encoder according to the first parameter information of the code stream of the first frame;
    使用初始化处理后的编码器对所述目标帧的解码数据进行编码,得到所述更新后的码流。The decoded data of the target frame is encoded by using the encoder after the initialization process to obtain the updated code stream.
  21. 根据权利要求13所述的装置,其特征在于,处理器调用所述程序代码时,还执行如下操作:The apparatus according to claim 13, wherein when the processor calls the program code, the following operations are further performed:
    对所述当前码流进行熵编码。Performing entropy coding on the current code stream.
  22. 根据权利要求13所述的装置,其特征在于,处理器调用所述程序代码时,还执行如下操作:The apparatus according to claim 13, wherein when the processor calls the program code, the following operations are further performed:
    对所述原始码流进行解析处理,得到各个所述帧的码流;Performing analysis processing on the original code stream to obtain a code stream of each of the frames;
    所述对所述原始码流进行解码处理,得到各个所述帧的解码数据,包括:Decoding the original bitstream to obtain decoded data of each of the frames includes:
    对各个所述帧的码流进行解码处理,得到各个所述帧的解码数据。Decode the code stream of each frame to obtain decoded data of each frame.
  23. 一种图像处理装置,其特征在于,包括存储器和处理器;An image processing device, comprising a memory and a processor;
    所述存储器用于存储程序代码;The memory is used to store program code;
    所述处理器,调用所述程序代码,当程序代码被执行时,用于执行以下操作:The processor calls the program code, and when the program code is executed, is used to perform the following operations:
    获取目标视频文件的当前码流,所述当前码流为包括至少一个帧间编码帧帧和至少两个即时解码刷新IDR帧的码流;Obtaining a current code stream of a target video file, where the current code stream is a code stream including at least one inter-coded frame and at least two instant decoding refresh IDR frames;
    当检测到对所述目标视频文件中的目标帧的选定操作时,确定位于所述目标帧之前的第一个IDR帧,以及所述第一个IDR帧与所述目标帧之间的所有帧间编码帧;When a selection operation of a target frame in the target video file is detected, a first IDR frame located before the target frame, and all the IDR frames between the first IDR frame and the target frame are determined. Inter-frame coding
    根据所述第一个IDR帧的码流、所述确定得到的帧间编码帧的码流和所述目标帧的码流,得到所述目标帧的图像。Obtaining an image of the target frame according to the code stream of the first IDR frame, the determined code stream of the inter-frame encoded frame, and the code stream of the target frame.
  24. 一种图像处理装置,其特征在于,包括存储器和处理器;An image processing device, comprising a memory and a processor;
    所述存储器用于存储程序代码;The memory is used to store program code;
    所述处理器,调用所述程序代码,当程序代码被执行时,用于执行以下操作:The processor calls the program code, and when the program code is executed, is used to perform the following operations:
    当检测到对目标视频文件的选定操作时,根据所述选定操作在所述目标视频文件的原始码流的作用位置确定需要编码成即时解码刷新IDR帧的目标帧;When a selection operation on the target video file is detected, determining a target frame that needs to be encoded into an instant decoding refresh IDR frame according to the selected operation position of the original bitstream of the target video file;
    对所述原始码流进行解码处理,直到得到所述目标帧的解码数据;Perform decoding processing on the original code stream until the decoded data of the target frame is obtained;
    根据所述原始码流的第一参数信息对所述目标帧的解码数据进行编码,得到所述目标帧的当前码流;Encode the decoded data of the target frame according to the first parameter information of the original code stream to obtain the current code stream of the target frame;
    将所述原始码流中所述目标帧的码流替换为所述当前码流,得到所述目标视频文件的当前码流。Replacing the stream of the target frame in the original stream with the current stream to obtain the current stream of the target video file.
  25. 一种可移动平台,其特征在于,包括:A movable platform, comprising:
    机身;body;
    动力系统,安装在所述机身,用于为所述可移动平台提供动力;A power system mounted on the fuselage and configured to provide power to the movable platform;
    以及如权利要求13-22中任一项所述的可移动平台的图像处理装置,或者,如权利要求23所述的可移动平台的图像处理装置,又或者如权利要求24所述的可移动平台的图像处理装置。And an image processing device of a movable platform according to any one of claims 13 to 22, or an image processing device of a movable platform according to claim 23, or a movable device according to claim 24 Platform image processing device.
  26. 根据权利要求25所述的可移动平台,其特征在于,所述可移动平台还包括:The movable platform according to claim 25, wherein the movable platform further comprises:
    图像传感器,安装在所述机身,用于获取目标视频文件。An image sensor is mounted on the body and used to obtain a target video file.
  27. 根据权利要求26所述的可移动平台,其特征在于,所述图像传感器包括视频图像传感器和/或文本图像传感器。The movable platform according to claim 26, wherein the image sensor comprises a video image sensor and / or a text image sensor.
  28. 根据权利要求25所述的可移动平台,其特征在于,所述可移动平台还包括:The movable platform according to claim 25, wherein the movable platform further comprises:
    通信设备,安装在所述机身,用于与控制终端进行信息交互。A communication device is installed on the fuselage and is used for information interaction with the control terminal.
  29. 根据权利25所述的可移动平台,其特征在于,所述可移动平台至少包括如下的一种:无人机、汽车。The movable platform according to claim 25, wherein the movable platform includes at least one of the following: a drone, a car.
  30. 一种计算机存储介质,其特征在于,所述计算机存储介质中存储有第一计算机程序指令,所述第一计算机程序指令被处理器执行时,用于执行如权 利要求1-10任一项所述的图像处理方法;或者,所述计算机存储介质中存储有第二计算机程序指令,所述第二计算机程序指令被处理器执行时,用于执行如权利要求11所述的图像处理方法;又或者,所述计算机存储介质中存储有第三计算机程序指令,所述第三计算机程序指令被处理器执行时,用于执行如权利要求12所述的图像处理方法。A computer storage medium, characterized in that a first computer program instruction is stored in the computer storage medium, and when the first computer program instruction is executed by a processor, the first computer program instruction is used to execute the device according to any one of claims 1-10. The image processing method described above; or a second computer program instruction stored in the computer storage medium, the second computer program instruction for executing the image processing method according to claim 11 when the second computer program instruction is executed by a processor; and Alternatively, a third computer program instruction is stored in the computer storage medium, and when the third computer program instruction is executed by a processor, the third computer program instruction is used to execute the image processing method according to claim 12.
PCT/CN2018/108866 2018-09-29 2018-09-29 Image processing method and device, movable platform and storage medium WO2020062184A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201880037071.5A CN110741647A (en) 2018-09-29 2018-09-29 image processing method, device, movable platform and storage medium
PCT/CN2018/108866 WO2020062184A1 (en) 2018-09-29 2018-09-29 Image processing method and device, movable platform and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/108866 WO2020062184A1 (en) 2018-09-29 2018-09-29 Image processing method and device, movable platform and storage medium

Publications (1)

Publication Number Publication Date
WO2020062184A1 true WO2020062184A1 (en) 2020-04-02

Family

ID=69236604

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/108866 WO2020062184A1 (en) 2018-09-29 2018-09-29 Image processing method and device, movable platform and storage medium

Country Status (2)

Country Link
CN (1) CN110741647A (en)
WO (1) WO2020062184A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111343503B (en) * 2020-03-31 2022-03-04 北京金山云网络技术有限公司 Video transcoding method and device, electronic equipment and storage medium
CN111770390B (en) * 2020-07-09 2024-02-09 腾讯科技(深圳)有限公司 Data processing method, device, server and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014165653A2 (en) * 2013-04-05 2014-10-09 Qualcomm Incorporated Picture alignments in multi-layer video coding
CN104396265A (en) * 2012-04-27 2015-03-04 高通股份有限公司 Full random access from clean random access pictures in video coding
CN105657448A (en) * 2014-11-24 2016-06-08 科腾科技(北京)有限公司 Method, device and system for forwarding encoded video streams
CN107333133A (en) * 2016-04-28 2017-11-07 浙江大华技术股份有限公司 A kind of method and device of the code stream coding of code stream receiving device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100949982B1 (en) * 2006-03-30 2010-03-29 엘지전자 주식회사 A method and apparatus for decoding/encoding a video signal
CN101184230A (en) * 2006-11-13 2008-05-21 中兴通讯股份有限公司 Method for inserting switch frame in video sequence
CN102630013B (en) * 2012-04-01 2013-10-16 北京捷成世纪科技股份有限公司 Bit rate control video compression method and device on basis of scene switching
CN103873869A (en) * 2012-12-18 2014-06-18 北京市勤能通达科技有限公司 Code rate control method
CN106791875B (en) * 2016-11-30 2020-03-31 华为技术有限公司 Video data decoding method, video data encoding method and related devices

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104396265A (en) * 2012-04-27 2015-03-04 高通股份有限公司 Full random access from clean random access pictures in video coding
WO2014165653A2 (en) * 2013-04-05 2014-10-09 Qualcomm Incorporated Picture alignments in multi-layer video coding
CN105657448A (en) * 2014-11-24 2016-06-08 科腾科技(北京)有限公司 Method, device and system for forwarding encoded video streams
CN107333133A (en) * 2016-04-28 2017-11-07 浙江大华技术股份有限公司 A kind of method and device of the code stream coding of code stream receiving device

Also Published As

Publication number Publication date
CN110741647A (en) 2020-01-31

Similar Documents

Publication Publication Date Title
US10728594B2 (en) Method and apparatus for transmitting data of mobile terminal
US11395000B2 (en) Dependent random access point pictures
US8615038B2 (en) Video coding, decoding and hypothetical reference decoder
US10602190B2 (en) Temporal sub-layer descriptor
US20160234522A1 (en) Video Decoding
US20160261878A1 (en) Signaling information for coding
WO2018010662A1 (en) Video file transcoding method and device, and storage medium
US20060239563A1 (en) Method and device for compressed domain video editing
WO2020108033A1 (en) Transcoding method, transcoding device, and computer readable storage medium
EP2713620B1 (en) Video decoding apparatus
CN112073737A (en) Re-encoding predicted image frames in live video streaming applications
US20140375889A1 (en) Method, apparatus, and system for switching transport stream
KR20230098717A (en) Encoding method, encoded bitstream and encoding device
WO2019128668A1 (en) Method and apparatus for processing video bitstream, network device, and readable storage medium
WO2020062184A1 (en) Image processing method and device, movable platform and storage medium
JP2002320228A (en) Signal processor
CN111225211A (en) Transcoding method, transcoding device and computer readable storage medium
CN105379281B (en) Picture reference control for video decoding using a graphics processor
WO2015052938A1 (en) Highest temporal sub-layer list
US20110299591A1 (en) Video processing apparatus and method
KR20240001212A (en) How to specify parameter sets in video streaming
KR20220144241A (en) Server and control method thereof
CN112422974A (en) Video encoding method, video encoding device, computer equipment and storage medium
JP2013093713A (en) Encoder and encoding method

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18935353

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18935353

Country of ref document: EP

Kind code of ref document: A1