CN112423018A - Media file coding transmission method, device, equipment and readable storage medium - Google Patents

Media file coding transmission method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN112423018A
CN112423018A CN202011167714.3A CN202011167714A CN112423018A CN 112423018 A CN112423018 A CN 112423018A CN 202011167714 A CN202011167714 A CN 202011167714A CN 112423018 A CN112423018 A CN 112423018A
Authority
CN
China
Prior art keywords
media file
original
transmission
data
coding
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.)
Pending
Application number
CN202011167714.3A
Other languages
Chinese (zh)
Inventor
王云华
徐日
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen TCL New Technology Co Ltd
Original Assignee
Shenzhen TCL New Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen TCL New Technology Co Ltd filed Critical Shenzhen TCL New Technology Co Ltd
Priority to CN202011167714.3A priority Critical patent/CN112423018A/en
Publication of CN112423018A publication Critical patent/CN112423018A/en
Pending legal-status Critical Current

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/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 or manipulating encoded video stream scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • 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/233Processing of audio elementary streams
    • H04N21/2335Processing of audio elementary streams involving reformatting operations of audio signals, e.g. by converting from one coding standard to another
    • 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/4302Content synchronisation processes, e.g. decoder synchronisation
    • H04N21/4305Synchronising client clock from received content stream, e.g. locking decoder clock with encoder clock, extraction of the PCR packets
    • 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/439Processing of audio elementary streams
    • H04N21/4398Processing of audio elementary streams involving reformatting operations of audio signals
    • 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 or rendering scenes according to encoded video stream scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream 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
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/854Content authoring
    • H04N21/8547Content authoring involving timestamps for synchronizing content

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The invention discloses a media file coding and transmitting method, a device, equipment and a computer readable storage medium, wherein the media file coding and transmitting method comprises the steps of firstly carrying out software coding on original media data, then carrying out packaging and packaging, and finally transmitting a transmission media file to be transmitted to target slave equipment when the transmission media file has integrity and effectiveness at the same time, so that the target slave equipment can obtain an integral and effective media file, and decoding the media file can be realized by adopting a software decoding mode, thereby reducing the hardware equipment requirement of the target slave equipment and facilitating the rapid and smooth playing of the subsequent target slave equipment on the media file.

Description

