CN117135299A - Video recording method and electronic equipment - Google Patents

Video recording method and electronic equipment Download PDF

Info

Publication number
CN117135299A
CN117135299A CN202310477926.9A CN202310477926A CN117135299A CN 117135299 A CN117135299 A CN 117135299A CN 202310477926 A CN202310477926 A CN 202310477926A CN 117135299 A CN117135299 A CN 117135299A
Authority
CN
China
Prior art keywords
application
video
hardware
video stream
stream
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
CN202310477926.9A
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.)
Honor Device Co Ltd
Original Assignee
Honor Device 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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202310477926.9A priority Critical patent/CN117135299A/en
Publication of CN117135299A publication Critical patent/CN117135299A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/62Control of parameters via user interfaces
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/63Control of cameras or camera modules by using electronic viewfinders
    • H04N23/631Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/63Control of cameras or camera modules by using electronic viewfinders
    • H04N23/631Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
    • H04N23/632Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters for displaying or modifying preview images prior to image capturing, e.g. variety of image resolutions or capturing parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording
    • H04N5/91Television signal processing therefor
    • H04N5/92Transformation of the television signal for recording, e.g. modulation, frequency changing; Inverse transformation for playback
    • H04N5/9201Transformation of the television signal for recording, e.g. modulation, frequency changing; Inverse transformation for playback involving the multiplexing of an additional signal and the video signal
    • H04N5/9202Transformation of the television signal for recording, e.g. modulation, frequency changing; Inverse transformation for playback involving the multiplexing of an additional signal and the video signal the additional signal being a sound signal

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Human Computer Interaction (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

The embodiment of the application provides a video recording method and electronic equipment, wherein the method is executed by the electronic equipment, and the electronic equipment is currently operated with a first application, and the method comprises the following steps: receiving a first operation input by a user through a first application, wherein the first operation requests to start recording video; responsive to a first operation, capturing, by the first hardware, a video stream and an audio stream; if the preset condition is met, acquiring a video stream and an audio stream from a drive corresponding to the first hardware through the first application, wherein the preset condition represents that the first application is allowed to directly acquire the video stream and the audio stream acquired by the first hardware; and merging and storing the video stream and the audio stream through the first application to finish video recording. The method can record videos with any resolution, and improves the video recording capacity of the electronic equipment.

Description

Video recording method and electronic equipment
Technical Field
The present application relates to the field of video processing technologies, and in particular, to a video recording method and an electronic device.
Background
Currently, more and more electronic devices can realize a video recording function, for example, besides electronic devices such as a mobile phone, a tablet computer and the like, some large-screen devices also realize the video recording function.
In the video recording process, a camera on an electronic device generally collects a video stream, and after the collected video stream is decoded, an application program encodes the video stream into a video stream in a target format and records the video stream. When encoding and decoding a video stream, the hardware capability of the codec is generally required to be called, and for a large-screen device with a low hardware capability, the encoding and decoding of the video stream with high resolution may not be performed, that is, the recording of the video with high resolution may not be performed.
Disclosure of Invention
The application provides a video recording method and electronic equipment, which can record videos with any resolution and improve the video recording capability of the electronic equipment.
In a first aspect, the present application provides a video recording method, the method being performed by an electronic device, the electronic device currently running a first application, the method comprising: receiving a first operation input by a user through a first application, wherein the first operation requests to start recording video; responsive to a first operation, capturing, by the first hardware, a video stream and an audio stream; if the preset condition is met, acquiring a video stream and an audio stream from a drive corresponding to the first hardware through the first application, wherein the preset condition represents that the first application is allowed to directly acquire the video stream and the audio stream acquired by the first hardware; and merging and storing the video stream and the audio stream through the first application to finish video recording.
The first application may be a home camera, and on an operation interface of the home camera, the user may click (i.e., first operation) on the video recording control to trigger to start recording video. Alternatively, the first hardware may include a camera and a microphone, and after receiving the first operation, the video stream may be collected by the camera and the audio stream may be collected by the microphone.
The preset condition characterization allows the first application to directly acquire the original video data acquired by the first hardware, i.e. without the need for further decoding and encoding processes. Therefore, when the preset condition is met, the electronic device may trigger the first application to directly obtain the video stream and the audio stream from the driver corresponding to the first hardware, for example, obtain the video stream from the camera driver and obtain the audio stream from the microphone driver. After the first application obtains the video stream and the audio stream, they may be combined to complete the video recording.
According to the implementation mode, in the video recording process, an application program in the electronic equipment can directly record the video stream acquired by the camera without coding and decoding processes, so that video with any resolution can be recorded, the video recording capacity of the electronic equipment is improved, particularly, the recording of high-resolution video can be realized for electronic equipment with lower hardware capacity, and the occupation of hardware resources can be reduced for electronic equipment with higher hardware capacity.
With reference to the first aspect, in some implementations of the first aspect, the electronic device includes an application framework layer and a hardware abstraction layer, and the acquiring, by the first application, the video stream and the audio stream from the driver corresponding to the first hardware includes: the first application sends a request for acquiring the video stream and the audio stream to a driver corresponding to the first hardware through an application program framework layer and a hardware abstraction layer; the driver corresponding to the first hardware sends the video stream and the audio stream to the first application through the hardware abstraction layer and the application framework layer.
Because the application program in the electronic device generally needs to transmit between the application program framework layer and the hardware abstraction layer to transmit data with the hardware driver, in this implementation manner, the first application may send a request for acquiring the video stream and the audio stream to the driver corresponding to the first hardware through the application program framework layer and the hardware abstraction layer, and correspondingly, the driver corresponding to the first hardware also sends the video stream and the audio stream to the first application through the hardware abstraction layer and the application program framework layer.
Optionally, before the first application sends the request to the driver corresponding to the first hardware, a data channel, such as a Session channel, between the drivers corresponding to the first hardware may be further established, and the request may be sent and the video stream and the data stream may be received based on the data channel.
When the driver corresponding to the first hardware transmits the video stream and the audio stream, the video stream is usually transmitted to the hardware abstraction layer and then transmitted to the application framework layer by the hardware abstraction layer, and in the implementation manner, the hardware abstraction layer can directly transmit the video stream to the application framework layer without executing coding operation. Namely, the driver corresponding to the first hardware sends the video stream and the audio stream to the first application through the hardware abstraction layer and the application framework layer, and the method comprises the following steps: the driver corresponding to the first hardware sends a video stream to the hardware abstraction layer; the hardware abstraction layer does not execute decoding operation on the video stream, the video stream is sent to the first application through the application framework layer according to a preset corresponding relation, the corresponding relation comprises a mapping relation between a first data format and a second data format, the first data format represents the data format supported by the hardware abstraction layer, the second data format represents the data format supported by the application framework layer, the first data format comprises the data format corresponding to the video stream, and the corresponding relation represents that a preset condition is met; and the driver corresponding to the first hardware sends the audio stream to the first application through the hardware abstraction layer and the application framework layer.
That is, the hardware abstraction layer includes a correspondence between the supported first data FORMAT and the second data FORMAT supported by the application framework layer, for example, includes a correspondence between the hal_pixel_format_raw_opaque data FORMAT and the mal_greloc_format_interval_raw 16 data FORMAT, that is, a new data processing manner is defined, and when the hardware abstraction layer receives a data stream corresponding to the hal_pixel_format_raw_opaque data FORMAT, the data stream can be directly transmitted to the application framework layer according to the correspondence, without performing a decoding operation on the video stream. For audio streams, the transport may be to the first application through a hardware abstraction layer, an application framework layer.
According to the implementation mode, the new data processing mode is defined, so that in the video recording process, a hardware abstraction layer does not need to carry out a coding and decoding process, an original video stream is directly transmitted to an application program, video recording with any resolution can be realized, and the video recording capacity of the electronic equipment is improved.
With reference to the first aspect, in some implementations of the first aspect, before receiving a first operation input by a user through the first application, the method further includes: and setting a corresponding relation between the first data format and the second data format.
That is, the electronic device may set the correspondence between the first data format and the second data format in advance, so that when the video recording needs to be performed subsequently, the first application directly records by using the original video stream.
With reference to the first aspect, in some implementations of the first aspect, the preset condition includes a value of a preset flag bit being a target value.
Wherein a flag bit may be set in the electronic device and may be assigned when the first application requests that video recording be started. When the value of the marking bit is the target value, representing that the preset condition is met; and when the value of the marking bit is not the target value, the characteristic preset condition is not satisfied. For example, when the flag bit is equal to 1, the characterization preset condition is satisfied.
In one implementation, after receiving a first operation input by a user through a first application, the method further includes: if the corresponding relation between the first data format and the second data format is detected, the marking bit is assigned to be a target value through the first application.
That is, after the video recording is started, if the electronic device has set the correspondence between the first data format and the second data format, that is, indicates that the first application is allowed to acquire the original video stream, the flag bit may be assigned as the target value at the same time, so as to determine whether the preset condition is met.
With reference to the first aspect, in some implementations of the first aspect, before receiving a first operation input by a user through the first application, the method further includes: receiving video resolution set by a user through a first application;
correspondingly, the capturing the video stream through the first hardware includes: and acquiring the video stream according to the video recording resolution through the first hardware.
The running interface of the first application may include a setting interface, where the setting interface presents an entry for setting parameters such as a photo image, a photo silence, a photo resolution, and a video resolution, and the user may perform corresponding setting according to a requirement. For example, different recording resolutions may be set. The first hardware can collect the video stream according to the set video resolution to realize different requirements of users.
With reference to the first aspect, in some implementations of the first aspect, if the preset condition is met, acquiring, by the first application, the video stream and the audio stream from a driver corresponding to the first hardware includes: if the video recording resolution is greater than or equal to the resolution threshold and the preset condition is met, acquiring the video stream and the audio stream from the drive corresponding to the first hardware through the first application.
The resolution threshold may be a preset threshold for distinguishing high resolution from low resolution, and if the video recording resolution is less than the resolution threshold, it is indicated that the video of low resolution is to be recorded; if the recording resolution is greater than or equal to the resolution threshold, then it is indicated that high resolution video is to be recorded.
Under the condition that the video recording resolution is greater than or equal to the resolution threshold, the hardware capability of the electronic equipment may not support the encoding and decoding process, and if the preset condition is met, the electronic equipment can directly acquire the video stream and the audio stream from the drive corresponding to the first hardware through the first application to record the video, so that the video recording capability of the electronic equipment is improved.
With reference to the first aspect, in some implementations of the first aspect, the method further includes: if the video recording resolution is smaller than the resolution threshold, acquiring a video stream and an audio stream from a drive corresponding to the first hardware; decoding the video stream and then sending the decoded video stream to a first application; and encoding the decoded video stream through a first application, and merging and storing the audio stream and the encoded video stream to finish video recording.
Under the condition that the video resolution is smaller than the resolution threshold, the hardware capability of the electronic device can generally support the encoding and decoding process, and then the electronic device can encode and decode the acquired video stream so as to improve the transmission efficiency of the video stream. For example, the video stream in H264 format collected by the camera may be decoded into YUV format by the hardware abstraction layer and then transmitted to the first application to be encoded into the video stream in H264 format for recording.
With reference to the first aspect, in some implementations of the first aspect, after receiving a first operation input by a user through the first application, the method further includes: establishing a data channel between a first application and a drive corresponding to first hardware;
correspondingly, the video stream and the audio stream are acquired from the corresponding drive of the first hardware through the first application, which comprises the following steps: the first application obtains the video stream and the audio stream from the corresponding drive of the first hardware through the data channel.
Alternatively, the data channel between the drivers corresponding to the first application and the first hardware may be a Session channel (Session channel), through which data transmission between the drivers corresponding to the first application and the first hardware may be implemented.
With reference to the first aspect, in some implementations of the first aspect, after the capturing, by the first hardware, the video stream and the audio stream, the method further includes: and acquiring a video stream from a drive corresponding to the first hardware through the first application, and generating and displaying a preview image according to the video stream.
After the electronic device finishes video recording, the recorded video can be generated, and a corresponding preview image can be generated for a user to preview conveniently. Thus, in addition to video recording according to the above implementation, the electronic device may also generate a preview image from the video stream during this process.
Optionally, the driver corresponding to the first hardware may send the video stream to the hardware abstraction layer, where the hardware abstraction layer decodes the video stream and then transmits the decoded video stream to the first application, and the first application may generate a preview image according to the decoded video stream to perform preview display.
In a second aspect, the present application provides an apparatus, which is included in an electronic device, the apparatus having a function of implementing the above first aspect and the behavior of the electronic device in the possible implementation manners of the above first aspect. The functions may be realized by hardware, or may be realized by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the functions described above. Such as a receiving module or unit, a processing module or unit, etc.
In a third aspect, the present application provides an electronic device, including: a processor, a memory, and an interface; the processor, the memory and the interface cooperate with each other such that the electronic device performs any one of the methods of the technical solutions of the first aspect.
In a fourth aspect, the present application provides a chip comprising a processor. The processor is configured to read and execute a computer program stored in the memory to perform the method of the first aspect and any possible implementation thereof.
Optionally, the chip further comprises a memory, and the memory is connected with the processor through a circuit or a wire.
Further optionally, the chip further comprises a communication interface.
In a fifth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored, which when executed by a processor causes the processor to perform any one of the methods of the first aspect.
In a sixth aspect, the application provides a computer program product comprising: computer program code which, when run on an electronic device, causes the electronic device to perform any one of the methods of the solutions of the first aspect.
Drawings
Fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
FIG. 2 is a block diagram of a software architecture of an example electronic device according to an embodiment of the present application;
fig. 3 is an application scene diagram of an example of a video recording method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an exemplary home camera setup interface provided by an embodiment of the present application;
FIG. 5 is a schematic diagram of an exemplary home camera preview interface provided by an embodiment of the present application;
Fig. 6 is a flowchart illustrating an example of a video recording method according to an embodiment of the present application;
fig. 7 is a flowchart of another video recording method according to an embodiment of the present application;
fig. 8 is a flowchart of another video recording method according to an embodiment of the present application;
fig. 9 is a flowchart of another video recording method according to an embodiment of the present application;
fig. 10 is a flowchart of another video recording method according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application. Wherein, in the description of the embodiments of the present application, unless otherwise indicated, "/" means or, for example, a/B may represent a or B; "and/or" herein is merely an association relationship describing an association object, and means that three relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone. In addition, in the description of the embodiments of the present application, "plurality" means two or more than two.
The terms "first," "second," "third," and the like, are used below for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first", "a second", or a third "may explicitly or implicitly include one or more such feature.
With the development of electronic technology, more and more electronic devices can realize a video recording function, for example, besides the early popular camera recording function of a mobile phone, a tablet computer and the like, some large-screen devices (such as a smart television, a smart large screen and the like) also have introduced a video recording function.
Taking the video recording function of the large-screen device as an example, in the video recording process, a camera on the large-screen device generally collects video streams, and after the collected video streams are decoded, an application program (also referred to as an upper layer application) encodes the video streams into video streams in a target format and records the video streams. For example, the camera collects the video stream in the H264 format, decodes the video stream into the YUV format by the hardware abstraction layer (HAL layer), and then transmits the video stream to the upper layer for recording the video stream coded into the H264 format; the video stream in the H264 format is converted into the YUV format for transmission, so that the data size of the video stream can be compressed, and the transmission efficiency is improved.
However, when encoding and decoding a video stream, it is generally necessary to invoke the hardware capability of the codec, and particularly when an upper layer application encodes a video stream in H264 format, it is necessary to invoke the encoding capability of the encoder (or chip); this may not be possible for large screen devices with low hardware capabilities to encode high resolution video streams (e.g., 4K video with a resolution of 4096 x 2160), i.e., to record high resolution video.
In view of this, the embodiment of the application provides a video recording method, in which an application program can directly record a video stream acquired by a camera in the video recording process, and the encoding and decoding processes are not needed, so that the video recording of any resolution is realized, and the video recording capability of electronic equipment is improved. It can be appreciated that the video recording method provided by the embodiment of the application can be applied to electronic devices with video recording functions, such as mobile phones, tablet computers, large-screen devices, vehicle-mounted devices, augmented reality (augmented reality, AR)/Virtual Reality (VR) devices, notebook computers, ultra-mobile personal computer (UMPC), netbooks, personal digital assistants (personal digital assistant, PDA) and the like, and the embodiment of the application does not limit the specific types of the electronic devices.
Fig. 1 is a schematic structural diagram of an electronic device 100 according to an embodiment of the present application. Taking the example of electronic device 100 being a large screen device, electronic device 100 may include a processor 110, a memory 120, and a communication module 130, among other things.
Processor 110 may include one or more processing units, among other things, and memory 120 is used to store program codes and data. In an embodiment of the present application, processor 110 may execute computer-executable instructions stored in memory 120 for controlling and managing the actions of electronic device 100.
The communication module 130 may be used for communication between various internal modules of the electronic device 100, communication between the electronic device 100 and other external electronic devices, or the like. By way of example, if the electronic device 100 communicates with other electronic devices by way of a wired connection, the communication module 130 may include an interface, such as a USB interface, which may be an interface conforming to the USB standard specification, specifically, a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface may be used to connect a charger to charge the electronic device 100, or may be used to transfer data between the electronic device 100 and a peripheral device. And can also be used for connecting with a headset, and playing audio through the headset. The interface may also be used to connect other electronic devices, such as augmented reality (augmented reality, AR) devices, etc.
Alternatively, the communication module 130 may include an audio device, a radio frequency circuit, a bluetooth chip, a wireless fidelity (wireless fidelity, wi-Fi) chip, a near-field communication technology (NFC) module, etc., and interaction between the electronic device 100 and other electronic devices may be implemented in a variety of different manners.
Optionally, the electronic device 100 may further include a display screen 140, where the display screen 140 may display images or videos in a human-machine interaction interface, and so on.
Optionally, the electronic device 100 may also include peripheral devices 150, such as cameras, speakers, microphones, and the like.
Taking the example of the electronic device 100 being a mobile phone, the electronic device 100 may include a charging management module, a power management module, a battery, an antenna, a mobile communication module, a wireless communication module, a sensor module, a key, a motor, an indicator, a subscriber identity module (subscriber identification module, SIM) card interface, etc. (not shown in fig. 1) in addition to the above components or modules. The sensor module may include, among other things, a pressure sensor, a gyroscope sensor, a barometric sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
It should be understood that the structure of the electronic device 100 is not particularly limited by the embodiments of the present application, except for the various components or modules listed in fig. 1. In other embodiments of the application, electronic device 100 may also include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The software system of the electronic device 100 may employ a layered architecture, an event driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. In the embodiment of the application, taking an Android system with a layered architecture as an example, a software structure of the electronic device 100 is illustrated.
Fig. 2 is a software configuration block diagram of the electronic device 100 according to the embodiment of the present application. The layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, from top to bottom, an application layer, an application framework layer, a hardware abstraction layer (HAL layer), and a kernel layer, respectively.
The application layer may include a series of application packages. As shown in FIG. 2, the application package may include applications such as home cameras, music, video, gallery, calendar, weather, settings, and the like.
An application Framework layer (Framework layer) provides an application programming interface (application programming interface, API) and programming Framework for application programs of the application layer. The application framework layer includes a number of predefined functions.
By way of example, the application framework layer may include a Camera Service (Camera Service), an Audio manager (Audio player), and MediaCodec. The MediaCodec is a codec component in the Android system, and can be used to access a codec provided by the bottom layer. Camera Service can acquire Camera data from a lower layer and upload the Camera data to an upper layer application to provide services for the application needing to access the Camera data. The Audio Flinger can be responsible for output collection of Audio data, control of Audio streams, volume adjustment, management of Audio equipment, and the like.
In addition, the application framework layer may include a window manager, a content provider, a view system, a resource manager, a notification manager, etc. (not shown in FIG. 2).
The window manager is used for managing window programs. The window manager can acquire the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like. The content provider is used to store and retrieve data and make such data accessible to applications. The data may include video, images, audio, browsing history, bookmarks, and the like. The view system includes visual controls, such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, a view displaying text may be included, and a view displaying a picture. The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like. The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction. Such as notification manager is used to inform that the download is complete, message alerts, etc.
The hardware abstraction layer (HAL layer) is a layer structure abstracted between the kernel layer and the upper layer, and is provided with a plurality of API interfaces through which operating systems and application programs can be serviced. Illustratively, the HAL layer may include a Camera HAL that may provide a service for data interaction between the Camera driver and the upper layer, and an Audio HAL that may provide a service for data interaction between the Audio driver and the upper layer.
In the embodiment of the present application, the application framework layer defines a new data Format, for example, a hal_pixel_format_raw_opaq ue data Format is defined in format_info. The HAL layer contains a correspondence between a new data FORMAT and a data FORMAT supported by the application framework layer, for example, contains a correspondence between a hal_pixel_format_raw_opaque data FORMAT and a mali_graloc_format_interface_raw 16 (application framework layer) data FORMAT, that is, a new data processing mode is defined, and when the HAL layer receives a data stream corresponding to the hal_pixel_format_raw_opaque data FORMAT, the data stream can be directly transmitted to the application framework layer according to the correspondence. For example, this processing style characterization allows the original video stream (i.e., the video stream in H264 format) to be directly transferred to Camera Service in the application framework layer.
The kernel layer is a layer between hardware and software. The kernel layer at least comprises a display driver, a camera driver and an audio driver. Illustratively, the audio drive may include a microphone drive or the like.
For easy understanding, the following embodiments of the present application will take an electronic device having a structure shown in fig. 1 and fig. 2 as an example, and specifically describe a video recording method provided by the embodiments of the present application with reference to the accompanying drawings and application scenarios.
Taking an example that the electronic device is a large screen device as an example, fig. 3 is a schematic application scenario diagram of the video recording method according to the embodiment of the present application. As shown in fig. 3 (a), a user may perform video recording through a home camera application (hereinafter, simply referred to as a home camera), for example, the user may click on a home camera icon on a display desktop of an electronic device to run the home camera. The interface after the home camera is operated is shown in the diagram (b) in fig. 3, the interface is presented with a photographing control 31 and a video recording control 32, and if the user clicks the video recording control 32, video recording is started.
In one embodiment, the user may also set the photographing function or the video recording function of the home camera. For example, the diagram (b) in fig. 3 also presents a setting control 33, and the electronic device can jump to the interface shown in fig. 4 after the user clicks the setting control 33. As shown in fig. 4, the setting interface presents an entry for setting parameters such as a photographing mirror image, photographing silence, photo resolution, video resolution, etc., and a user can perform corresponding setting according to needs.
In one embodiment, the electronic device may also provide preview functionality for photographs taken by the user through the take control 31 shown in figure 3 (b), or videos taken through the record control 32. For example, the view (b) of fig. 3 also presents a preview control 34, and the electronic device can jump to the interface shown in fig. 5 after the user clicks the preview control 34. As shown in fig. 5, a preview of the photographed photo or video is displayed on the preview interface.
In the scenario shown in fig. 3, if the user clicks the video recording control 32, the video recording function is turned on, and accordingly, the video recording method provided by the embodiment of the present application starts to operate. Fig. 6 is a flowchart of an exemplary video recording method according to an embodiment of the present application, where the method is executed by an electronic device and may specifically include:
s101, receiving a first operation input by a user through a first application, wherein the first operation requests to start recording video.
The first application may be a home camera, the first operation may be a click operation input to the video control 32 in the diagram (b) in fig. 3, or a voice command input by the user on an operation interface of the home camera, and the embodiment of the present application does not limit an input form of the first operation.
S102, responding to a first operation, and acquiring a video stream and an audio stream through first hardware.
The first hardware may include a camera and a microphone, among others. After the electronic device receives the first operation input by the user, the electronic device may trigger corresponding hardware to collect video data, for example, collect video stream through a camera, collect audio stream through a microphone, and so on, in response to the first operation.
It will be appreciated that the video stream and the audio stream (video stream and audio stream may also be collectively referred to as video data) collected by the first hardware are typically stored in corresponding drives, e.g., the video stream collected by the camera is stored in the camera drive, the audio stream collected by the microphone is stored in the microphone drive, etc.
And S103, if the preset condition is met, acquiring the video stream and the audio stream from the drive corresponding to the first hardware through the first application.
The preset condition characterization allows the first application to directly acquire the original video data acquired by the first hardware, namely, the process of decoding and encoding is not needed. Therefore, in the case that the preset condition is met, the electronic device may trigger the first application to directly obtain the video stream and the audio stream from the driver corresponding to the first hardware, for example, obtain the video stream from the camera driver, obtain the audio stream from the microphone driver, and so on.
For example, if the video stream collected by the camera is data in the H264 format, the first application may directly obtain the video stream in the H264 format from the camera driver. It should be noted that, since the first application may directly obtain the video stream from the camera driver, the video stream with any resolution may be obtained, and the codec process is not required.
Still further exemplary, the audio stream captured by the microphone may be a segment of an audio signal, and the first application may obtain the audio stream from the microphone driver and encode the audio stream as data in AAC format, WAV format, CDA format, or MP3 format. It will be appreciated that the data size of the audio stream is smaller than that of the video stream, and the encoding process thereof has no high requirement on hardware capability, so that the audio stream can be encoded normally in the embodiments of the present application, and the processing of the audio stream in the embodiments will not be described in detail.
In one embodiment, a flag bit may be set in the electronic device and assigned when the first application requests that video recording be started. When the value of the marking bit is the target value, representing that the preset condition is met; and when the value of the marking bit is not the target value, the characteristic preset condition is not satisfied. For example, when the flag bit is equal to 1, the characterization preset condition is satisfied. For example, in the case where the HAL layer of the electronic device defines the above-mentioned data processing manner, the electronic device may assign the flag bit to the target value if the first application requests to start recording video.
Optionally, the video data acquired by the first application from the driver corresponding to the first hardware may be temporarily stored in a Buffer, where the Buffer may further store the data size of the video data and a corresponding acquisition timestamp. Because video data may include both video and audio streams, both video and audio streams may be associated with acquisition time stamps. For video streams, which are typically composed of images of one frame, each frame of images may be associated with an acquisition time stamp. For audio streams, which are typically made up of segments of audio signals, each segment of audio signal may be associated with an acquisition time stamp.
It can be understood that if the preset condition is not satisfied, the electronic device may not perform processing (i.e. not perform video recording) at all, or may acquire the video data by adopting a process of encoding the video data by the first application after decoding the video data in the related art. For example, after decoding the video stream in H264 format into YUV format, the video stream is transmitted to the first application for encoding into the video stream in H264 format.
S104, combining and storing the video stream and the audio stream through the first application to finish video recording.
Because the video data includes a video stream and an audio stream, the first application is a video stream and an audio stream acquired from different hardware drivers, respectively, and thus the electronic device needs to combine the video stream and the audio stream to complete video recording.
In order to ensure that recorded video and audio are synchronous, when the electronic equipment merges the video stream and the audio stream through the first application, the electronic equipment can time align the acquisition time stamp corresponding to the video stream with the acquisition time stamp corresponding to the audio stream, and merge the video stream and the audio stream with the same acquisition time.
According to the video recording method, in the video recording process, the application program in the electronic equipment can directly record the video stream acquired by the camera without coding and decoding processes, so that video with any resolution can be recorded, the video recording capacity of the electronic equipment is improved, particularly, the recording of high-resolution video can be realized for the electronic equipment with lower hardware capacity, and the occupation of hardware resources can be reduced for the electronic equipment with higher hardware capacity.
As can be seen from the above embodiments, when the first application acquires video stream data, it usually acquires video stream from the camera driver, and acquires audio stream from the microphone driver, that is, the video stream and the audio stream are transmitted to the first application through different channels. Thus, the electronic device, upon receiving a first operation entered by a user, may first establish a data channel between the first application and the driver of the different hardware, and then subsequently transmit video data through the channel. For this process, as shown in fig. 7, specifically, it may include:
S201, receiving a first operation input by a user through a first application, wherein the first operation requests to start recording video.
S202, responding to a first operation, and collecting a video stream and an audio stream through first hardware.
The process of S201 to S202 may refer to S101 to S102 in the above embodiment, and will not be described herein.
S203, establishing a data channel between the first application and the drive corresponding to the first hardware.
S204, if the preset condition is met, the first application acquires the video stream and the audio stream through the established data channel.
After the electronic device receives the first operation, a data channel between the first application and the driver corresponding to the first hardware may be established in addition to the video data collected by the first hardware. It will be appreciated that the execution sequence between S202 and S203 is not limited in the embodiment of the present application, S202 may be executed first, S203 may be executed first, S202 may be executed second, S202 may be executed first, and S202 and S203 may be executed simultaneously.
Alternatively, the electronic device may establish a data channel between the first application and the camera driver, and a data channel between the first application and the microphone driver. For example, the data channel between the first application and the camera may be a Session channel.
Then, in the case that the above preset condition is met, the electronic device may trigger the first application to acquire video data through the established data channel, and the acquiring process may refer to the description of the above embodiment, which is not repeated herein.
S205, merging and storing the video stream and the audio stream through a first application to finish video recording.
The process of S205 may refer to S104 in the above embodiment, and will not be described herein.
According to the video recording method, in the video recording process, an application program in the electronic equipment can directly record the video stream acquired by the camera without coding and decoding processes, so that the video with any resolution is recorded, and the video recording capacity of the electronic equipment is improved; in addition, the electronic device can establish a data channel between the application program and the hardware driver in advance, and can provide a basis for subsequent video data transmission.
With continued reference to fig. 3 (b) and fig. 5, the preview control 34 is shown in fig. 3 (b), and after the user clicks the preview control 34, the user may jump to fig. 5, which shows a preview of the shot photo or video, that is, after the electronic device completes video recording, a preview may be generated for the user to preview in addition to the recorded video. Therefore, the electronic device needs to generate a preview image in the process in addition to video recording according to the process in the above embodiment. For this process, as shown in fig. 8, specifically, it may include:
S301, receiving a first operation input by a user through a first application, wherein the first operation requests to start recording video.
S302, responding to a first operation, and collecting a video stream and an audio stream through first hardware.
The process of S301 to S302 may refer to S101 to S102 in the above embodiment, and will not be described herein.
S303, obtaining a video stream from a driver corresponding to the first hardware, and decoding the video stream to generate a preview image.
The process of generating the preview image by the electronic device is different from the process of recording video, and in the process of generating the preview image, decoding and displaying of the video stream are needed.
In one embodiment, the electronic device may obtain a video stream from the Camera driver through the Camera HAL of the HAL layer, and decode the video stream, where the video stream to be decoded is transmitted to the first application to generate the preview.
Illustratively, assuming that the Camera collects a video stream in H264 format, the Camera HAL may obtain the video stream in H264 format from the Camera driver and decode it into YUV format. And then transmitting the video stream in the YUV format to a first application, wherein the first application can generate a preview image for preview display of the video stream in the YUV format.
S304, if the preset condition is met, acquiring the video stream and the audio stream from the drive corresponding to the first hardware through the first application.
S305, combining and storing the video stream and the audio stream through the first application to finish video recording.
The process of S304-S305 may refer to S103-S104 in the above embodiment, and will not be described herein.
It will be appreciated that the process of generating the preview image by the electronic device may be performed simultaneously with the process of recording the video, i.e. the electronic device initiates two threads to perform the two different processes respectively.
According to the video recording method, in the video recording process, an application program in the electronic equipment can directly record the video stream acquired by the camera without coding and decoding processes, so that the video with any resolution is recorded, and the video recording capacity of the electronic equipment is improved; and the electronic equipment can also generate a preview image based on the video stream, so that a user can conveniently preview and check the recorded video.
With continued reference to fig. 4, the setting interface presents an entry for setting parameters such as a photographing mirror image, a photographing silence, a photo resolution, and a video resolution, and the user can perform corresponding setting according to the needs. For example, the user sets the recording resolution to the resolution of 4K video, or to the resolution of 1080P video, or the like. In general, the resolution of the 4K video is higher, the resolution of the 1080P video is lower, and there may be a case where the electronic device may record the 1080P video, but cannot record the 4K video. Therefore, in the embodiment of the present application, the recording mode may be dynamically selected according to the recording resolution set by the user, as shown in fig. 9, and the process may specifically include:
S401, receiving video recording resolution set by a user through a first application.
The user may set the video resolution through the interface shown in fig. 4, for example, the size of the video resolution may be directly input, or the alternative video resolution may be selected from the setting entry of the video resolution.
S402, receiving a first operation input by a user through a first application, wherein the first operation requests to start recording video.
S403, responding to the first operation, and acquiring the video stream and the audio stream according to the video recording resolution through first hardware.
The process of S402 to S403 may refer to S101 to S102 in the above embodiment, and will not be described herein. However, it should be noted that, here, the first hardware collects video data according to the above-set video resolution; it will be appreciated that if the user does not set the recording resolution, the first hardware may collect video data according to a default recording resolution, such as 1080P for a default recording resolution, etc.
S404, if the video recording resolution is smaller than the resolution threshold, the video stream and the audio stream are obtained from the drive corresponding to the first hardware, and the video stream is encoded and decoded.
S405, the audio stream and the video stream after encoding and decoding are combined and stored through the first application, and video recording is completed.
The resolution threshold may be a preset threshold for distinguishing high resolution from low resolution, and if the video recording resolution is less than the resolution threshold, it is indicated that the video of low resolution is to be recorded; if the recording resolution is greater than or equal to the resolution threshold, then it is indicated that high resolution video is to be recorded. Illustratively, the resolution threshold may be 4096×2160 (i.e., the resolution of 4K video).
Under the condition that the video resolution is smaller than the resolution threshold, the hardware capability of the electronic device can generally support the encoding and decoding process, and then the electronic device can encode and decode the acquired video stream so as to improve the transmission efficiency of the video stream. For example, the video stream in the H264 format collected by the Camera may be transmitted to the first application to encode the video stream in the H264 format for recording after being decoded into the YUV format by the Camera HAL.
After the electronic device encodes and decodes the video stream, the audio stream and the encoding and decoding can be combined through the first application, and the process can also perform time synchronization according to the acquisition time stamp corresponding to the audio stream and the acquisition time stamp corresponding to the video stream so as to complete video recording.
S406, if the video recording resolution is greater than or equal to the resolution threshold and the preset condition is met, acquiring the video stream and the audio stream from the drive corresponding to the first hardware through the first application.
S407, combining and storing the video stream and the audio stream through the first application to finish video recording.
Under the condition that the video recording resolution is greater than or equal to the resolution threshold, the hardware capability of the electronic equipment may not support the encoding and decoding process, and if the preset condition is met, the electronic equipment can directly acquire the video stream and the audio stream from the drive corresponding to the first hardware through the first application to record the video, so that the video recording capability of the electronic equipment is improved.
According to the video recording method, the electronic equipment can dynamically select the recording mode according to the video recording resolution set by the user, under the condition that the video recording resolution is low, the electronic equipment can encode and decode the video stream in the process of acquiring the video stream so as to improve the transmission efficiency of the video stream, under the condition that the video recording resolution is high, the electronic equipment can directly record the video stream acquired by the camera without encoding and decoding processes, and the video recording capacity of the electronic equipment is improved.
For the embodiment shown in fig. 8, the method for recording video is described below with reference to the software block diagram shown in fig. 2, and as shown in fig. 10, the method may include:
s11, the first application receives a first operation input by a user.
S12, responding to the first operation, the first application requests the Camera Service to establish a session channel.
The Session channel (i.e., data channel) created by the first application request may be a Session channel, for example, the first application may request to establish the Session channel from the Camera Service through a CreateCaptureSession function.
When a session channel is requested to be established, the first application may request to create two Surface data streams from the Camera Service, where one is a Surface of the preview stream (for example, mproviewsurface), and the other is a Surface of the video stream (for example, mRecorderSurface), where the Surface may be understood as a Buffer, and is used to provide functions such as processing or storing data during the process of previewing or recording video.
It can be understood that, when the first application requests to establish the session channel from the Camera Service, parameters such as resolution and acquisition frame rate of the image acquired during video recording may be carried.
S13, after the Camera Service receives the request, requesting the Camera HAL to establish a session channel.
The process of requesting the Camera Service to establish the session channel from the Camera HAL is similar to the above process, and will not be described again.
S14, the Camera HAL writes video configuration information into the Camera driver.
The video configuration information may be information of parameters such as the resolution of the acquired image and the acquired frame rate. Illustratively, the Camera HAL may write video configuration information to the Camera driver via a configurable streams function.
And S15, after the video configuration information is written, the Camera driver returns a state value to the first application through the Camera HAL and the Camera Service, and starts to collect video streams.
The state value indicates whether the video configuration information is successfully written, for example, if the state value is 1, the video configuration information is successfully written, and if the state value is 0, the video configuration information is failed to be written, etc.
Optionally, after the writing of the video configuration information is completed, the first application may further assign a value to a preset flag bit, where the value is assigned to a target value. For example, the initial value of the flag bit is 0, and is assigned a target value of 1.
S16, the first application sends a request for acquiring the video stream to the Camera Service through the session channel.
When the first application sends a request for acquiring a video stream, the format of the video stream to be acquired may be carried. As can be seen from the embodiment shown in fig. 8, the first application may be used for previewing and recording video after obtaining the video stream, and the data formats corresponding to the previewing and video recording are different, so the first application may issue two data formats here, one representing the data format of the preview image and the other representing the data format of the recorded video.
Illustratively, the data format representing the preview may be ycbcr_422_i, representing YUV format; the data FORMAT representing the recorded video may be hal_pixel_format_raw_opaque, representing the H264 FORMAT.
Alternatively, the first application may send a request for obtaining a video stream to the Camera Service through a createCaptureRequest function, where the number of times the request is sent may be multiple times. For example, if the first application is to request a video stream of N frames of images to be acquired, N requests need to be sent.
S17, the Camera Service sends a request for acquiring the video stream to the Camera HAL through a session channel.
S18, the Camera HAL sends a request for acquiring the video stream to the Camera driver.
After the Camera Service receives the request for acquiring the video stream, the request can be sent to the Camera driver through the Camera HAL.
And S19, the Camera driver transmits the acquired video stream to the Camera HAL.
S20, the Camera HAL decodes the video stream to obtain a decoded video stream.
The data format obtained after the video streaming is decoded by the Camera HAL is the data format representing the preview image, for example, the video streaming decoded into YUV format.
S21, the Camera HAL transmits the decoded video stream to the Camera Service through the session channel.
S22, the Camera Service transmits the decoded video stream to the first application through the session channel.
S23, the first application generates a preview image according to the decoded video stream.
That is, the process of S19 to S23 is a process in which the first application acquires a video stream from the camera driver and generates a preview image, and the first application finally acquires a video stream in YUV format.
S24, the Camera driver transmits the collected video stream to the Camera HAL.
S25, the Camera HAL transmits the received video stream to the Camera Service through the session channel.
The Camera HAL defines a new data processing mode, and the processing mode characterizes that the original video stream (namely, the video stream in the H264 format) is allowed to be transmitted to the Camera Service, so that the Camera HAL can directly transmit the received video stream in the H264 format to the Camera Service without a decoding process when the first application request acquires the video stream in the H264 format.
It will be appreciated that the video stream taken by the Camera HAL from the Camera driver may be copied to the memory space of mRecorderSurface, which may also store the data size of the video data and the corresponding acquisition time stamp, e.g. the last four bytes for storing the data size and the acquisition time stamp.
Optionally, in this step, the Camera HAL may also determine whether the original video stream can be directly transmitted to the Camera Service according to the value of the flag bit, for example, when the flag bit is 1, the original video stream can be directly transmitted to the Camera Service, that is, the first application is allowed to obtain the original video data from the driver corresponding to the first hardware (that is, the preset condition is met).
S26, the Camera Service transmits the received video stream to the first application through the session channel.
That is, the process of S24-S26 is a process that the first application directly obtains the original video stream from the camera driver, and then the subsequent first application can combine the video stream and the audio stream to complete video recording.
It will be appreciated that the process of generating the preview image in S19-S23 and the process of acquiring the video stream in S24-S26 may be performed simultaneously, and the execution sequence of the process is not limited in the embodiment of the present application.
S27, the first application sends a request for acquiring the Audio stream to the microphone driver through the Audio player and the Audio HAL.
And S28, the microphone driver transmits the Audio stream to the first application through the Audio HAL and the Audio Flinger.
S29, the first application encodes the audio stream to obtain an encoded audio stream.
The channel for sending the request to the microphone and obtaining the audio stream by the first application may be different from the session channel driven by the camera, which is a data channel for transmitting the audio stream, and the process may adopt any technical scheme that can be implemented in the related art, which is not limited in the embodiment of the present application. Alternatively, the first application may encode the audio stream into the AAC format.
It will be appreciated that the process of S27-S29 to acquire the audio stream may be performed simultaneously with the process of S24-S26 to acquire the video stream, so that the first application may acquire the audio stream and the video stream simultaneously.
S30, the first application performs merging and storing on the video stream and the audio stream to finish video recording.
The video stream obtained by the first application is the video stream of the original H264 format, the audio stream is the audio stream of the coded AAC format, and the first application can combine and store the data streams of the two formats, thus completing video recording.
Illustratively, the first application may merge the video stream and the audio stream through a MediaMixer.
Alternatively, after the video recording is finished, the first application may modify the value of the flag bit to an initial value, for example, modify the value of the flag bit from 1 to 0 again.
According to the video recording method, in the video recording process, the application program in the electronic equipment can directly record the video stream acquired by the camera without coding and decoding processes, so that the video with any resolution is recorded, and the video recording capability of the electronic equipment is improved.
Examples of the video recording method provided by the embodiment of the application are described in detail above. It will be appreciated that the electronic device, in order to achieve the above-described functions, includes corresponding hardware and/or software modules that perform the respective functions. Those of skill in the art will readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Those skilled in the art may implement the described functionality using different approaches for each particular application in conjunction with the embodiments, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The embodiment of the application can divide the functional modules of the electronic device according to the method example, for example, each function can be divided into each functional module, for example, a detection unit, a processing unit, a display unit, and the like, and two or more functions can be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation.
It should be noted that, all relevant contents of each step related to the above method embodiment may be cited to the functional description of the corresponding functional module, which is not described herein.
The electronic device provided in this embodiment is configured to execute the video recording method, so that the same effects as those of the implementation method can be achieved.
In case an integrated unit is employed, the electronic device may further comprise a processing module, a storage module and a communication module. The processing module can be used for controlling and managing the actions of the electronic equipment. The memory module may be used to support the electronic device to execute stored program code, data, etc. And the communication module can be used for supporting the communication between the electronic device and other devices.
Wherein the processing module may be a processor or a controller. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. A processor may also be a combination that performs computing functions, such as a combination comprising one or more microprocessors, a combination of digital signal processing and microprocessors, and the like. The memory module may be a memory. The communication module can be a radio frequency circuit, a Bluetooth chip, a Wi-Fi chip and other equipment which interact with other electronic equipment.
In one embodiment, when the processing module is a processor and the storage module is a memory, the electronic device according to this embodiment may be a device having the structure shown in fig. 1.
The embodiment of the application also provides a computer readable storage medium, in which a computer program is stored, which when executed by a processor, causes the processor to execute the video recording method of any of the above embodiments.
The embodiment of the application also provides a computer program product, which when run on a computer, causes the computer to execute the above related steps to implement the video recording method in the above embodiment.
In addition, embodiments of the present application also provide an apparatus, which may be embodied as a chip, component or module, which may include a processor and a memory coupled to each other; the memory is used for storing computer-executable instructions, and when the device is operated, the processor can execute the computer-executable instructions stored in the memory, so that the chip executes the video recording method in each method embodiment.
The electronic device, the computer readable storage medium, the computer program product or the chip provided in this embodiment are used to execute the corresponding method provided above, so that the beneficial effects thereof can be referred to the beneficial effects in the corresponding method provided above, and will not be described herein.
It will be appreciated by those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to perform all or part of the functions described above.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another apparatus, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and the parts shown as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed in a plurality of different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a readable storage medium. Based on such understanding, the technical solution of the embodiments of the present application may be essentially or a part contributing to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, including several instructions for causing a device (may be a single-chip microcomputer, a chip or the like) or a processor (processor) to perform all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read Only Memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (14)

1. A video recording method, the method performed by an electronic device, the electronic device currently running a first application, the method comprising:
receiving a first operation input by a user through the first application, wherein the first operation requests to start recording video;
responsive to the first operation, capturing, by the first hardware, a video stream and an audio stream;
if the preset condition is met, the video stream and the audio stream are obtained from the corresponding drive of the first hardware through the first application, and the preset condition characterizes the video stream and the audio stream which are allowed to be directly obtained by the first application;
and combining and storing the video stream and the audio stream through the first application to finish video recording.
2. The method of claim 1, wherein the electronic device comprises an application framework layer and a hardware abstraction layer, the obtaining, by the first application, the video stream and the audio stream from the first hardware-corresponding driver, comprising:
The first application sends a request for acquiring the video stream and the audio stream to a driver corresponding to the first hardware through the application program framework layer and the hardware abstraction layer;
and the driver corresponding to the first hardware sends the video stream and the audio stream to the first application through the hardware abstraction layer and the application framework layer.
3. The method of claim 2, wherein the first hardware-corresponding driver, through the hardware abstraction layer, the application framework layer, sends the video stream and the audio stream to the first application, comprising:
the corresponding drive of the first hardware sends the video stream to the hardware abstraction layer;
the hardware abstraction layer does not execute decoding operation on the video stream, and sends the video stream to the first application through the application framework layer according to a preset corresponding relation, wherein the corresponding relation comprises a mapping relation between a first data format and a second data format, the first data format represents the data format supported by the hardware abstraction layer, the second data format represents the data format supported by the application framework layer, the first data format comprises the data format corresponding to the video stream, and the corresponding relation represents that the preset condition is met;
And the driver corresponding to the first hardware sends the audio stream to the first application through the hardware abstraction layer and the application framework layer.
4. A method according to claim 3, wherein prior to said receiving a first operation entered by a user via said first application, the method further comprises:
and setting the corresponding relation between the first data format and the second data format.
5. The method of claim 1, wherein the predetermined condition comprises a predetermined flag bit value being a target value.
6. The method of claim 5, wherein after the receiving the first operation input by the user through the first application, the method further comprises:
and if the corresponding relation between the first data format and the second data format is detected, assigning the mark bit to the target value through the first application.
7. The method of any of claims 1-6, wherein prior to the receiving a first operation of a user input through the first application, the method further comprises:
receiving video resolution set by the user through the first application;
Correspondingly, the video stream acquisition by the first hardware comprises:
and acquiring the video stream according to the video recording resolution through the first hardware.
8. The method of claim 7, wherein the obtaining, by the first application, the video stream and the audio stream from the driver corresponding to the first hardware if the preset condition is satisfied, comprises:
and if the video recording resolution is greater than or equal to a resolution threshold and the preset condition is met, acquiring the video stream and the audio stream from a drive corresponding to the first hardware through the first application.
9. The method according to claim 7 or 8, characterized in that the method further comprises:
if the video resolution is smaller than a resolution threshold, acquiring the video stream and the audio stream from a driver corresponding to the first hardware;
decoding the video stream and then sending the decoded video stream to the first application;
and encoding the decoded video stream through the first application, and merging and storing the audio stream and the encoded video stream to finish video recording.
10. The method according to any one of claims 1 to 9, wherein after the receiving a first operation of a user input through the first application, the method further comprises:
Establishing a data channel between the first application and a drive corresponding to the first hardware;
correspondingly, the obtaining, by the first application, the video stream and the audio stream from the driver corresponding to the first hardware includes:
and the first application acquires the video stream and the audio stream from the drive corresponding to the first hardware through the data channel.
11. The method according to any one of claims 1 to 10, wherein after the capturing of the video stream and the audio stream by the first hardware, the method further comprises:
and acquiring the video stream from the drive corresponding to the first hardware through the first application, and generating and displaying a preview image according to the video stream.
12. The method of any one of claims 1 to 11, wherein the first hardware comprises a camera and a microphone.
13. An electronic device, comprising:
one or more processors;
one or more memories;
the memory stores one or more programs that, when executed by the processor, cause the electronic device to perform the method of any of claims 1-12.
14. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program which, when executed by a processor, causes the processor to perform the method of any of claims 1 to 12.
CN202310477926.9A 2023-04-27 2023-04-27 Video recording method and electronic equipment Pending CN117135299A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310477926.9A CN117135299A (en) 2023-04-27 2023-04-27 Video recording method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310477926.9A CN117135299A (en) 2023-04-27 2023-04-27 Video recording method and electronic equipment

Publications (1)

Publication Number Publication Date
CN117135299A true CN117135299A (en) 2023-11-28

Family

ID=88855334

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310477926.9A Pending CN117135299A (en) 2023-04-27 2023-04-27 Video recording method and electronic equipment

Country Status (1)

Country Link
CN (1) CN117135299A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016095369A1 (en) * 2014-12-18 2016-06-23 中兴通讯股份有限公司 Screen recording method and device
WO2021052292A1 (en) * 2019-09-18 2021-03-25 华为技术有限公司 Video acquisition method and electronic device
CN113572954A (en) * 2021-06-15 2021-10-29 荣耀终端有限公司 Video recording method, electronic device, medium, and program product
WO2022105759A1 (en) * 2020-11-20 2022-05-27 华为技术有限公司 Video processing method and apparatus, and storage medium
US20220272200A1 (en) * 2020-09-30 2022-08-25 Honor Device Co., Ltd. Audio processing method and electronic device
WO2023029967A1 (en) * 2021-08-31 2023-03-09 华为技术有限公司 Audio playback method, and electronic device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016095369A1 (en) * 2014-12-18 2016-06-23 中兴通讯股份有限公司 Screen recording method and device
WO2021052292A1 (en) * 2019-09-18 2021-03-25 华为技术有限公司 Video acquisition method and electronic device
US20220272200A1 (en) * 2020-09-30 2022-08-25 Honor Device Co., Ltd. Audio processing method and electronic device
WO2022105759A1 (en) * 2020-11-20 2022-05-27 华为技术有限公司 Video processing method and apparatus, and storage medium
CN113572954A (en) * 2021-06-15 2021-10-29 荣耀终端有限公司 Video recording method, electronic device, medium, and program product
WO2023029967A1 (en) * 2021-08-31 2023-03-09 华为技术有限公司 Audio playback method, and electronic device

Similar Documents

Publication Publication Date Title
US11934352B2 (en) Card rendering method and electronic device
KR102221023B1 (en) Electronic device and method for processing image
WO2022052773A1 (en) Multi-window screen projection method and electronic device
KR100890236B1 (en) A method for capturing video data by utilizing a camera cell phone as a camera of a computer
CN104869305B (en) Method and apparatus for processing image data
US20130222629A1 (en) Methods, apparatuses, and computer program products for facilitating concurrent video recording and still image capture
US10237318B2 (en) Electronic device and method for encoding image data thereof
CN115756268A (en) Cross-device interaction method and device, screen projection system and terminal
KR20150027934A (en) Apparatas and method for generating a file of receiving a shoot image of multi angle in an electronic device
CN116033158B (en) Screen projection method and electronic equipment
CN117135299A (en) Video recording method and electronic equipment
CN117631950A (en) Split screen display method and related device
CN113642010B (en) Method for acquiring data of extended storage device and mobile terminal
CN116052701A (en) Audio processing method and electronic equipment
CN111159734A (en) Communication terminal and multi-application data inter-access processing method
CN116055613B (en) Screen projection method and device
CN116055715B (en) Scheduling method of coder and decoder and electronic equipment
CN117076284B (en) Page loading time length detection method, equipment and storage medium
US20190278638A1 (en) Image data management apparatus and method therefor
CN116033157B (en) Screen projection method and electronic equipment
CN116684521B (en) Audio processing method, device and storage medium
CN116095337A (en) Video compression and decompression method and electronic equipment
CN117130698A (en) Menu display method and electronic equipment
CN117707242A (en) Temperature control method and related device
CN116866470A (en) Method for acquiring media information and electronic equipment

Legal Events

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