Video stream pushing method and device, and intelligent terminal
By registering a virtual camera device in the Camera HAL layer of the Android system and performing video streaming processing, the problem of limitations in the virtual camera video stream push operation in the prior art is solved, and video stream push without root operation is achieved, and the push efficiency is improved through hardware acceleration.
Patent Information
- Application Number
- CN202510323648.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-04-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the video stream push of virtual cameras has operational limitations, and requires root operation of the Android system and rely on a third-party platform framework.
Register a virtual camera device in the Camera HAL layer of the Android system, obtain video streaming data and process it, push the processed video streaming data to the camera hardware buffer of the Android system through the virtual camera device, and finally distribute the video stream to the user interface of the target application through the CameraService.
The push of virtual camera video streams can be achieved without root operation, avoiding the limitations of relying on third-party platform frameworks, improving operation convenience and flexibility, reducing user operation difficulty, and improving push energy saving and efficiency through hardware acceleration processing.
Smart Images

Figure CN119854542A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of smart terminal technology, and in particular to a video stream push method and device, and a smart terminal. Background Art
[0002] In the current state of the art, pushing a virtual camera video stream primarily relies on rooting the Android system and then installing the Xposed Framework. By accessing the Xposed Installer or Lsposed Manager, users need to locate the "android_virtual_cam" module, check the box to enable the feature, and restart the device to ensure the change takes effect. This process involves using the Xposed software to simulate a virtual camera and push the video stream data through the third-party Xposed platform framework. This solution requires rooting the Android system and manually installing the third-party platform framework to achieve the desired functionality, which has certain operational limitations.
[0003] The above content is only used to assist in understanding the technical solution of this application and does not constitute an admission that the above content is prior art. Summary of the Invention
[0004] The main purpose of this application is to provide a video stream push method and device, and an intelligent terminal, aiming to solve the technical problem that the video stream push of virtual cameras in the existing technology has certain operational limitations.
[0005] To achieve the above objectives, this application proposes a video stream push method, comprising:
[0006] Register the virtual camera device in the Camera HAL layer of the Android system;
[0007] Acquire video stream data and process the video stream data;
[0008] Push the processed video stream data to the Android system's camera hardware buffer through the virtual camera device;
[0009] Distribute the video stream to the target application's user interface through CameraService.
[0010] In one embodiment, the step of registering a virtual camera device in the Camera HAL layer of the Android system includes:
[0011] Define the sensor name, interface type, and physical properties of the virtual camera device in the Android system's camera configuration file so that the Android system can identify the virtual camera device as a legitimate camera device.
[0012] Read the system property value and, when it is the preset value, trigger the Camera HAL layer to create a virtual camera adapter to manage the data stream of the virtual camera device.
[0013] In one embodiment, the step of registering a virtual camera device in the Camera HAL layer of the Android system further includes:
[0014] In the Camera HAL layer, the total number of virtual camera devices and physical camera devices is obtained, and device information of the virtual camera devices and the physical camera devices are distinguished, so that the virtual camera devices and the physical camera devices coexist.
[0015] In one embodiment, the step of obtaining video stream data and processing the video stream data includes:
[0016] Get raw video stream data from a local video file or a network server;
[0017] The original video stream data is preprocessed and the preprocessed data is encoded; the preprocessing includes at least one of adding a filter, a watermark, and adjusting the brightness.
[0018] In one embodiment, the steps of preprocessing the original video stream data and encoding the preprocessed data further include dynamically controlling the resource occupancy rate of video stream push, which is specifically achieved by at least one of the following methods:
[0019] Adjust video resolution based on system CPU load;
[0020] Adjust hardware encoding speed;
[0021] Pause video streaming when there is no application call.
[0022] In one embodiment, the step of pushing the processed video stream to the camera hardware buffer of the Android system through the virtual camera device further includes:
[0023] Dynamically detect the integrity of video stream data. If data interruption or format error is detected, switch to the backup video source or generate default video frames to maintain push continuity.
[0024] In one embodiment, the step of distributing the video stream to the user interface of the target application through the CameraService includes:
[0025] The target application requests the camera device through the Camera API;
[0026] CameraService binds the data stream of the virtual camera device to the Surface interface specified by the application based on the camera device requested by the target application;
[0027] The target application interface displays the video stream pushed by the virtual camera device in real time.
[0028] In one embodiment, the video stream pushing method further includes:
[0029] An SDK API interface is provided through a virtual camera adapter to support third-party applications to customize video stream parameters; the video stream parameters include at least one of resolution, frame rate, and encoding format.
[0030] In addition, to achieve the above-mentioned purpose, the present application also proposes a video stream pushing device, which includes: a memory, a processor, and a video stream pushing program stored on the memory and runnable on the processor, and the video stream pushing program is configured to implement the steps of the video stream pushing method.
[0031] In addition, to achieve the above-mentioned purpose, the present application also proposes that the smart terminal uses the video stream pushing method, or the smart terminal includes the video stream pushing device.
[0032] The video stream push method proposed in this application registers a virtual camera device in the Android system's Camera HAL layer; then obtains and processes the video stream data; then, through the virtual camera device, pushes the processed video stream data to the Android system's camera hardware buffer; and finally, distributes the video stream to the target application's user interface through CameraService. This allows the push of virtual camera video streams without requiring root access. Compared to existing technologies, this application operates directly in the Android system's Camera HAL layer, avoiding the limitations of relying on third-party platform frameworks, improving operational convenience and flexibility while reducing operational difficulty for users. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0034] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0035] Figure 1 A flowchart of an embodiment of a video streaming push method provided in this application;
[0036] Figure 2 A flowchart of another embodiment of the video stream push method of the present application is provided;
[0037] Figure 3 A flowchart of another embodiment of the video stream push method of the present application is provided;
[0038] Figure 4 A flowchart of another embodiment of the video stream push method of the present application is provided;
[0039] Figure 5 A structural diagram of an embodiment of a video stream push device provided in this application.
[0040] Description of Figure Numbers:
[0041] 10. Memory; 20. Processor.
[0042] The purpose, features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0043] It should be understood that the specific embodiments described herein are merely used to explain the technical solutions of the present application and are not intended to limit the present application.
[0044] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0045] The main solution of the embodiment of the present application is: register a virtual camera device in the Camera HAL layer of the Android system; then obtain video stream data and process the video stream data; then push the processed video stream data to the camera hardware buffer of the Android system through the virtual camera device; finally, distribute the video stream to the user interface of the target application through CameraService.
[0046] In this embodiment, for ease of description, the following description is made with identification of a video stream pushing device as the execution subject.
[0047] In the existing technology, the push of virtual camera video streams mainly relies on rooting the Android system and then installing the Xposed Framework. By entering the Xposed Installer or Lsposed manager, users need to find the "android_virtual_cam" module, check it to enable the function, and restart the device to ensure that the change takes effect. This process involves using Xposed software to simulate a virtual camera and push video stream data through the third-party Xposed platform framework. In other words, the above solution requires rooting the Android system and requires users to manually install the third-party platform framework to achieve the required functions, which has certain operational limitations.
[0048] Rooting an Android device generally refers to gaining superuser privileges within the Android operating system. This is often used to bypass manufacturer restrictions, allowing users to uninstall certain pre-installed apps by the manufacturer, carrier, or third-party distributors, and to run apps that require superuser privileges.
[0049] Through the solution provided by this application, this application can push the virtual camera video stream without rooting the Android system, which improves the convenience and flexibility of operation. Compared with the existing technology, this application avoids the limitation of relying on third-party platform framework by operating directly on the Camera HAL layer of the Android system, further reducing the user's operation difficulty.
[0050] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, mobile phone, etc., or an electronic device capable of implementing the above functions, a video streaming push device, etc. The following uses a video streaming push device as an example to illustrate this embodiment and the following embodiments.
[0051] Based on this, the embodiment of the present application provides a video stream push method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the video stream pushing method of the present application.
[0052] In this embodiment, the video stream pushing method includes steps S100 to S400:
[0053] Step S100: registering a virtual camera device in the Camera HAL layer of the Android system.
[0054] It should be noted that the Camera HAL layer is the hardware abstraction layer (HardwareAbstraction Layer) of the Android system, which is used to define the standard interface between camera hardware and upper-level applications and shield the underlying hardware differences.
[0055] In one possible implementation, reference Figure 2 , step S100 includes steps S110 to S120, wherein:
[0056] Step S110 , defining the sensor name, interface type, and physical properties of the virtual camera device in a camera configuration file of the Android system, so that the Android system can identify the virtual camera device as a legitimate camera device.
[0057] In this embodiment, the details of a virtual camera device are defined in the Android system's camera configuration file. The sensor name of the virtual camera device is assigned a unique identifier (e.g., VIRTUAL_MIPI) by the virtual camera. The system uses this name to identify the device type and avoid conflicts with other cameras. The interface type of the virtual camera can specifically define the data transmission protocol (e.g., MIPI, USB, or SoC) between the virtual camera and the system, simulating the hardware interface behavior of a real camera. This allows the system to ensure that data streams are processed according to the corresponding interface protocol. If the interface type is incorrect, the system may reject registration due to protocol mismatch or cause data anomalies. The physical properties of the virtual camera include clock frequency, data format, and camera orientation. The clock frequency determines the data acquisition and transmission rate, which matches the video stream frame rate to avoid lag or screen distortion caused by clock asynchrony. The data format (e.g., CamSys_Fmt_Yuv422_8b) defines the pixel format of the video stream, ensuring that the system correctly interprets the data. The camera orientation, which refers to the virtual camera's installation direction (front / rear) and image rotation angle, ensures that applications display the image correctly. By defining the sensor name, interface type, and physical properties of the virtual camera device in the Android system's camera configuration file, the system can recognize and accept the virtual camera device as a legitimate hardware component. This step ensures the legitimacy and compatibility of the virtual camera device in the Android system, laying the foundation for subsequent video stream push.
[0058] Step S120 , reading the system property value, and when it is a preset value, triggering the Camera HAL layer to create a virtual camera adapter to manage the data flow of the virtual camera device.
[0059] In this embodiment, the preset value can be a technical identifier or a specific code, such as "none". When the system detects the preset value, it will automatically trigger the relevant mechanism of the Camera HAL layer to create a virtual camera adapter. As an intermediate layer, the virtual camera adapter is responsible for managing the data stream related to the virtual camera device, including the reception, processing and forwarding of data. Through this mechanism, this application can achieve effective management and push of the virtual camera video stream without relying on a third-party platform framework, ensuring the stability and continuity of the video stream.
[0060] In a feasible implementation, after creating a virtual camera adapter, an SDK API interface is provided through the virtual camera adapter to support third-party applications to customize video stream parameters; the video stream parameters include at least one of resolution, frame rate, and encoding format.
[0061] In this embodiment, through the SDK API interface provided by the virtual camera adapter, third-party applications can flexibly set the parameters of the video stream according to actual needs. For example, some applications may require high-definition video streams to ensure that the details of the picture are clearly visible. In this case, the resolution of the video stream can be adjusted to 1080P or higher through the interface; and for some application scenarios with high real-time requirements, such as video calls, the frame rate can be adjusted through the interface to ensure the smoothness of the picture. At the same time, different application scenarios may have different requirements for the encoding format of the video stream. The embodiment of the present application also supports customized settings of the encoding format through the interface, which is highly scalable and can meet diverse application needs.
[0062] In a feasible implementation, step S100 also includes obtaining the total number of virtual camera devices and physical camera devices in the Camera HAL layer, and distinguishing the device information of virtual camera devices and physical camera devices so that virtual camera devices and physical camera devices can coexist. In this embodiment, by obtaining the total number of virtual camera devices and physical camera devices, the system can fully grasp the overall situation of the camera devices. Subsequently, the system clearly distinguishes the device information of the two types of camera devices, which includes but is not limited to device ID, type identification, configuration parameters, etc., thereby ensuring the coexistence and interoperability of virtual camera devices and physical camera devices in the system, and avoiding functional conflicts or performance degradation caused by confusion of device information. Users can flexibly choose to use virtual cameras or physical cameras in applications according to actual needs, thereby further improving the flexibility of the system and user experience.
[0063] In this embodiment, by registering a virtual camera device in the Camera HAL layer of the Android system, root operation can be avoided, that is, there is no need to crack system permissions, thereby ensuring device security; in addition, users can push the virtual camera video stream without manually installing a third-party framework, which simplifies the operation process and improves the user experience.
[0064] Step S200: Acquire video stream data and process the video stream data. In this embodiment, the quality and adaptability of the video stream are ensured by acquiring and processing the video stream data.
[0065] In one possible implementation, reference Figure 3 Step S200 includes steps S210 to S220, wherein:
[0066] Step S210: Obtain original video stream data from a local video file or a network server.
[0067] In this embodiment, the original video stream data can be obtained by reading a locally stored video file or downloading video stream data from a remote server via a network request. It is understood that the original video stream data described in this application can specifically be a video composed of multiple images, that is, content that can be viewed directly; the original video data can also be audio data, and can also be collected and played in a pure audio format; in addition, the original video data can also be a combination of video data and audio data to form complete audio-visual content. When obtaining the original video stream data from a local video file, the locally stored file can be read through the file system interface to parse the original video stream data. When obtaining the original video stream data from a network server, a request can be sent to the remote server via a network communication protocol (such as HTTP, RTSP, etc.) to receive the video stream data returned by the server. This makes the acquisition of video stream data more flexible and diverse, supporting both the acquisition of locally pre-stored files and the acquisition of video streams from the network in real time.
[0068] Step S220 , preprocessing the original video stream data and encoding the preprocessed data; the preprocessing includes at least one of adding a filter, a watermark, and adjusting brightness.
[0069] In this embodiment, preprocessing the raw video stream data can optimize the video stream quality, making it more compatible with the requirements of the target application. For example, adding filters can enhance the visual effects of the video and make it more appealing; adding watermarks can achieve copyright protection or brand promotion; and adjusting brightness can ensure that the video remains clear under various lighting conditions. After preprocessing, the system encodes the video stream data and converts it into a format suitable for transmission and display within the Android system. This reduces data volume, improves transmission efficiency, and ensures data security, ensuring efficient transmission and real-time display of the video stream data. When the raw video data is audio data, preprocessing includes at least one of mixing, noise reduction, and adding sound effects. In this embodiment, preprocessing the audio data can improve audio quality, making it more compatible with the requirements of the target application. For example, mixing can blend multiple audio elements to create rich sound effects; noise reduction can reduce background noise in the audio and improve speech clarity; and adding sound effects such as echo and voice change can increase the interest and expressiveness of the audio. After preprocessing, the system will also encode the audio data for efficient transmission and playback in the Android system.
[0070] In a specific embodiment, the steps of preprocessing the raw video stream data and encoding the preprocessed data can be further refined. For example, appropriate filter types and watermark styles can be selected based on the specific requirements of the target application, as well as specific brightness values. Furthermore, during the encoding process, appropriate encoding formats and compression ratios can be selected based on network bandwidth and storage space limitations to minimize data volume while ensuring video quality.
[0071] Furthermore, the video stream push method of this embodiment can also include real-time quality testing of the pre-processed and encoded video stream data. By testing key parameters such as the video stream's frame rate, bit rate, and resolution, quality issues in the video stream, such as freezes, screen distortion, and delays, can be promptly detected and addressed, thereby ensuring that the video stream pushed to the target application has stable quality.
[0072] In a feasible implementation, step S220 also includes dynamically controlling the resource occupancy of video stream push, specifically by at least one of the following methods: adjusting the video resolution according to the system CPU load, adjusting the hardware encoding speed, and pausing video stream push when there is no application call.
[0073] In this embodiment, by dynamically controlling the resource occupancy rate of video stream push, the present application can ensure the rational allocation and efficient utilization of system resources. When the system CPU load is high, by reducing the video resolution, the CPU processing burden can be reduced, avoiding the situation where the system is stuck or crashes due to insufficient resources. At the same time, adjusting the hardware encoding speed can further save system resources and improve overall operating efficiency while ensuring video quality. In addition, pausing video stream push when there is no application call can avoid unnecessary resource consumption and extend the battery life and service life of the device. These measures work together to make the video stream push method of the present application more intelligent and efficient, and suitable for various complex application scenarios.
[0074] Step S300: Push the processed video stream data to the camera hardware buffer of the Android system through the virtual camera device.
[0075] It can be understood that the camera hardware buffer is a memory area in the Android system used to temporarily store video stream data captured or pushed by the camera. By pushing the processed video stream data to this buffer through the virtual camera device, the system can identify and process this data, and then distribute it to the target application for display or further processing. This step ensures that the video stream data can be correctly transmitted and displayed in the Android system. During the push process, the system will intelligently adjust the push speed and data format based on the status of the camera hardware buffer and the characteristics of the video stream data to ensure data stability and continuity. At the same time, the video stream data pushed by the virtual camera device can interact and be shared with other applications, further expanding the application scenarios and possibilities of video streaming.
[0076] In a feasible implementation, step S300 further includes dynamically detecting the integrity of the video stream data. If data interruption or format error is detected, switching to a backup video source or generating a default video frame to maintain push continuity.
[0077] In this embodiment, by dynamically detecting the integrity of the video stream data, the present application can further improve the stability and reliability of video stream push. During the video stream push process, data interruption or format error may occur due to network fluctuations, equipment failure and other reasons. If not handled in a timely manner, these problems will cause the video stream push to be interrupted, affecting the user experience. Therefore, the present application adds a function of dynamically detecting the integrity of the video stream data in step S300. When a data interruption or format error is detected, the system will immediately take countermeasures, such as switching to a backup video source or generating a default video frame to maintain the continuity of the video stream push. This function ensures that even in the event of an abnormal situation, users can obtain stable and continuous video streaming services, thereby improving the robustness of the system and the user experience.
[0078] Step S400, distributes the video stream to the user interface of the target application through CameraService. In this embodiment, CameraService, as a service component in the Android system, is responsible for managing camera-related functions and services. Through CameraService, the system can distribute the video stream data pushed by the virtual camera device to the target application, such as video conferencing software, live broadcast application, etc., and then display it on the user interface or further process it. This step realizes the seamless transmission and display of video stream data from the virtual camera device to the target application, ensuring the integrity and availability of the video stream service. During the distribution process, CameraService will intelligently adjust the parameters of the video stream, such as resolution, frame rate, etc., according to the needs of the target application and the system resource status, to provide the best user experience. At the same time, CameraService can also allow multiple applications to call the virtual camera device at the same time, realizing multi-channel distribution and sharing of video streams, further expanding the application scenarios and possibilities of video streams.
[0079] In one possible implementation, reference Figure 4 , step S400 includes steps S410 to S430, wherein:
[0080] Step S410: The target application requests a camera device through the Camera API.
[0081] In this embodiment, when the target application needs to obtain video stream data, it will initiate a request to the system through the Camera API, requesting permission to use the camera device and obtain the data stream. The Camera API is a standard interface provided by the Android system, allowing applications to interact with camera hardware to implement functions such as video stream capture, processing, and display.
[0082] In step S420 , CameraService binds the data stream of the virtual camera device to the Surface interface specified by the application according to the camera device requested by the target application.
[0083] In this embodiment, the Surface interface is a component used to display video streams in the Android system and is associated with the user interface of the application. After receiving a request from the target application, the CameraService will bind the corresponding video stream data to the Surface interface specified by the application based on the camera device specified by the application (a virtual camera device in this embodiment), thereby realizing the transmission and display of video stream data from the system layer to the application layer, ensuring the real-time and availability of the video stream service. By binding the data stream of the virtual camera device to the Surface interface of the application, this application can achieve seamless push and display of the virtual camera video stream without changing the existing Android system architecture and application code, thereby improving the compatibility and ease of use of the system.
[0084] Step S430, the target application interface displays the pushed video stream in real time. In this embodiment, after the video stream data is successfully bound to the Surface interface of the application, the target application can receive and display the video stream data through the interface. This enables the application to obtain and display the video stream pushed by the virtual camera device in real time, meeting the needs of application scenarios such as video conferencing and live broadcasting. During the display process, the application can further process and optimize the video stream according to actual needs, such as adjusting the screen layout, adding interactive elements, etc., to provide a richer user experience. At the same time, since the video stream push method of the present application supports multi-channel distribution and sharing, multiple applications can call the virtual camera device at the same time to achieve multi-screen display and interaction of the video stream, further expanding the application scenarios and possibilities of the video stream.
[0085] In this embodiment, a virtual camera device is registered in the Android system's Camera HAL layer; video stream data is obtained and processed; the processed video stream data is then pushed to the Android system's camera hardware buffer via the virtual camera device; and finally, the video stream is distributed to the target application's user interface via the CameraService. This allows the push of virtual camera video streams without requiring root access. Compared to existing technologies, this application operates directly within the Android system's Camera HAL layer, avoiding the limitations of relying on third-party platform frameworks, improving operational convenience and flexibility, and reducing user experience. Furthermore, the third-party Xposed framework operates at the user level, hooking into system processes to implement its functions and lacking direct access to hardware acceleration modules. All video processing (such as encoding, decoding, and rendering) relies on CPU computation, resulting in a surge in resource consumption. However, since this application implements a virtual camera based on the Android system's Camera framework, it can directly interact with the Hardware Abstraction Layer (HAL) and leverage underlying hardware resources (such as the ISP, GPU, and DSP) to achieve hardware-accelerated processing of the video stream, reducing system CPU usage and making video stream push more energy-efficient and efficient. In addition, it should be noted that Xposed requires root permissions and modifies the system runtime. There may be compatibility issues between different devices or Android versions (such as framework conflicts and system process crashes), resulting in unstable virtual camera functions. However, the solution of this application does not require root permissions and does not require modification of system operations to achieve stable push of virtual camera video streams. At the same time, since this application is developed directly based on the Android system's Camera framework, it has better compatibility with the Android system and can be applied to Android devices of different brands and models, as well as different versions of the Android operating system. In addition, this application also provides a wealth of configuration options and interfaces, allowing users to customize and optimize video streams according to actual needs, such as adjusting resolution, frame rate, encoding format, etc., to meet the needs of different application scenarios.
[0086] It should be noted that the above examples are only used to understand this application and do not constitute a limitation on the video stream push method of this application. More simple transformations based on this technical concept are all within the scope of protection of this application.
[0087] This application also provides a video streaming push device, please refer to Figure 5The video stream pushing device includes: a memory 10, a processor 20, and a video stream pushing program stored in the memory 10 and executable on the processor 20. The video stream pushing program is configured to implement the steps of the video stream pushing method.
[0088] The video stream push device provided in this application, using the video stream push method in the above-described embodiment, can resolve the technical problem of certain operational limitations in the prior art of pushing video streams from virtual cameras. Compared to the prior art, the beneficial effects of the video stream push device provided in this application are the same as those of the video stream push method provided in the above-described embodiment, and the other technical features of the video stream push device are the same as those disclosed in the above-described embodiment method, and are not further described here.
[0089] The present application also provides a smart terminal, which uses the video stream pushing method, or the smart terminal includes the video stream pushing device.
[0090] The smart terminal provided in this application, which utilizes the video stream push method or includes the video stream push device of the above-mentioned embodiments, can resolve the technical problem of certain operational limitations in the prior art of video stream push for virtual cameras. Compared with the prior art, the beneficial effects of the smart terminal provided in this application are the same as those of the video stream push method provided in the above-mentioned embodiments, and the other technical features of the video stream push device are the same as those disclosed in the above-mentioned embodiments, and are not further described here.
[0091] The above description is only part of the embodiments of the present application and does not limit the patent scope of the present application. All equivalent structural transformations made by using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A video stream pushing method, characterized in that: include: Register the virtual camera device in the Camera HAL layer of the Android system; Acquire video stream data, and process the video stream data; Push the processed video stream data to the camera hardware buffer of the Android system through the virtual camera device; Distribute the video stream to the target application's user interface through CameraService.
2. The video stream pushing method according to claim 1, characterized in that: The step of registering a virtual camera device in the CameraHAL layer of the Android system includes: Define the sensor name, interface type, and physical properties of the virtual camera device in the camera configuration file of the Android system, so that the Android system can identify the virtual camera device as a legitimate camera device; Read the system property value and, when it is the preset value, trigger the Camera HAL layer to create a virtual camera adapter to manage the data stream of the virtual camera device.
3. The video stream pushing method according to claim 2, characterized in that: The step of registering a virtual camera device in the CameraHAL layer of the Android system also includes: The total number of virtual camera devices and physical camera devices is obtained in the Camera HAL layer, and device information of the virtual camera devices and the physical camera devices are distinguished, so that the virtual camera devices and the physical camera devices coexist.
4. The video stream pushing method according to claim 1, characterized in that: The step of obtaining video stream data and processing the video stream data comprises: Get raw video stream data from a local video file or a network server; The original video stream data is preprocessed, and the preprocessed data is encoded; the preprocessing includes at least one of adding a filter, a watermark, and adjusting the brightness.
5. The video stream pushing method according to claim 4, characterized in that: The step of preprocessing the original video stream data and encoding the preprocessed data also includes dynamically controlling the resource occupancy rate of video stream push, which is specifically achieved by at least one of the following methods: Adjust video resolution based on system CPU load; Adjust hardware encoding speed; Pause video streaming when there is no application call.
6. The video stream pushing method according to claim 1, characterized in that: The step of pushing the processed video stream to the camera hardware buffer of the Android system through the virtual camera device also includes: Dynamically detect the integrity of video stream data. If data interruption or format error is detected, switch to the backup video source or generate a default video frame to maintain push continuity.
7. The video stream pushing method according to claim 1, characterized in that: The step of distributing the video stream to the user interface of the target application through the CameraService includes: The target application requests the camera device through the Camera API; CameraService binds the data stream of the virtual camera device to the Surface interface specified by the application based on the camera device requested by the target application; The target application interface displays the video stream pushed by the virtual camera device in real time.
8. The video stream pushing method according to claim 2, characterized in that: The video stream pushing method also includes: An SDK API interface is provided through a virtual camera adapter to support third-party applications to customize video stream parameters; the video stream parameters include at least one of resolution, frame rate, and encoding format.
9. A video stream push device, characterized in that: The video stream push device comprises: a memory, a processor, and a video stream push program stored in the memory and executable on the processor, wherein the video stream push program is configured to implement the steps of the video stream push method according to any one of claims 1 to 8.
10. An intelligent terminal, characterized in that: The smart terminal uses the video stream pushing method according to any one of claims 1 to 8, or the smart terminal includes the video stream pushing device according to claim 9.
Citation Information
Patent Citations
A method and apparatus for pushing flow
CN109168021A
Camera resource access method, operating system, terminal and virtual camera
CN112749022A
Image or video data acquisition method and terminal equipment
CN113220445A
Camera matching method and device, terminal equipment and storage medium
CN117255245A