Media file coding transmission method, device, equipment and readable storage medium
Technical Field
The present invention relates to the field of data encoding, and in particular, to a method, an apparatus, a device, and a computer-readable storage medium for encoding and transmitting a media file.
Background
With the development of intelligent terminal technology, various electrical appliances in a kitchen are increasingly intelligent, and people add components such as an audio player and an intelligent screen on the kitchen electric appliance to enable the kitchen electric appliance to have the functions of audio and video playing. In an intelligent kitchen, information interaction often exists among intelligent kitchen appliances and among the intelligent kitchen appliances, mobile phones, computers and other equipment, for example, the mobile phones can send coded audio and video to intelligent kitchen appliances such as a range hood and an intelligent operation board, and the intelligent kitchen appliances can play the audio and video sent by the mobile phones by decoding the coded audio and video.
At present, a mobile phone end and a kitchen telegram generally adopt a hardware coding and decoding mode to realize transmission and playing of audio and video, the mobile phone end adopts a hardware coding mode to code the audio and video to be transmitted, and after receiving the coded audio and video sent by the mobile phone end, an intelligent kitchen telegram decodes and plays the coded audio and video in a hardware decoding mode. Although the hardware coding and decoding mode can ensure the processing speed between the mobile phone end and the intelligent kitchen power supply, the mobile phone end and the intelligent kitchen power supply are required to be provided with corresponding hardware bases (for example, a specific chip is required to be loaded to carry out hardware coding and decoding on audio and video), so that the technical problem that the existing user equipment has high requirements on equipment hardware by adopting a mode of transmitting the audio and video to the intelligent kitchen power supply through hardware coding is caused.
Disclosure of Invention
The invention mainly aims to provide a media file coding transmission method, and aims to solve the technical problem that the existing user equipment has high requirements on equipment hardware by adopting a mode of transmitting audio and video to intelligent kitchen electricity through hardware coding.
In order to achieve the above object, the present invention provides a media file encoding and transmitting method, which is applied to a master device, and comprises:
acquiring original media data, and performing software coding on the original media data to obtain an original data stream;
and packaging the original data stream to obtain a transmission media file, and transmitting the transmission media file to target slave equipment when the transmission media file has integrity and validity.
Optionally, the obtaining original media data, and performing software coding on the original media data to obtain an original data stream includes:
when a media file coding instruction is received, registering a callback function and determining a storage address of original media data based on the media file coding instruction;
taking the storage address as a function pointer of the callback function, and executing the callback function to acquire the original media data;
and carrying out video coding or audio coding on the original media data to obtain a video data stream or an audio data stream as the original data stream.
Optionally, the original media data comprises original audio data,
the performing video coding or audio coding on the original media data to obtain a video data stream or an audio data stream as the original data stream includes:
and adopting an advanced audio coding format for the original audio data, and coding the original audio data by using a preset audio sampling rate, a preset bit depth and a preset channel number to obtain the audio data stream as the original data stream.
Optionally, the packaging and encapsulating the original data stream to obtain a transmission media file includes:
acquiring timestamp information of the original data stream, and using the timestamp information as packet header information to perform packet packaging on the original data stream to obtain a packet media data packet;
and encapsulating the grouped media data packet with fixed byte length to obtain a transmission media data packet as the transmission media file.
Optionally, before transmitting the transmission media file to the target slave device when the transmission media file has integrity and validity, the method further includes:
acquiring actual recording duration and byte number corresponding to the transmission media file and recording timing parameters corresponding to the original media data;
judging whether the actual recording duration and the byte number meet the following conditions: the actual recording time length reaches a preset recording time length, and the byte number is greater than the recording timing parameter;
and if so, judging that the transmission media file has integrity and validity.
Optionally, the determining whether the actual recording duration and the number of bytes satisfy the following condition: after the actual recording duration reaches the preset recording duration and the number of bytes is greater than the recording timing parameter, the method further comprises the following steps:
if not, judging that the transmission media file does not have integrity and validity, re-executing the steps of obtaining the original media data and carrying out software coding on the original media data to obtain the original data stream.
Optionally, the transmitting the transmission media file to the target slave device when the transmission media file has integrity and validity includes:
when the transmission media file has integrity and validity, determining a target port number according to the current wireless network connection state;
and acquiring an interface address corresponding to the target slave equipment, and sending the transmission media file to the interface address according to the target port number so as to transmit the transmission media file to the target slave equipment.
In addition, to achieve the above object, the present invention further provides a media file encoding and transmitting device, including:
the data coding module is used for acquiring original media data and carrying out software coding on the original media data to obtain an original data stream;
and the file transmission module is used for packaging and packaging the original data stream to obtain a transmission media file, and transmitting the transmission media file to target slave equipment when the transmission media file has integrity and effectiveness.
Optionally, the data encoding module includes:
the address determining unit is used for registering a callback function and determining a storage address of original media data based on a media file coding instruction when the media file coding instruction is received;
the data acquisition unit is used for taking the storage address as a function pointer of the callback function and executing the callback function to acquire the original media data;
and the software coding unit is used for carrying out video coding or audio coding on the original media data to obtain a video data stream or an audio data stream as the original data stream.
Optionally, the original media data comprises original audio data,
the software coding unit is further configured to:
and adopting an advanced audio coding format for the original audio data, and coding the original audio data by using a preset audio sampling rate, a preset bit depth and a preset channel number to obtain the audio data stream as the original data stream.
Optionally, the file transfer module includes:
a packet packing unit, configured to obtain timestamp information of the original data stream, and use the timestamp information as packet header information to perform packet packing on the original data stream to obtain a packet media data packet;
and the fixed-length packaging unit is used for packaging the grouped media data packet in a fixed byte length manner to obtain a transmission media data packet as the transmission media file.
Optionally, the media file encoding and transmitting device further includes:
a parameter obtaining module, configured to obtain an actual recording duration and byte number corresponding to the transmission media file, and a recording timing parameter corresponding to the original media data;
the condition judgment module is used for judging whether the actual recording duration and the byte number meet the following conditions: the actual recording time length reaches a preset recording time length, and the byte number is greater than the recording timing parameter;
and the condition judgment module is used for judging that the transmission media file has integrity and validity if the transmission media file has the integrity and validity.
Optionally, the media file encoding and transmitting device further includes:
and the reacquiring module is used for determining that the transmission media file does not have integrity and validity if the transmission media file does not have integrity and validity, and re-executing the steps of acquiring the original media data and carrying out software coding on the original media data to obtain the original data stream.
Optionally, the file transfer module includes:
a port determining unit, configured to determine a target port number according to a current wireless network connection state when the transmission media file has integrity and validity;
and the file transmission unit is used for acquiring an interface address corresponding to the target slave equipment, and sending the transmission media file to the interface address according to the target port number so as to transmit the transmission media file to the target slave equipment.
In addition, to achieve the above object, the present invention further provides a media file encoding and transmitting device, including: the media file coding transmission program comprises a memory, a processor and a media file coding transmission program which is stored on the memory and can run on the processor, and the steps of the method are realized when the media file coding transmission program is executed by the processor.
In addition, to achieve the above object, the present invention further provides a computer readable storage medium, which stores a media file coding transmission program, and when the media file coding transmission program is executed by a processor, the media file coding transmission program realizes the steps of the method.
The invention provides a media file coding transmission method, a device, equipment and a computer readable storage medium. According to the media file coding and transmitting method, the original media data are subjected to software coding, then packaging and packaging are carried out, and finally when the transmission media file to be transmitted has integrity and effectiveness, the transmission media file is transmitted to the target slave device, so that the target slave device can obtain the complete and effective media file, the media file can be decoded by adopting a software decoding mode, the subsequent target slave device can quickly and smoothly play the media file conveniently, and the technical problem that the existing user equipment has high requirements on equipment hardware by adopting a mode of transmitting audio and video from hardware coding to intelligent kitchen is solved.
Drawings
FIG. 1 is a schematic structural diagram of a media file encoding and transmitting device in a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a media file encoding and transmitting method according to a first embodiment of the present invention;
FIG. 3 is a functional block diagram of the media file encoding and transmitting device according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 1, fig. 1 is a schematic structural diagram of a media file encoding and transmitting device in a hardware operating environment according to an embodiment of the present invention.
The media file coding and transmitting device in the embodiment of the invention is a terminal with an image capturing device, and is preferably an intelligent television.
As shown in fig. 1, the media file encoding transmission apparatus may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The optional user interface 1003 may include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory). The memory 1005 may alternatively be a memory device separate from the processor 1001 described above.
Those skilled in the art will appreciate that the media file delivery device architecture shown in fig. 1 does not constitute a limitation of the media file delivery device and may include more or fewer components than shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, the memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a media file encoding transmission program.
In the media file encoding and transmitting device shown in fig. 1, the network interface 1004 is mainly used for connecting to a background server and performing data communication with the background server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to call the media file encoding transmission program stored in the memory 1005 and perform the following operations:
acquiring original media data, and performing software coding on the original media data to obtain an original data stream;
and packaging the original data stream to obtain a transmission media file, and transmitting the transmission media file to target slave equipment when the transmission media file has integrity and validity.
Further, the acquiring original media data, and performing software coding on the original media data to obtain an original data stream includes:
when a media file coding instruction is received, registering a callback function and determining a storage address of original media data based on the media file coding instruction;
taking the storage address as a function pointer of the callback function, and executing the callback function to acquire the original media data;
and carrying out video coding or audio coding on the original media data to obtain a video data stream or an audio data stream as the original data stream.
Further, the original media data includes original audio data,
the performing video coding or audio coding on the original media data to obtain a video data stream or an audio data stream as the original data stream includes:
and adopting an advanced audio coding format for the original audio data, and coding the original audio data by using a preset audio sampling rate, a preset bit depth and a preset channel number to obtain the audio data stream as the original data stream.
Further, the packaging and packaging the original data stream to obtain a transmission media file includes:
acquiring timestamp information of the original data stream, and using the timestamp information as packet header information to perform packet packaging on the original data stream to obtain a packet media data packet;
and encapsulating the grouped media data packet with fixed byte length to obtain a transmission media data packet as the transmission media file.
Further, before transmitting the transmission media file to the target slave device when the transmission media file has integrity and validity, the method further includes:
acquiring actual recording duration and byte number corresponding to the transmission media file and recording timing parameters corresponding to the original media data;
judging whether the actual recording duration and the byte number meet the following conditions: the actual recording time length reaches a preset recording time length, and the byte number is greater than the recording timing parameter;
and if so, judging that the transmission media file has integrity and validity.
Further, the determination of whether the actual recording duration and the number of bytes satisfy the following conditions: after the actual recording duration reaches the preset recording duration and the number of bytes is greater than the recording timing parameter, the method further comprises the following steps:
if not, judging that the transmission media file does not have integrity and validity, re-executing the steps of obtaining the original media data and carrying out software coding on the original media data to obtain the original data stream.
Further, the transmitting the transmission media file to the target slave device when the transmission media file has integrity and validity includes:
when the transmission media file has integrity and validity, determining a target port number according to the current wireless network connection state;
and acquiring an interface address corresponding to the target slave equipment, and sending the transmission media file to the interface address according to the target port number so as to transmit the transmission media file to the target slave equipment.
Based on the hardware structure, the invention provides various embodiments of the media file coding and transmitting method.
With the development of intelligent terminal technology, various electrical appliances in a kitchen are increasingly intelligent, and people add components such as an audio player and an intelligent screen on the kitchen electric appliance to enable the kitchen electric appliance to have the functions of audio and video playing. In an intelligent kitchen, information interaction often exists among intelligent kitchen appliances and among the intelligent kitchen appliances, mobile phones, computers and other equipment, for example, the mobile phones can send coded audio and video to intelligent kitchen appliances such as a range hood and an intelligent operation board, and the intelligent kitchen appliances can play the audio and video sent by the mobile phones by decoding the coded audio and video.
At present, a mobile phone end and a kitchen telegram generally adopt a hardware coding and decoding mode to realize transmission and playing of audio and video, the mobile phone end adopts a hardware coding mode to code the audio and video to be transmitted, and after receiving the coded audio and video sent by the mobile phone end, an intelligent kitchen telegram decodes and plays the coded audio and video in a hardware decoding mode. Although the hardware coding and decoding mode can ensure the processing speed between the mobile phone end and the intelligent kitchen appliance, the mobile phone end and the intelligent kitchen appliance need to be provided with corresponding hardware bases, so that the technical problem that the existing user equipment has high requirements on equipment hardware in a mode of transmitting audio and video to the intelligent kitchen appliance by adopting hardware coding is caused.
In order to solve the technical problems, the invention provides a media file coding transmission method, namely, original media data is firstly subjected to software coding, then packaging and packaging are carried out, and finally when a transmission media file to be transmitted has integrity and effectiveness at the same time, the transmission media file is transmitted to target slave equipment, so that the target slave equipment can obtain the complete and effective media file, the decoding of the media file can be realized by adopting a software decoding mode, the subsequent target slave equipment can conveniently and smoothly play the media file, and the technical problem that the existing user equipment has high requirements on equipment hardware by adopting a mode of transmitting audio and video from hardware coding to intelligent kitchen is solved.
Referring to fig. 2, fig. 2 is a flowchart illustrating a first embodiment of a media file encoding and transmitting method.
A first embodiment of the present invention provides a media file encoding and transmitting method, where the media file encoding and transmitting method is applied to a host device, and the media file encoding and transmitting method includes:
step S10, acquiring original media data, and performing software coding on the original media data to obtain an original data stream;
in this embodiment, in different application scenarios, the main device may be an intelligent kitchen electrical device, or may be a user device such as a mobile phone, a computer, or a tablet. In contrast, the target slave device may also be a user device or an intelligent kitchen electrical device. That is, the data transmission process between the master device and the target slave device may be the transmission from the user device to the intelligent kitchen electrical device, the transmission from the intelligent kitchen electrical device to the user device, or the transmission from the intelligent kitchen electrical device to other intelligent kitchen electrical devices.
The original media data can be obtained from the existing media data in the main device, and can also be directly recorded in the current scene. If the original media data is obtained by on-site recording, the main device may program a buffer space of a certain size of a free processing buffer area in the video processor or the audio processor to buffer the recorded media data. For example, half of the free process buffer may be programmed to buffer currently recorded media data.
The type of the original media data can be video data, audio data, or a combination of video data and audio data, and the number of the audio data or the video data can be one or more. The software coding mode can be a video coding mode or an audio coding mode. The Video encoding mode may specifically be encoding using h.264, an Audio Video coding Standard (AVS), YUV, or a Windows Media file format (WMV), and the color encoding format for the Video image may be YUV or RGB. The Audio encoding method may specifically be encoding by using Advanced Audio Coding (AAC), MP3, WaveForm sound file (WAV, wave form), or ogg (ogg vorbis), and other formats. The original data stream is the data stream directly from the encoder, and may be an encoded video data stream, an audio data stream, or other encoded data stream.
Take the main device as a mobile phone, the target slave device as an intelligent kitchen electrical device (an intelligent range hood, an intelligent operation board, etc.), and the media file as an audio file. If a user selects a section of audio on the mobile phone at present and wants to send the selected section of audio to the intelligent kitchen electrical equipment for audio playing, the mobile phone needs to determine and acquire audio data specified by the user as the original media data, and then performs audio coding on the audio data according to a certain audio coding format through an encoder to obtain an audio data stream as the original data stream.
Step S20, packaging and encapsulating the original data stream to obtain a transmission media file, and transmitting the transmission media file to a target slave device when the transmission media file has integrity and validity.
In this embodiment, the packetizing operation may be performed by a PES packetizer, and the packetizing may be performed in a Program Stream (PS — Program Stream) or a Transport Stream (TS — Transport Stream). Integrity refers to file integrity, and may be verified by the actual recording duration of the transmitted media file, and validity may include recording validity and/or encoding validity. The recording validity can be verified by the number of bytes of the transmitted media file. Specifically, if the mobile phone performs the packing and packaging operations on the currently encoded audio data stream, a transmittable audio file can be obtained. At this time, in order to ensure that the audio content contained in the audio file is complete and successfully recorded, the actual recording duration and the number of bytes of file data of the audio file need to be verified by a preset file requirement.
When the main equipment is user equipment, the target slave equipment is intelligent kitchen electrical equipment; when the master device is an intelligent kitchen electrical device, the target slave device can be a user device or other intelligent kitchen electrical devices. The transmission mode of the transmission media file can be serial transmission or parallel transmission.
Specifically, if the mobile phone verifies the actual recording duration and the number of bytes of the audio file generated after the packaging and packaging, and then determines that the audio file meets the preset file requirement, the audio file can be transmitted to the intelligent kitchen electrical equipment in communication connection with the mobile phone (usually in wireless network connection). After receiving the audio file, the intelligent kitchen electrical equipment can decode the audio file in a mode corresponding to the encoding, and finally obtains original sound data to play audio. Since the encoding and decoding are inverse processes, the decoding process is not described herein.
It should be noted that the original data stream is a data stream containing only one kind of content, such as only video or only audio, and the transmission media file after being packaged is also a data stream containing only one kind of property, such as only video data stream, only audio data stream, and the like. Therefore, if the current master device needs to transmit audio and video to the target slave device, as a specific implementation manner, the master device may first obtain the original audio data and the original video data, then encode, package and encapsulate the original audio data and the original video data, and verify the integrity and validity of the original audio data and the original video data, and finally transmit the video file and the audio file to the target slave device after data packet synthesis when the audio file and the video file both pass the integrity and validity, so that the target slave device can obtain the video file and the audio file at the same time.
In the embodiment, original media data is obtained, and the original media data is subjected to software coding to obtain an original data stream; and packaging the original data stream to obtain a transmission media file, and transmitting the transmission media file to target slave equipment when the transmission media file has integrity and validity. According to the method, the original media data are firstly subjected to software coding, then packaged and encapsulated, and finally transmitted to the target slave device when the transmission media file to be transmitted has integrity and effectiveness at the same time, so that the target slave device can obtain the complete and effective media file, the decoding of the media file can be realized by adopting a software decoding mode, the subsequent target slave device can conveniently and rapidly and smoothly play the media file, and the technical problem that the existing user equipment has high requirements on equipment hardware by adopting a mode of transmitting audio and video from hardware coding to intelligent kitchen is solved.
Further, based on the first embodiment shown in fig. 2, a second embodiment of the media file encoding and transmitting method of the present invention is provided, in this embodiment, performing software encoding on the original media data to obtain an original data stream, including:
when a media file coding instruction is received, registering a callback function and determining a storage address of original media data based on the media file coding instruction;
taking the storage address as a function pointer of the callback function, and executing the callback function to acquire the original media data;
and carrying out video coding or audio coding on the original media data to obtain a video data stream or an audio data stream as the original data stream.
In this embodiment, the initiating mode of the media file encoding instruction may be a user initiating based on a touch screen or a key of the host device or remotely controlling the host device, or may be automatically initiated based on a preset program for the host device.
A callback function is a function called by a function pointer. If a pointer (address) to a function is passed as a parameter to another function, when the pointer is used to call the function to which it points, it is called a callback function.
Specifically, a scene of live recording audio is taken as an example for explanation. If the main device receives the media file coding instruction at present, the related service registration callback function is called, and an audio recording function is started to record original audio data. The main device selects half of the buffer space of the current idle processing buffer area of the audio processor to record the original audio data. And the main equipment acquires the storage address of the original audio data in the audio processor and takes the storage address as a function pointer of the callback function. The primary device obtains the original audio data by executing the callback function (the primary device transmits the address of the storage pointer, and does not move the audio data, so as to improve efficiency). The host device performs AAC format encoding (using an encoder) on raw audio data in Pulse Code Modulation (PCM) format to obtain an audio data stream output from the encoder.
Further, the original media data includes original audio data,
the performing video coding or audio coding on the original media data to obtain a video data stream or an audio data stream as the original data stream includes:
and adopting an advanced audio coding format for the original audio data, and coding the original audio data by using a preset audio sampling rate, a preset bit depth and a preset channel number to obtain the audio data stream as the original data stream.
In this embodiment, the bit depth is also called the sampling bit depth, and the bit depth of the audio determines the dynamic range. The sampling frequency represents the frequency range expression of the sound, and the higher the sampling frequency is, the larger the expressible frequency range is. The number of channels may include mono and binaural. The master device may specifically set the relevant audio parameters when encoding the original audio data. For example, an audio sampling rate of 48KHZ or 44.1KHZ, a bit depth of 8 bits or 16 bits, a channel number of two channels,
further, the packaging and packaging the original data stream to obtain a transmission media file includes:
acquiring timestamp information of the original data stream, and using the timestamp information as packet header information to perform packet packaging on the original data stream to obtain a packet media data packet;
and encapsulating the grouped media data packet with fixed byte length to obtain a transmission media data packet as the transmission media file.
In this embodiment, the original data stream is taken as an audio data stream (audio ES) for example. Where ES means the original stream (Elementary Streams). The method comprises the steps that a main device obtains time stamp information of an audio ES (ES) in a PCM (pulse code modulation) format output by an audio encoder, the time stamp information is used as packet header information, a PES (Packetized Elementary Stream) packer is input into an original data Stream in the PCM format for packet packing and packaging to obtain a Packetized audio data Stream (audio PES packet), then the audio PES packet is input into a Transport Stream (TS, Transport Stream) multiplexer for secondary packing and packaging to obtain an audio TS packet as the transmission media file. The length of the TS packet is fixed (188 bytes), the TS packet is a repackage of the PES packet, and the header information of the PES packet still exists in the TS packet.
In the embodiment, the original media data is further acquired through the callback function, so that the original data does not need to be moved, and the data acquisition efficiency is improved; the quality of the coded audio can be controlled by setting audio recording parameters; the original data stream is packaged and encapsulated, so that the original data stream is easier to transmit.
Further, based on the first embodiment shown in fig. 2, a third embodiment of the media file coding transmission method of the present invention is provided. In this embodiment, before transmitting the transmission media file to the target slave device when the transmission media file has integrity and validity, the method further includes:
acquiring actual recording duration and byte number corresponding to the transmission media file and recording timing parameters corresponding to the original media data;
judging whether the actual recording duration and the byte number meet the following conditions: the actual recording time length reaches a preset recording time length, and the byte number is greater than the recording timing parameter;
and if so, judging that the transmission media file has integrity and validity.
In this embodiment, the actual recording duration is an audio duration or a video duration corresponding to the transmission of the media file. The preset recording time is the original recording time of the original media file. The number of bytes is the total number of bytes of file data of the transmission media file. The main device judges the integrity of the transmission media file by judging whether the actual recording time length corresponding to the transmission media file reaches the preset recording time length or not, and judges the validity of the transmission media file by judging the byte number of the original media file. The recording timing parameter may be the number of timers corresponding to the original media file cached by the main device during recording
For example, when the original media file user records on the spot, the user recording time is 3 minutes, and the original recording time is 3 minutes, which is used as the preset recording time. Due to the fact that abnormal conditions such as acquisition interruption and the like may occur in the acquisition process, data acquisition is incomplete, and the actual recording time corresponding to the acquired data does not reach 3 minutes. In the audio recording process, the number of bytes of the digital audio signal obtained by quantizing, sampling and encoding the analog audio signal by the digital PCM should be greater than the number of the timers. Therefore, if the main device detects that the byte number of the transmission media file is larger than the recording timing parameter, the video and/or audio corresponding to the transmission media file can be judged to be successfully recorded, and the recording validity is achieved.
Further, the determination of whether the actual recording duration and the number of bytes satisfy the following conditions: the actual recording duration reaches a preset recording duration, and the actual recording duration also comprises the actual recording duration after the byte number is larger than the recording timing parameter;
if not, judging that the transmission media file does not have integrity and validity, re-executing the steps of obtaining the original media data and carrying out software coding on the original media data to obtain the original data stream.
In this embodiment, if the master device determines that the current transmission media file does not have integrity, validity, or both integrity and validity, the current encoding transmission process needs to be terminated, and the original media data needs to be obtained again.
Further, step S20 includes:
when the transmission media file has integrity and validity, determining a target port number according to the current wireless network connection state;
and acquiring an interface address corresponding to the target slave equipment, and sending the transmission media file to the interface address according to the target port number so as to transmit the transmission media file to the target slave equipment.
In this embodiment, if the master device determines that the current transmission media file has integrity and validity, a data field object may be created to obtain a CPU free space of the wireless network connection device, and a port number is allocated according to the free space. (the larger the idle, the more assigned port numbers). And the master device acquires the interface address of the target slave device and sends the transmission media file to the interface address of the target slave device by the allocated port number.
In this embodiment, further, by correspondingly determining that the actual recording time of the transmission media file is longer than the number of bytes, and not transmitting the transmission media file when the transmission media file does not have integrity and validity at the same time, the integrity and validity of the transmission media file can be conveniently determined, and the transmission media file transmitted to the target slave device is ensured to be complete and valid.
The invention also provides a media file coding and transmitting device.
The media file coding and transmitting device comprises:
the data encoding module 10 is configured to acquire original media data, and perform software encoding on the original media data to obtain an original data stream;
the file transmission module 20 is configured to package and encapsulate the original data stream to obtain a transmission media file, and transmit the transmission media file to a target slave device when the transmission media file has integrity and validity.
The invention also provides media file coding and transmitting equipment.
The media file coding transmission device comprises a processor, a memory and a media file coding transmission program which is stored on the memory and can run on the processor, wherein when the media file coding transmission program is executed by the processor, the steps of the media file coding transmission method are realized.
The method for implementing the media file coding transmission program when executed can refer to the embodiments of the media file coding transmission method of the present invention, and is not described herein again.
The invention also provides a computer readable storage medium.
The computer readable storage medium of the present invention stores a media file coding transmission program, and the media file coding transmission program, when executed by a processor, implements the steps of the media file coding transmission method as described above.
The method for implementing the media file coding transmission program when executed can refer to the embodiments of the media file coding transmission method of the present invention, and is not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for causing a media file encoding transmission device to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A media file coding transmission method is applied to a master device, and comprises the following steps:
acquiring original media data, and performing software coding on the original media data to obtain an original data stream;
and packaging the original data stream to obtain a transmission media file, and transmitting the transmission media file to target slave equipment when the transmission media file has integrity and validity.
2. The method of claim 1, wherein the obtaining raw media data, the software encoding the raw media data to obtain a raw data stream, comprises:
when a media file coding instruction is received, registering a callback function and determining a storage address of original media data based on the media file coding instruction;
taking the storage address as a function pointer of the callback function, and executing the callback function to acquire the original media data;
and carrying out video coding or audio coding on the original media data to obtain a video data stream or an audio data stream as the original data stream.
3. The method of claim 2, wherein the original media data comprises original audio data,
the performing video coding or audio coding on the original media data to obtain a video data stream or an audio data stream as the original data stream includes:
and adopting an advanced audio coding format for the original audio data, and coding the original audio data by using a preset audio sampling rate, a preset bit depth and a preset channel number to obtain the audio data stream as the original data stream.
4. The method of claim 1, wherein the packaging the original data stream into a transmission media file comprises:
acquiring timestamp information of the original data stream, and using the timestamp information as packet header information to perform packet packaging on the original data stream to obtain a packet media data packet;
and encapsulating the grouped media data packet with fixed byte length to obtain a transmission media data packet as the transmission media file.
5. The method of claim 1, wherein prior to transferring the transfer media file to the target slave device when the transfer media file has integrity and validity, further comprising:
acquiring actual recording duration and byte number corresponding to the transmission media file and recording timing parameters corresponding to the original media data;
judging whether the actual recording duration and the byte number meet the following conditions: the actual recording time length reaches a preset recording time length, and the byte number is greater than the recording timing parameter;
and if so, judging that the transmission media file has integrity and validity.
6. The method of claim 5, wherein the determining whether the actual recording duration and the number of bytes satisfy the following condition: after the actual recording duration reaches the preset recording duration and the number of bytes is greater than the recording timing parameter, the method further comprises the following steps:
if not, judging that the transmission media file does not have integrity and validity, re-executing the steps of obtaining the original media data and carrying out software coding on the original media data to obtain the original data stream.
7. The method of claim 1, wherein said transferring the transfer media file to a target slave device when the transfer media file has integrity and validity comprises:
when the transmission media file has integrity and validity, determining a target port number according to the current wireless network connection state;
and acquiring an interface address corresponding to the target slave equipment, and sending the transmission media file to the interface address according to the target port number so as to transmit the transmission media file to the target slave equipment.
8. A media file encoding transmission device, wherein the media file encoding transmission device comprises:
the data coding module is used for acquiring original media data and carrying out software coding on the original media data to obtain an original data stream;
and the file transmission module is used for packaging and packaging the original data stream to obtain a transmission media file, and transmitting the transmission media file to target slave equipment when the transmission media file has integrity and effectiveness.
9. A media file encoding transmission device, characterized in that the media file encoding transmission device comprises: memory, processor and media file encoding transmission program stored on the memory and executable on the processor, the media file encoding transmission program when executed by the processor implementing the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, on which a media file encoding transmission program is stored, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 7.
CN202011167714.3A 2020-10-27 2020-10-27 Media file coding transmission method, device, equipment and readable storage medium Pending CN112423018A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011167714.3A CN112423018A (en) 2020-10-27 2020-10-27 Media file coding transmission method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011167714.3A CN112423018A (en) 2020-10-27 2020-10-27 Media file coding transmission method, device, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN112423018A true CN112423018A (en) 2021-02-26

