CN115942000B - H.264 format video stream transcoding method, device, equipment and medium - Google Patents

H.264 format video stream transcoding method, device, equipment and medium Download PDF

Info

Publication number
CN115942000B
CN115942000B CN202211390153.2A CN202211390153A CN115942000B CN 115942000 B CN115942000 B CN 115942000B CN 202211390153 A CN202211390153 A CN 202211390153A CN 115942000 B CN115942000 B CN 115942000B
Authority
CN
China
Prior art keywords
data packet
target
streaming media
format
media data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211390153.2A
Other languages
Chinese (zh)
Other versions
CN115942000A (en
Inventor
张伟峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Likong Yuantong Technology Co ltd
Original Assignee
Beijing Likong Yuantong Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Likong Yuantong Technology Co ltd filed Critical Beijing Likong Yuantong Technology Co ltd
Priority to CN202211390153.2A priority Critical patent/CN115942000B/en
Publication of CN115942000A publication Critical patent/CN115942000A/en
Application granted granted Critical
Publication of CN115942000B publication Critical patent/CN115942000B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The application provides a video stream transcoding method, device, equipment and medium based on an H.264 format. The video stream transcoding method based on the H.264 format comprises the following steps: and receiving stream media data packets of the source video stream. If the key frame of the streaming media data packet is detected, acquiring target information according to the target position of the key frame in the streaming media data packet, and analyzing the image frame of the streaming media data packet frame by frame. And sequentially generating image data packets of each image frame data according to the acquisition sequence of each image frame data. It is monitored whether an output request to output a target video stream is received. If the output request is received, a first target streaming media data packet is generated based on the message format of the target video coding format, the target information and the first image data packet. Outputting the first target streaming media data packet in response to the output request. The application can improve the transcoding efficiency and effectively reduce the occurrence of video delay playing.

Description

H.264 format video stream transcoding method, device, equipment and medium
Technical Field
The application relates to the field of video stream transcoding, in particular to a video stream transcoding method, device, equipment and medium based on an H.264 format.
Background
Video monitoring is very widely used in the industrial production field, and the code streams provided by equipment of each security equipment manufacturer are packaged based on the self needs, and the video stream formats provided by each security equipment manufacturer have diversity. And, the video player has no versatility.
Therefore, in the related art, in order to meet the video playing requirement of the user, the third party tool is required to transcode the video stream. However, the source video stream has various code stream transmission formats and code stream transmission formats to be played, so that the timeliness is low when a third-party tool is adopted to transcode the video stream, and video playing delay is caused.
Disclosure of Invention
Therefore, the technical problem to be solved by the application is to overcome the defect of low efficiency in transcoding the received video stream in the prior art, thereby providing a video stream transcoding method, device, equipment and medium based on the H.264 format.
According to a first aspect, an embodiment of the present application provides a video stream transcoding method based on an h.264 format, the method comprising:
receiving a streaming media data packet of a source video stream, wherein the streaming media data packet carries out code stream transmission according to a specified video coding format;
if the key frame of the streaming media data packet is detected, acquiring target information according to the target position of the key frame in the streaming media data packet, and analyzing the image frame of the streaming media data packet frame by frame;
sequentially generating image data packets of each image frame data according to the acquisition sequence of each image frame data;
monitoring whether an output request for outputting a target video stream is received, wherein the target video stream is a video stream which is subjected to code stream transmission according to a target video coding format;
if the output request is received, generating a first target streaming media data packet based on the message format of the target video coding format, the target information and a first image data packet, wherein the first image data packet is a currently generated image data packet;
outputting the first target streaming media data packet to respond to the output request.
In this manner, the received source video stream may be pre-defined to perform code stream transmission according to the specified video coding format, and the image data packet generated after parsing is subjected to directional transcoding according to the target video coding format, so as to generate the target data packet for outputting the target video stream, thereby being beneficial to improving the transcoding efficiency and effectively reducing the occurrence of the situation of video delay playing.
With reference to the first aspect, in a first embodiment of the first aspect, the generating a first target streaming media data packet based on the message format of the target video coding format, the target information, and the first image data packet includes:
acquiring message header information of the target video coding format;
according to the message format of the target video coding format, taking the target information as message tail data of the target video coding format, wherein the target information comprises key frame information and image parameter information of the key frame;
adding the first image data packet and the first data length of the image frame data corresponding to the first image data packet after the message tail data;
and packaging the message header information, the message tail data, the first image data packet and the first data length to generate a first target streaming media data packet.
With reference to the first aspect or the first embodiment of the first aspect, the method further includes:
if a second image data packet exists, generating a second target streaming media data packet according to a second data length of image frame data corresponding to the second image data packet, wherein the second image data packet is next image frame data of image frame data corresponding to the first image data packet;
and outputting the second target streaming media data packet in response to the completion of the output of the first target streaming media data packet.
With reference to the first aspect, in a third embodiment of the first aspect, the obtaining target information according to the target position of the key frame in the streaming media data packet, and analyzing the image frame of the streaming media data packet frame by frame includes:
reading the streaming media data packet bit by bit, and determining the target position of a key frame in the streaming media data packet according to the sub-packet identification code of the appointed video coding format;
and taking the target position as an analysis starting position of the streaming media data packet, acquiring target information, and analyzing the image frames of the streaming media data packet frame by frame.
With reference to the first aspect, in a fourth embodiment of the first aspect, the sequentially generating image data packets of each image frame data includes:
acquiring the current data length of the current image frame data;
storing the current data length by adopting bytes with specified digits;
and packaging the bytes storing the current data length with the current image frame data to obtain an image data packet of the current image frame data.
With reference to the first aspect, in a fifth embodiment of the first aspect, the method further includes:
and if the output request is not received, discarding the first image data packet, and taking the next image data packet generated in sequence as the first image data packet.
With reference to the first aspect, in a sixth embodiment of the first aspect, the specified video encoding format is an h.264 format, and the target video encoding format is an HTTP-FLV format.
According to a second aspect, an embodiment of the present application further provides a video stream transcoding device based on an h.264 format, where the device includes:
the first receiving unit is used for receiving streaming media data packets of a source video stream, and the streaming media data packets are subjected to code stream transmission according to a specified video coding format;
the analyzing unit is used for acquiring target information according to the target position of the key frame in the streaming media data packet if the key frame of the streaming media data packet is detected, and analyzing the image frame of the streaming media data packet frame by frame;
the first generation unit is used for sequentially generating image data packets of each image frame data according to the acquisition sequence of each image frame data;
the monitoring unit is used for monitoring whether an output request for outputting a target video stream is received or not, wherein the target video stream is a video stream for code stream transmission according to a target video coding format;
the second generating unit is configured to generate a first target streaming media data packet based on the message format of the target video coding format, the target information and a first image data packet if the output request is received, where the first image data packet is a currently generated image data packet;
and the output unit is used for outputting the first target streaming media data packet so as to respond to the output request.
According to a third aspect, the embodiment of the present application further provides an electronic device, including a memory and a processor, where the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions, thereby executing the video stream transcoding method according to the h.264 format in any one of the first aspect and its alternative embodiments.
According to a fourth aspect, embodiments of the present application further provide a computer readable storage medium storing computer instructions for causing the computer to perform the video stream transcoding method based on the h.264 format of any one of the first aspect and its alternative embodiments.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present application, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a video stream transcoding method based on the h.264 format according to an exemplary embodiment.
Fig. 2 is a flowchart of another video stream transcoding method based on the h.264 format according to an exemplary embodiment.
Fig. 3 is a flowchart of yet another video stream transcoding method based on the h.264 format according to an exemplary embodiment.
Fig. 4 is a block diagram of a video stream transcoding device based on the h.264 format according to an exemplary embodiment.
Fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an exemplary embodiment.
Detailed Description
The following description of the embodiments of the present application will be made apparent and fully in view of the accompanying drawings, in which some, but not all embodiments of the application are shown. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
In the related art, in order to meet the video playing requirement of the user, the third party tool is required to transcode the video stream. However, the source video stream has various code stream transmission formats and code stream transmission formats to be played, so that the timeliness is low when a third-party tool is adopted to transcode the video stream, and video playing delay is caused.
In order to solve the above-mentioned problems, in the embodiments of the present application, a video stream transcoding method based on an h.264 format is provided and used in an electronic device, it should be noted that an execution body of the video stream transcoding method may be a video stream transcoding device based on an h.264 format, and the device may be implemented as part or all of the electronic device by software, hardware or a combination of software and hardware, where the electronic device may be a terminal, a client, or a server, and the server may be a server, or may be a server cluster formed by multiple servers. In the following method embodiments, the execution subject is an electronic device.
In the video stream transcoding method based on the H.264 format, a stream media data packet of a source video stream is received, and the stream media data packet carries out code stream transmission according to a specified video coding format; if the key frame of the streaming media data packet is detected, acquiring target information according to the target position of the key frame in the streaming media data packet, and analyzing the image frame of the streaming media data packet frame by frame; sequentially generating image data packets of each image frame data according to the acquisition sequence of each image frame data; monitoring whether an output request for outputting a target video stream is received, wherein the target video stream is a video stream which is subjected to code stream transmission according to a target video coding format; if an output request is received, generating a first target streaming media data packet based on a message format of a target video coding format, target information and a first image data packet, wherein the first image data packet is a currently generated image data packet; outputting the first target streaming media data packet in response to the output request. According to the video stream transcoding method based on the H.264 format, the transcoding efficiency is improved, and the situation of video delay playing can be effectively reduced.
Fig. 1 is a flowchart of a video stream transcoding method based on the h.264 format according to an exemplary embodiment. As shown in fig. 1, the video stream transcoding method based on the h.264 format includes the following steps S101 to S106.
In step S101, a streaming media packet of a source video stream is received.
In the embodiment of the application, the streaming media data packet carries out code stream transmission according to the appointed video coding format. The input format of the video stream is preset to control the source video stream received by the video stream input interface to be a stream media data packet for code stream transmission according to the appointed video coding format. In an example, the specified video coding format may be any of the h.26x series, the moving picture experts group (Moving Picture Experts Group, MPEG) series, the audio video coding standard (Audio Video coding Standard, AVS), or the variable bit rate (RealMedia Variable Bitrate, RMVB) of the multimedia digital container format, without limitation in the present application. The H.26X series includes H.264 format. Preferably, the specified video encoding format may be an h.264 format.
In an example, in order to ensure the input integrity and smoothness of the source video stream, when receiving the streaming media data packet, the transmission size and the packetization limit of the streaming media data packet are not preset, thereby being beneficial to improving the receiving efficiency.
In step S102, if a key frame of the streaming media data packet is detected, the target information is obtained according to the target position of the key frame in the streaming media data packet, and the frame-by-frame analysis is performed on the image frame of the streaming media data packet.
In the embodiment of the application, not all data in the streaming media data packet are valid data. Therefore, in order to save transcoding cost, after receiving the source video stream, the source video stream is automatically detected, when the key frame of the streaming media data packet is detected, the target information is acquired according to the target position of the key frame in the media data packet, and the image frames of the streaming media data packet are analyzed frame by frame, so that the analysis efficiency is improved, and the analysis difficulty is reduced. The target information may include, among other things, key frame information (e.g., sequence parameter set (Sequence Paramater Set, SPS)) and picture parameter set (PIC). In one example, the obtained target information may be stored in a buffered manner, and the image frame data may be added to the format conversion queue.
In an embodiment, after receiving a streaming media data packet, reading the streaming media data packet bit by bit, determining a target position of a key frame in the streaming media data packet according to a packetization identification code of a specified video coding format, further taking the target position as an analysis starting position of the streaming media data packet, acquiring target information, and analyzing an image frame of the streaming media data packet frame by frame.
In an implementation scenario, taking a specified video coding format h.264 format as an example, in the process of code stream transmission, a packetization identification code of the h.264 format is identified, the next bit of the packetization identification code is read to obtain SEI information, and the SEI information and 0x1f are subjected to and operation processing to obtain a target position of a key frame in a media data packet. And taking the target position as an analysis starting position of the streaming media data packet, acquiring target information, and analyzing the image frames of the streaming media data packet frame by frame.
In step S103, an image data packet of each image frame data is sequentially generated according to the acquisition order of each image frame data.
In the embodiment of the application, the streaming media data packet comprises at least one image frame, and in order to ensure that the playing sequence after transcoding output is the same as the receiving sequence, the image data packet of each image frame data is sequentially generated according to the acquisition sequence of each image frame data. The image frame data is the data of the image frame.
In one embodiment, an image data packet includes image frame data and a data length of the image frame data. Specifically, in the process of reading the streaming media data packet, the current data length of the current image frame data is obtained, and bytes with specified bit numbers are used for storing the current data length. And packaging bytes storing the current data length with the current image frame data to obtain an image data packet of the current image frame data. In an implementation scenario, the current data length of the current image frame data may be stored with 4 bytes (bits), and the current image frame data is stored in the 5 th bit after 4 bytes, so as to encapsulate the whole data to generate a nalu type image data packet.
In step S104, it is monitored whether an output request to output the target video stream is received.
In the embodiment of the application, the target video stream is a video stream for code stream transmission according to the target video coding format. And determining whether transcoding playing is needed or not by monitoring whether an output request for outputting the target video stream is received, so that the source video stream is converted into the target video stream to be played.
In step S105, when an output request is received, a first target streaming media packet is generated based on the message format of the target video encoding format, the target information, and the first image packet.
In the embodiment of the application, if an output request is received, a target video stream which is required to be played and output in a code stream in a target video coding format is characterized, and then a first target streaming media data packet is generated based on a message format of the target video coding format, target information and a first image data packet. Wherein the first image data packet is a currently generated image data packet.
In an embodiment, a first target streaming media data packet is generated, and header information of a target video coding format is obtained, so that the current video coding format can be identified as the target video coding format through the header information when the first target streaming media data packet is output. And taking the target information as the message tail data of the target video coding format according to the message format of the target video coding format. The target information includes key frame information of key frames and image parameter information. And adding the first image data packet and the first data length of the first image data packet corresponding to the image frame data after the message tail data. And packaging the message header information, the message tail data, the first image data packet and the first data length to generate a first target streaming media data packet.
In step S106, the first target streaming media packet is output in response to the output request.
Through the embodiment, the received source video stream can be pre-limited to carry out code stream transmission according to the appointed video coding format, and the image data packet generated after analysis is subjected to directional transcoding according to the target video coding format, so that the target data packet for outputting the target video stream is generated, further, the transcoding efficiency is improved, and the situation of video delay playing can be effectively reduced.
Fig. 2 is a flowchart of another video stream transcoding method based on the h.264 format according to an exemplary embodiment. As shown in fig. 2, the video stream transcoding method based on the h.264 format includes the following steps.
In step S201, a streaming media packet of a source video stream is received.
In step S202, if a key frame of the streaming media data packet is detected, the target information is obtained according to the target position of the key frame in the streaming media data packet, and the frame-by-frame analysis is performed on the image frame of the streaming media data packet.
In step S203, an image data packet of each image frame data is sequentially generated according to the acquisition order of each image frame data.
In step S204, it is monitored whether an output request to output the target video stream is received.
In step S205, if an output request is received, a first target streaming media packet is generated based on the message format of the target video encoding format, the target information, and the first image packet.
In step S206, the first target streaming media packet is output in response to the output request.
In step S207, if there is a second image data packet, a second target streaming media data packet is generated according to a second data length of the image frame data corresponding to the second image data packet.
In the embodiment of the present application, the second image data packet is the next image frame data of the image frame data corresponding to the first image data packet. Because the first target streaming media data packet can identify that the target video coding format is adopted for code stream output currently, in order to improve the transcoding efficiency, the second target streaming media data packet can be directly generated according to the second data length of the image frame data corresponding to the second image data packet, so as to improve the transcoding speed.
In step S208, in response to the output of the first target streaming media packet being completed, the second target streaming media packet is output.
In the embodiment of the application, after the output of the first target streaming media data packet is completed, the second target streaming media data packet is output, which is helpful for guaranteeing the integrity of video output.
Through the embodiment, the transcoding efficiency can be improved, the transcoding difficulty is reduced, and after the output of the first target streaming media data packet is completed, the second target streaming media data packet is output, so that the output integrity of the target video stream can be ensured, and the use experience of a user can be improved.
Fig. 3 is a flowchart of yet another video stream transcoding method based on the h.264 format according to an exemplary embodiment. As shown in fig. 3, the video stream transcoding method based on the h.264 format includes the following steps.
In step S301, a streaming media packet of a source video stream is received.
In step S302, if a key frame of the streaming media data packet is detected, the target information is obtained according to the target position of the key frame in the streaming media data packet, and the frame-by-frame analysis is performed on the image frame of the streaming media data packet.
In step S303, an image data packet of each image frame data is sequentially generated according to the acquisition order of each image frame data.
In step S304, it is monitored whether an output request to output the target video stream is received.
In step S305, if an output request is received, a first target streaming media packet is generated based on the message format of the target video encoding format, the target information, and the first image packet.
In step S306, the first target streaming media packet is output in response to the output request.
In step S307, if the output request is not received, the first image data packet is discarded, and the next image data packet generated in sequence is used as the first image data packet.
In the embodiment of the application, if the output request is not received, the characterization does not need to output the source video stream. Therefore, in order to ensure that the source video stream can be played in real time when the output request is received, the first image data packet generated at present is discarded, and the next image data packet generated in sequence is used as the first image data packet, so that the image data packet contained in the first target streaming media data packet generated is ensured to be the latest first image data packet generated.
By the embodiment, the code stream caching is not needed, so that when an output request is received, the output first target streaming media data packet is generated based on the latest generated image data packet, the real-time performance of converting the source video stream into the target video stream for playing is guaranteed, and the use experience of a user is improved.
In one implementation scenario, the specified video encoding format is the H.264 format, and the target video encoding format is the HTTP-FLV format. The process of outputting the target video stream may be as follows:
and receiving streaming media data packets of the continuously input source video stream. The video coding format of the streaming media data packet is H.264 format. Reading the streaming media data packet bit by bit, and inquiring the packetization identification code in the H.264 format: 00 00 00 01, and reads the next bit of the packetization identification code to obtain SEI information, and performs AND operation on the SEI information and 0x1f to obtain the target position of the key frame in the streaming media data packet. And taking the target position as an analysis starting position of the streaming media data packet, acquiring target information, and analyzing the image frames of the streaming media data packet frame by frame. In order to improve the transcoding efficiency and reduce the transcoding difficulty, the target information is cached, and the image frame data is added into the format conversion queue to wait for transcoding. In order to avoid excessive occupation of memory, the parsed stream media data packet is discarded, and then the next stream media data packet is parsed in the same way. Wherein the target information includes SPS information and PIC information.
And sequentially acquiring image frame data from the format conversion queue according to the first-in-first-out sequence, storing the current data length of the current image frame data by adopting 4 bytes (bits), storing the current image frame data at the 5 th bit after the 4 bytes, and further packaging the whole data to generate a nalu type image data packet.
And after receiving an output request for outputting the target video stream, acquiring message header information of the HTTP-FLV, writing the cached target information into message tail data, and adding a first image data packet and a first data length of the first image data packet corresponding to the image frame data after the message tail data. And packaging the message header information, the message tail data, the first image data packet and the first data length to generate a first target streaming media data packet. Outputting the first target streaming media data packet in response to the output request. And if the second target streaming media data packet exists subsequently, outputting the second target streaming media data packet after the output of the first target streaming media data packet is completed.
Based on the same inventive concept, the application also provides a video stream transcoding device based on the H.264 format.
Fig. 4 is a block diagram of a video stream transcoding device based on the h.264 format according to an exemplary embodiment. As shown in fig. 4, the video stream transcoding device based on the h.264 format includes a first receiving unit 401, a parsing unit 402, a first generating unit 403, a monitoring unit 404, a second generating unit 405, and an output unit 406.
A first receiving unit 401, configured to receive a streaming media data packet of a source video stream, where the streaming media data packet performs code stream transmission according to a specified video coding format;
an parsing unit 402, configured to, if a key frame of the streaming media data packet is detected, obtain target information according to a target position of the key frame in the streaming media data packet, and parse an image frame of the streaming media data packet frame by frame;
a first generating unit 403, configured to sequentially generate an image data packet of each image frame data according to an acquisition sequence of each image frame data;
a monitoring unit 404, configured to monitor whether an output request for outputting a target video stream is received, where the target video stream is a video stream that is subjected to code stream transmission according to a target video encoding format;
a second generating unit 405, configured to generate, if an output request is received, a first target streaming media packet based on a message format of a target video coding format, target information, and a first image packet, where the first image packet is a currently generated image packet;
an output unit 406, configured to output the first target streaming media packet in response to the output request.
In an embodiment, the second generating unit 405 includes: the first acquisition unit is used for acquiring the message header information of the target video coding format; the first execution unit is used for taking target information as message tail data of the target video coding format according to the message format of the target video coding format, wherein the target information comprises key frame information of key frames and image parameter information; the second execution unit is used for adding a first image data packet and a first data length of the first image data packet corresponding to the image frame data after the message tail data; and the first encapsulation unit is used for encapsulating the message header information, the message tail data, the first image data packet and the first data length to generate a first target streaming media data packet.
In another embodiment, the apparatus further comprises: a third generating unit, configured to generate a second target streaming media data packet according to a second data length of the image frame data corresponding to the second image data packet if the second image data packet exists, where the second image data packet is next image frame data corresponding to the first image data packet; the output unit 406 is further configured to output a second target streaming media data packet in response to the completion of outputting the first target streaming media data packet.
In yet another embodiment, the parsing unit 402 includes: the position determining unit is used for reading the streaming media data packet bit by bit and determining the target position of the key frame in the streaming media data packet according to the sub-packet identification code of the appointed video coding format; and the analysis subunit is used for taking the target position as an analysis starting position of the streaming media data packet, acquiring target information and analyzing the image frames of the streaming media data packet frame by frame.
In yet another embodiment, the first generating unit 403 includes: a second acquisition unit configured to acquire a current data length of current image frame data; a storage unit for storing bytes of a specified bit number for the current data length; and the second packaging unit is used for packaging bytes storing the current data length and the current image frame data to obtain an image data packet of the current image frame data.
In yet another embodiment, the apparatus further comprises: and the third execution unit is used for discarding the first image data packet and taking the next image data packet generated in sequence as the first image data packet if the output request is not received.
In yet another embodiment, the video encoding format is designated as h.264 format and the target video encoding format is HTTP-FLV format.
The specific limitation of the video stream transcoding device based on the h.264 format can be referred to as limitation of the video stream transcoding method based on the h.264 format, and will not be described herein. The various modules described above may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or independent of a processor in the electronic device, or may be stored in software in a memory in the electronic device, so that the processor may call and execute operations corresponding to the above modules.
Fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an exemplary embodiment. As shown in fig. 5, the device includes one or more processors 510 and a memory 520, the memory 520 including persistent memory, volatile memory and a hard disk, one processor 510 being illustrated in fig. 4. The apparatus may further include: an input device 530 and an output device 540.
The processor 510, memory 520, input device 530, and output device 540 may be connected by a bus or other means, for example in fig. 4.
The processor 510 may be a central processing unit (Central Processing Unit, CPU). Processor 510 may also be a chip such as other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination thereof. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 520 is a non-transitory computer readable storage medium, including persistent memory, volatile memory, and hard disk, and may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the service management method in the embodiment of the present application. The processor 510 executes various functional applications of the server and data processing, i.e., implements any of the h.264 format-based video stream transcoding methods described above, by running non-transitory software programs, instructions, and modules stored in the memory 520.
Memory 520 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data, etc., as needed, used as desired. In addition, memory 520 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 520 may optionally include memory located remotely from processor 510, which may be connected to the data processing device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 530 may receive input numeric or character information and generate key signal inputs related to user settings and function control. The output 540 may include a display device such as a display screen.
One or more modules are stored in memory 520 that, when executed by one or more processors 510, perform the methods illustrated in fig. 1-3.
The product can execute the method provided by the embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method. Technical details which are not described in detail in the present embodiment can be found in the embodiments shown in fig. 1 to 3.
The embodiment of the application also provides a non-transitory computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions can execute the authentication method in any of the method embodiments. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a Flash Memory (Flash Memory), a Hard Disk (HDD), or a Solid State Drive (SSD); the storage medium may also comprise a combination of memories of the kind described above.
It is apparent that the above examples are given by way of illustration only and are not limiting of the embodiments. Other variations or modifications of the above teachings will be apparent to those of ordinary skill in the art. It is not necessary here nor is it exhaustive of all embodiments. While still being apparent from variations or modifications that may be made by those skilled in the art are within the scope of the application.

Claims (8)

1. A method for transcoding a video stream based on an h.264 format, the method comprising:
receiving a streaming media data packet of a source video stream, wherein the streaming media data packet carries out code stream transmission according to a specified video coding format;
if the key frame of the streaming media data packet is detected, acquiring target information according to the target position of the key frame in the streaming media data packet, and analyzing the image frame of the streaming media data packet frame by frame;
caching the target information, adding the image frame data into a format conversion queue to wait for transcoding, and discarding the parsed streaming media data packet;
sequentially generating an image data packet of each image frame data according to the acquisition sequence of each image frame data from the format conversion queue;
monitoring whether an output request for outputting a target video stream is received, wherein the target video stream is a video stream which is subjected to code stream transmission according to a target video coding format;
if the output request is received, generating a first target streaming media data packet based on the message format of the target video coding format, the target information and a first image data packet, wherein the first image data packet is a currently generated image data packet;
the generating a first target streaming media data packet based on the message format of the target video coding format, the target information and the first image data packet includes:
acquiring message header information of the target video coding format;
according to the message format of the target video coding format, taking the target information as message tail data of the target video coding format, wherein the target information comprises key frame information and image parameter information of the key frame;
adding the first image data packet and the first data length of the image frame data corresponding to the first image data packet after the message tail data;
encapsulating the message header information, the message tail data, the first image data packet and the first data length to generate a first target streaming media data packet;
outputting the first target streaming media data packet to respond to the output request;
and if the output request is not received, discarding the first image data packet, and taking the next image data packet generated in sequence as the first image data packet.
2. The method according to claim 1, wherein the method further comprises:
if a second image data packet exists, generating a second target streaming media data packet according to a second data length of image frame data corresponding to the second image data packet, wherein the second image data packet is next image frame data of image frame data corresponding to the first image data packet;
and outputting the second target streaming media data packet in response to the completion of the output of the first target streaming media data packet.
3. The method according to claim 1, wherein the obtaining the target information according to the target position of the key frame in the streaming media data packet and analyzing the image frame of the streaming media data packet frame by frame includes:
reading the streaming media data packet bit by bit, and determining the target position of a key frame in the streaming media data packet according to the sub-packet identification code of the appointed video coding format;
and taking the target position as an analysis starting position of the streaming media data packet, acquiring target information, and analyzing the image frames of the streaming media data packet frame by frame.
4. The method of claim 1, wherein sequentially generating the image data packets for each image frame data comprises:
acquiring the current data length of the current image frame data;
storing the current data length by adopting bytes with specified digits;
and packaging the bytes storing the current data length with the current image frame data to obtain an image data packet of the current image frame data.
5. The method of claim 1, wherein the specified video encoding format is an h.264 format and the target video encoding format is an HTTP-FLV format.
6. An h.264 format-based video stream transcoding apparatus for implementing the h.264 format-based video stream transcoding method according to any one of claims 1 to 5, said apparatus comprising:
the first receiving unit is used for receiving streaming media data packets of a source video stream, and the streaming media data packets are subjected to code stream transmission according to a specified video coding format;
the analyzing unit is used for acquiring target information according to the target position of the key frame in the streaming media data packet if the key frame of the streaming media data packet is detected, and analyzing the image frame of the streaming media data packet frame by frame;
a first generating unit, configured to sequentially generate an image data packet of each image frame data according to an acquisition sequence of each image frame data from the format conversion queue;
the monitoring unit is used for monitoring whether an output request for outputting a target video stream is received or not, wherein the target video stream is a video stream for code stream transmission according to a target video coding format;
the second generating unit is configured to generate a first target streaming media data packet based on the message format of the target video coding format, the target information and a first image data packet if the output request is received, where the first image data packet is a currently generated image data packet;
the output unit is used for outputting the first target streaming media data packet so as to respond to the output request;
the unit can execute caching of the target information, add image frame data into a format conversion queue to wait for transcoding processing, and discard the parsed streaming media data packet;
and the third execution unit is used for discarding the first image data packet and taking the next image data packet generated in sequence as the first image data packet if the output request is not received.
7. An electronic device comprising a memory and a processor, the memory and the processor being communicatively coupled to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the h.264 format-based video stream transcoding method of any of claims 1-5.
8. A computer-readable storage medium storing computer instructions for causing the computer to perform the h.264 format-based video stream transcoding method of any of claims 1-5.
CN202211390153.2A 2022-11-08 2022-11-08 H.264 format video stream transcoding method, device, equipment and medium Active CN115942000B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211390153.2A CN115942000B (en) 2022-11-08 2022-11-08 H.264 format video stream transcoding method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211390153.2A CN115942000B (en) 2022-11-08 2022-11-08 H.264 format video stream transcoding method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN115942000A CN115942000A (en) 2023-04-07
CN115942000B true CN115942000B (en) 2023-11-21

Family

ID=86699863

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211390153.2A Active CN115942000B (en) 2022-11-08 2022-11-08 H.264 format video stream transcoding method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115942000B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101990112A (en) * 2009-08-07 2011-03-23 未序网络科技(上海)有限公司 Internet request signal dynamic switching method
CN106034252A (en) * 2015-03-12 2016-10-19 深圳市腾讯计算机***有限公司 Streaming media processing method and device
CN108449650A (en) * 2018-04-09 2018-08-24 四川百视通科技有限公司 A kind of RTMP live streaming flows to HTTP FLV live TV streams real time conversion systems and its working method
CN111526387A (en) * 2020-03-30 2020-08-11 北京达佳互联信息技术有限公司 Video processing method and device, electronic equipment and storage medium
CN115278307A (en) * 2022-07-27 2022-11-01 天翼云科技有限公司 Video playing method, device, equipment and medium
CN115278323A (en) * 2022-06-30 2022-11-01 海信视像科技股份有限公司 Display device, intelligent device and data processing method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20110063004A (en) * 2009-12-04 2011-06-10 삼성전자주식회사 Apparatus and method for extracting key frames and apparatus and method for recording broadcast signal using thereof

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101990112A (en) * 2009-08-07 2011-03-23 未序网络科技(上海)有限公司 Internet request signal dynamic switching method
CN106034252A (en) * 2015-03-12 2016-10-19 深圳市腾讯计算机***有限公司 Streaming media processing method and device
CN108449650A (en) * 2018-04-09 2018-08-24 四川百视通科技有限公司 A kind of RTMP live streaming flows to HTTP FLV live TV streams real time conversion systems and its working method
CN111526387A (en) * 2020-03-30 2020-08-11 北京达佳互联信息技术有限公司 Video processing method and device, electronic equipment and storage medium
CN115278323A (en) * 2022-06-30 2022-11-01 海信视像科技股份有限公司 Display device, intelligent device and data processing method
CN115278307A (en) * 2022-07-27 2022-11-01 天翼云科技有限公司 Video playing method, device, equipment and medium

Also Published As

Publication number Publication date
CN115942000A (en) 2023-04-07

Similar Documents

Publication Publication Date Title
CN110557655B (en) Video picture display method and device, electronic equipment and storage medium
CN108200447B (en) Live broadcast data transmission method and device, electronic equipment, server and storage medium
CN112261377B (en) Web edition monitoring video playing method, electronic equipment and storage medium
CN110830460B (en) Connection establishing method and device, electronic equipment and storage medium
US10356483B2 (en) System and method to transmit data packets via a cellular network
CN113285931B (en) Streaming media transmission method, streaming media server and streaming media system
CN110996160A (en) Video processing method and device, electronic equipment and computer readable storage medium
CN109862400B (en) Streaming media transmission method, device and system
CN113079386B (en) Video online playing method and device, electronic equipment and storage medium
CN113573003A (en) Weak network-based audio and video real-time communication method, device and equipment
CN111918142B (en) Smoothing method, device, equipment and medium for converting national standard video code stream into RTP stream
CN115942000B (en) H.264 format video stream transcoding method, device, equipment and medium
CN110753259B (en) Video data processing method and device, electronic equipment and computer readable medium
CN112203105A (en) New media mobile live broadcasting method and system
CN116962179A (en) Network transmission optimization method and device, computer readable medium and electronic equipment
US11910033B2 (en) Streaming server, transmission method, and program
KR20140070896A (en) Method for video streaming and an electronic device thereof
CN114268830B (en) Cloud guide synchronization method, device, equipment and storage medium
CN115208864A (en) Data transmission method, device, equipment, vehicle and storage medium
CN112866745B (en) Streaming video data processing method, device, computer equipment and storage medium
CN110855645B (en) Streaming media data playing method and device
CN114979793A (en) Live broadcast data transmission method, device, system, equipment and medium
CN113409801A (en) Noise processing method, system, medium, and apparatus for real-time audio stream playback
CN108200481B (en) RTP-PS stream processing method, device, equipment and storage medium
CN113660063B (en) Spatial audio data processing method and device, storage medium and electronic equipment

Legal Events

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