Family

ID=74840746

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011167714.3A Pending CN112423018A (en) 2020-10-27 2020-10-27 Media file coding transmission method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN112423018A (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101267624A (en) * 2008-05-09 2008-09-17 嘉兴闻泰通讯科技有限公司 Method for storing stream media of TD mobile phone
CN103596035A (en) * 2013-11-04 2014-02-19 四川九州电子科技股份有限公司 System and method for recording DVB code stream through digital set top box
CN105657337A (en) * 2014-11-20 2016-06-08 广东中星电子有限公司 Video data processing method and apparatus
CN106685908A (en) * 2016-07-11 2017-05-17 南京兜秘网络科技有限公司 Protection method for audio data completeness in audio live broadcasting process
CN107613409A (en) * 2017-09-27 2018-01-19 京信通信系统(中国)有限公司 The processing method and processing device of multi-medium data
CN108848406A (en) * 2015-07-27 2018-11-20 青岛海信移动通信技术股份有限公司 A kind of method for recording and device of multimedia file
CN109474854A (en) * 2018-11-29 2019-03-15 广州市百果园信息技术有限公司 Video broadcasting method, the generation method of playlist and relevant device
CN110650307A (en) * 2019-10-30 2020-01-03 广州河东科技有限公司 QT-based audio and video plug flow method, device, equipment and storage medium
CN111182342A (en) * 2019-12-24 2020-05-19 腾讯科技(深圳)有限公司 Media data playing method, device, equipment and storage medium based on DLNA
CN111755017A (en) * 2020-07-06 2020-10-09 全时云商务服务股份有限公司 Audio recording method and device for cloud conference, server and storage medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101267624A (en) * 2008-05-09 2008-09-17 嘉兴闻泰通讯科技有限公司 Method for storing stream media of TD mobile phone
CN103596035A (en) * 2013-11-04 2014-02-19 四川九州电子科技股份有限公司 System and method for recording DVB code stream through digital set top box
CN105657337A (en) * 2014-11-20 2016-06-08 广东中星电子有限公司 Video data processing method and apparatus
CN108848406A (en) * 2015-07-27 2018-11-20 青岛海信移动通信技术股份有限公司 A kind of method for recording and device of multimedia file
CN106685908A (en) * 2016-07-11 2017-05-17 南京兜秘网络科技有限公司 Protection method for audio data completeness in audio live broadcasting process
CN107613409A (en) * 2017-09-27 2018-01-19 京信通信系统(中国)有限公司 The processing method and processing device of multi-medium data
CN109474854A (en) * 2018-11-29 2019-03-15 广州市百果园信息技术有限公司 Video broadcasting method, the generation method of playlist and relevant device
CN110650307A (en) * 2019-10-30 2020-01-03 广州河东科技有限公司 QT-based audio and video plug flow method, device, equipment and storage medium
CN111182342A (en) * 2019-12-24 2020-05-19 腾讯科技(深圳)有限公司 Media data playing method, device, equipment and storage medium based on DLNA
CN111755017A (en) * 2020-07-06 2020-10-09 全时云商务服务股份有限公司 Audio recording method and device for cloud conference, server and storage medium

Similar Documents

Publication Publication Date Title
EP2801210B1 (en) Bi-directional tunneling via user input back channel for wireless displays
KR101917174B1 (en) Method for transmitting stream between electronic devices and electronic device for the method thereof
CN108874337B (en) Screen mirroring method and device
US20060188096A1 (en) Systems and methods for remotely controlling computer applications
CN104834623A (en) Audio playing method and audio playing device
WO2013152580A1 (en) Method for converting online media data or playing video and apparatus thereof
KR20100083233A (en) Apparatus and method for multimedia file streaming in portable terminal
WO2015176648A1 (en) Method and device for transmitting data in intelligent terminal to television terminal
CN113271479B (en) Playing processing method and device and related equipment
WO2014139068A1 (en) Television signal processing method and device
US8935362B2 (en) Multi-media file emulation device
CN108809924B (en) Method and apparatus for performing network real-time communication
WO2012034323A1 (en) Method, system and data card for communicating with wireless network using data card
CN111885412B (en) HDMI signal screen transmission method and wireless screen transmission device
CN112423018A (en) Media file coding transmission method, device, equipment and readable storage medium
JP2006319851A (en) Portable terminal, streaming communication system, streaming communication method, and streaming communication program
CN108124183B (en) Method for synchronously acquiring video and audio to perform one-to-many video and audio streaming
CN115065669A (en) Audio transmission method and device, electronic equipment and storage medium
CA2577087A1 (en) Systems and methods for remotely controlling computer applications
CN114024787A (en) Remote control method, device, equipment and storage medium for smart home
KR102079339B1 (en) Apparatas and method for contents transfer to dlna connected device of cloud system in an electronic device
WO2023216798A1 (en) Audio and video transcoding apparatus and method, and device, medium and product
KR20150000844A (en) Method and apparatus for converting a content in a multimedia system
KR100501169B1 (en) Mobile Communication Terminal for Processing Multimedia Contents and Method of Processing Multimedia Contents in The Same
WO2022166591A1 (en) Method and apparatus for playing live streaming resource, and storage medium and electronic device

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