WO2016095369A1 - 屏幕录制的方法及装置 - Google Patents
屏幕录制的方法及装置 Download PDFInfo
- Publication number
- WO2016095369A1 WO2016095369A1 PCT/CN2015/076127 CN2015076127W WO2016095369A1 WO 2016095369 A1 WO2016095369 A1 WO 2016095369A1 CN 2015076127 W CN2015076127 W CN 2015076127W WO 2016095369 A1 WO2016095369 A1 WO 2016095369A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- video
- stream
- audio
- memory
- system time
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N5/00—Details of television systems
- H04N5/76—Television signal recording
Definitions
- the present invention relates to the field of communications, and in particular to a method and apparatus for screen recording.
- Android mobile terminals are often used to demonstrate relevant content during education, conferences, presentations, etc.
- the usual method for screen recording of an Android mobile terminal is to record a screen by continuously intercepting a screen image, forming an image of one frame and one frame, and then encoding and compressing into a video file, and simultaneously recording the voice to form a voice file, and finally two The person synthesizes a multimedia video file that forms a screen.
- the above screen recording method has the following problems: First, the screen capture mode requires more processor computing resources, and the frame rate is very low, usually limited to 5 frames/second or less; secondly, image files and voice files are The synthesis takes time, which will take some time to generate the final video file after the end of the recording command. Once again, each time the recording and playback are resumed, a new video and voice file will be generated. The phenomenon of stagnation occurs; finally, since the synthesis of image files and voice files uses their respective time stamps, it is difficult for audio and video to be synchronized very accurately.
- the invention provides a method and apparatus for screen recording to at least solve the problem of low screen recording frame rate in the related art.
- a method for screen recording including: creating a virtual screen, wherein the virtual screen includes content to be recorded by the screen; acquiring a video stream of the virtual screen; and, according to the video stream Generate a video file.
- the method before generating the video file according to the video stream, the method further includes: acquiring the audio stream; and generating the video file according to the video stream, comprising: generating the video file based on the system time based on the video stream and the audio stream.
- generating the video file based on the system time based on the video stream and the audio stream comprises: writing the video stream to the first memory for video encoding processing, adding a time stamp based on the system time, and writing the audio stream to the second memory
- the audio encoding process is performed and a time stamp is added based on the system time; the video file is generated based on the system time based on the video stream after the video encoding process and the audio stream after the audio encoding process.
- the video stream is written into the first memory for video encoding processing and the time stamp is added based on the system time, including: writing the video stream to the first memory and adding a time stamp based on the system time, according to the first predetermined time
- the video stream encoded in the first memory is video encoded.
- Writing an audio stream to the second memory for audio encoding processing and adding a timestamp based on the system time includes: writing the audio stream to the second memory and adding a timestamp based on the system time, according to the second predetermined time interval
- the audio stream written in the second memory is subjected to audio encoding processing.
- Generating a video file based on the system time based on the video stream processed by the video encoding process and the audio stream after the audio encoding process including: encoding the video stream and the audio code after the video encoding according to the system time according to the third predetermined time interval
- the processed audio stream is written to the video file and the corresponding memory space is freed.
- the method further includes: pausing to acquire the video stream and the audio stream in response to the suspension request; determining whether the start request is received; and when receiving the start request, restarting acquiring the video stream and the audio stream.
- the method further comprises: creating a first thread and a second thread, wherein the first thread and the second thread are different threads.
- the video stream is written into the first memory for video encoding processing and the time stamp is added based on the system time, including: writing the video stream to the first memory through the first thread for video encoding processing and adding a time stamp based on the system time.
- Writing an audio stream to the second memory for audio encoding processing and adding a timestamp based on the system time includes: writing the audio stream to the second memory through the second thread for audio encoding processing and adding a timestamp based on the system time.
- an apparatus for screen recording including: a first creating module, configured to create a virtual screen, wherein the virtual screen includes content to be recorded by the screen; and a first acquiring module, Set to acquire a video stream of the virtual screen; and a generating module configured to generate a video file according to the above video stream.
- the apparatus further comprises: a second obtaining module configured to acquire an audio stream; and a generating module configured to generate the video file based on the system time based on the video stream and the audio stream.
- the generating module comprises: a first processing unit, configured to write the video stream into the first memory for video encoding processing and add a time stamp based on the system time; and the second processing unit is configured to write the audio stream into the first The second memory performs audio encoding processing and adds a time stamp based on the system time; the generating unit is configured to generate the video file based on the system time based on the video stream processed by the video encoding and the audio stream after the audio encoding processing.
- the first processing unit is configured to write the video stream into the first memory and add a timestamp based on the system time, and perform video encoding processing on the video stream written in the first memory according to the first predetermined time interval.
- the second processing unit is configured to write the audio stream to the second memory and add a timestamp based on the system time, and perform audio encoding processing on the audio stream written in the second memory according to the second predetermined time interval.
- the generating unit is configured to write the video encoded video stream and the audio encoded audio stream to the video file according to the system time according to the third predetermined time interval, and release the corresponding memory space.
- the apparatus further includes: a pause module configured to suspend acquisition of the video stream and the audio stream in response to the suspend request; determine whether a start request is received; and when the start request is received, resume acquiring the video stream and the audio stream.
- a pause module configured to suspend acquisition of the video stream and the audio stream in response to the suspend request; determine whether a start request is received; and when the start request is received, resume acquiring the video stream and the audio stream.
- the apparatus further includes: a second creation module, configured to create the first thread and the second thread, wherein the first thread and the second thread are different threads; the first processing unit is configured to video through the first thread The stream is written into the first memory for video encoding processing and the time stamp is added based on the system time; the second processing unit is configured to write the audio stream to the second memory through the second thread for audio encoding processing and add the system time as a reference Timestamp.
- a second creation module configured to create the first thread and the second thread, wherein the first thread and the second thread are different threads
- the first processing unit is configured to video through the first thread The stream is written into the first memory for video encoding processing and the time stamp is added based on the system time
- the second processing unit is configured to write the audio stream to the second memory through the second thread for audio encoding processing and add the system time as a reference Timestamp.
- a virtual screen is created, a video stream of the virtual screen is acquired, and a video file is generated according to the video stream, so that a video file with a higher frame rate can be recorded, and the frame rate of the screen recording is improved.
- FIG. 1 is a flow chart of a method of screen recording according to an embodiment of the present invention.
- FIG. 2 is a structural block diagram of an apparatus for screen recording according to an embodiment of the present invention.
- FIG. 3 is a structural block diagram of an apparatus for screen recording according to an alternative embodiment of the present invention.
- FIG. 4 is a structural block diagram of a generation module according to an alternative embodiment of the present invention.
- FIG. 5 is a flowchart of a screen recording method according to an alternative embodiment 2 of the embodiment of the present invention.
- FIG. 6 is a flowchart of a recording screen and a recording method according to an alternative embodiment 2 of the embodiment of the present invention.
- FIG. 7 is a flowchart of a separate screen recording method according to an alternative embodiment 2 of the embodiment of the present invention.
- FIG. 8 is a flowchart of a separate recording method according to an alternative embodiment 2 of the embodiment of the present invention.
- FIG. 9 is a schematic structural diagram of a screen recording system according to an alternative embodiment 3 of the embodiment of the present invention.
- FIG. 1 is a flowchart of a method for screen recording according to an embodiment of the present invention. As shown in FIG. 1, the method includes steps S102 to S106:
- Step S102 creating a virtual screen, wherein the virtual screen includes content to be recorded by the screen.
- Step S104 Acquire a video stream of the virtual screen.
- Step S106 generating a video file according to the above video stream.
- a virtual screen is created, the virtual screen includes the content to be recorded on the screen, the video stream of the virtual screen is acquired, and the video file is generated according to the video stream, thereby improving the frame rate of the screen recording.
- the virtual screen can be created by the multi-screen display function of the Android operating system.
- the sound content can also be recorded while recording the contents of the screen.
- the presentation slides are displayed on the screen, the speaker gives an oral presentation, the sound of the oral presentation and the slide displayed on the screen constitute the complete content of the speech.
- the audio stream may also be acquired.
- an operational interface can be provided, with the user selecting whether to record the voice or the screen, or simultaneously recording the voice and the screen.
- generating the video file according to the video stream may include: generating the video file based on the system time and the audio stream according to the system time and the audio stream. With this embodiment, both voice and video are based on system time, enabling accurate synchronization of voice and video.
- the generating the video file based on the system time based on the video stream and the audio stream includes: writing the video stream to the first memory for video encoding processing, and adding a timestamp based on the system time, and writing the audio stream.
- the second memory is input for audio encoding processing and a time stamp is added based on the system time; the video file is generated based on the system time based on the video stream after the video encoding process and the audio stream after the audio encoding process.
- the video file is synthesized after the end of the recording, which causes it to wait for a while after the end of the recording to obtain the video file.
- the video stream is written into the first memory for video encoding processing, and the time stamp is added based on the system time, including: writing the video stream to the first memory and using the system time as The reference adds a timestamp, and performs video encoding processing on the video stream written in the first memory according to the first predetermined time interval.
- Writing an audio stream to the second memory for audio encoding processing and adding a timestamp based on the system time includes: writing the audio stream to the second memory and adding a timestamp based on the system time, according to the second predetermined time interval
- the audio stream written in the second memory is subjected to audio encoding processing.
- the video file is generated according to the system time based on the video stream after the video encoding process and the audio stream after the audio encoding process, including: according to the third predetermined time interval, the system time For the reference, the video encoded video stream and the audio encoded audio stream are written into the video file, and the corresponding memory space is released.
- video and audio can be processed in parallel by different threads, thereby increasing processing speed. Therefore, the above method further includes: creating a first thread and a second thread, wherein the first thread and the second thread are different threads.
- Writing a video stream to the first memory for video encoding processing and adding a time stamp based on the system time includes: writing a video stream to the first memory through the first thread for video encoding processing and adding a time stamp based on the system time;
- Writing an audio stream to the second memory for audio encoding processing and adding a timestamp based on the system time includes: writing the audio stream to the second memory through the second thread for audio encoding processing and adding a timestamp based on the system time.
- the foregoing method may further include: suspending acquiring the video stream and the audio stream in response to the suspension request; determining whether the start request is received; and when receiving the start request, restarting acquiring the video stream and the audio stream.
- a device for screen recording is provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and will not be described again.
- the term "module” can be implemented to be predetermined A combination of functional software and/or hardware.
- the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
- the apparatus includes: a first creation module 10, a first acquisition module 20, and a generation module 30, wherein the first creation module 10
- the setting is to create a virtual screen, wherein the virtual screen includes content to be recorded by the screen
- the first obtaining module 20 is connected to the first creating module 10, and is configured to acquire a video stream of the virtual screen
- the generating module 30, and the first The obtaining module 20 is connected and configured to generate a video file according to the above video stream.
- the foregoing apparatus may further include: a second obtaining module 40, connected to the generating module 30, configured to acquire an audio stream.
- the generating module 30 is configured to generate a video file based on the system time and the audio stream based on the system time.
- the generating module 30 includes: a first processing unit 310 configured to write a video stream into the first memory for video encoding processing, and the system time is Adding a timestamp to the reference; the second processing unit 320 is configured to write the audio stream to the second memory for audio encoding processing and add a timestamp based on the system time; the generating unit 330 is configured to process the video stream according to the video encoding process The audio stream after the audio encoding process generates a video file based on the system time.
- the first processing unit 310 is configured to write the video stream into the first memory and add a timestamp based on the system time, and the first memory is in accordance with the first predetermined time interval.
- the written video stream is subjected to video encoding processing;
- the second processing unit 320 is configured to write the audio stream into the second memory and add a time stamp based on the system time, and write the second memory in accordance with the second predetermined time interval.
- the audio stream is audio encoded.
- the generating unit 330 is configured to write the video encoded video stream and the audio encoded audio stream according to the system time according to the third predetermined time interval. Video files and free up the corresponding memory space.
- the apparatus may further include: a pause module configured to pause to acquire the video stream and the audio stream in response to the suspension request; determine whether a start request is received; and when the start request is received, Start getting video streams and audio streams.
- a pause module configured to pause to acquire the video stream and the audio stream in response to the suspension request; determine whether a start request is received; and when the start request is received, Start getting video streams and audio streams.
- the foregoing apparatus may further include: a second creating module, configured to create a first thread and a second thread, where the first thread and the second thread are different threads; a processing unit configured to write the video stream to the first memory through the first thread for video encoding processing and to system time Adding a timestamp to the reference; the second processing unit is configured to write the audio stream to the second memory through the second thread for audio encoding processing and add a timestamp based on the system time.
- a second creating module configured to create a first thread and a second thread, where the first thread and the second thread are different threads
- a processing unit configured to write the video stream to the first memory through the first thread for video encoding processing and to system time Adding a timestamp to the reference
- the second processing unit is configured to write the audio stream to the second memory through the second thread for audio encoding processing and add a timestamp based on the system time.
- a virtual screen is created through the multi-screen display function of the Android system, and the video stream of the virtual screen is collected, written into the memory, the system time stamp is increased, and the encoding and compression are performed; and the voice is recorded at the same time.
- the voice stream is collected and written into the memory, the system timestamp is added, and the encoding and compression are performed, and then the encoded video stream and the voice stream are synthesized according to the same timestamp in the memory, and finally the multimedia video file of the specified format is formed.
- MP4 Moving Picture Experts Group Layer 4
- a video frame rate such as 30 frames/second
- a video encoding compression format such as a new generation digital video compression format H.264 following the MP4 jointly proposed by the International Organization for Standardization and the International Telecommunication Union, may be configured.
- Regularly synthesize time intervals such as 30 seconds.
- the screen recording method of this example mainly includes the following steps:
- parameter configuration, including recording type is screen recording, that is, simultaneous recording and recording, or separate recording, or separate recording, as well as specific parameters of recording and recording, including video frame rate, video resolution, video format , voice format, multimedia video file format, etc.
- screen recording after receiving the recording start command, first use the Android multi-screen display function, according to the set parameters, create a virtual screen.
- voice recording after receiving the recording start command, obtain the audio stream, write to another memory, perform audio encoding and decoding and compression processing, and increase the system timestamp for synchronization with the video stream synthesis, such as MP3 format Audio stream.
- step 6 If it is in the pause state and receives the continuation command, go to step 3 and continue recording.
- the video stream and the voice stream are synthesized according to the same system timestamp, and the result file, that is, the multimedia video file in the MP4 format, is released, and the occupied memory is released.
- the video stream and the voice stream are combined according to the same system timestamp, and the result file, that is, the multimedia video file in the MP4 format, is released, and the occupied memory is released, and the recording is ended. End.
- the screen recording system of this example includes:
- Parameter configuration module which is responsible for configuring recording parameters, including recording type, that is, screen recording (simultaneous recording and recording), or separate recording, or separate recording, as well as specific parameters of recording and recording, including video capture frames.
- Record parameters such as 30 frames/second, video resolution, video format, such as H.264, voice format, such as Moving Picture Experts Group Layer 3 (MP3) format, multimedia video file format, Such as MP4 and so on.
- MP3 Moving Picture Experts Group Layer 3
- Video capture module which is responsible for utilizing Android's multi-screen display technology, creating a virtual screen according to the set parameters, acquiring the video stream of the virtual screen, writing to the memory, and performing time stamping and video encoding and decoding compression processing, such as H2. 64-format video stream.
- the audio acquisition module is responsible for collecting audio streams, writing to memory, and performing time stamping and audio codec compression processing to obtain an audio stream such as MP3 format.
- the command monitoring module monitors the commands during the screen recording process. After receiving the commands, the module performs corresponding distribution processing and distributes them to other corresponding modules for processing. For example, the monitoring of commands such as recording, pausing, continuing, ending recording, and synchronizing time interval is received, and these commands are sent to other corresponding modules for processing.
- Synchronous synthesis module which is responsible for synchronizing the in-memory video stream and audio stream according to the unified system timestamp, and writing the result file from the memory, such as the multimedia video file in MP4 format, and then releasing the occupied memory.
- the encoding, decoding, compression, and the like of the video stream audio stream are processed in the memory, the efficiency is high, and the recording is performed periodically while the recording is completed, and the recording result file is generated in real time after the recording ends. Since the video stream and the voice stream use the same time stamp of the system, the two can achieve precise synchronization. Moreover, since the processing is performed periodically in the memory, the result file is written after the processing is completed, and the memory is released, so that the total amount of memory consumed is always limited, thereby enabling unlimited recording. In addition, thread processing video processing, processing, and voice collection and processing, that is, multi-thread processing, are separately created, thereby achieving faster recording.
- FIG. 5 is a flowchart of a screen recording method according to an alternative embodiment 2 of the embodiment of the present invention. As shown in FIG. 5, the method includes steps S502 to S508.
- Step S502 parameter configuration, including recording type, screen recording (ie simultaneous recording), separate recording, separate recording, video capture frame rate, such as 30 frames/second, audio format parameters, such as MP3, synthesis time interval, etc. , for example, 30 seconds.
- Step S504 screen recording, receiving a recording start instruction, first creating a virtual screen, then acquiring a video stream of the virtual screen, writing to the memory, performing video encoding and decoding and compression processing, adding a system time stamp to form, for example, H.264 Formatted video stream.
- Step S506 voice recording, receiving a recording start instruction, acquiring an audio stream, writing to the memory, performing audio encoding and decoding and compression processing, and adding a system time stamp to form an audio stream such as an MP3 format.
- Step S508 synthesizing the multimedia video file, receiving the recording end instruction, or synthesizing the time interval, synthesizing the video stream and the audio stream according to the unified system timestamp, writing the result file, such as the multimedia video file in the MP4 format, and releasing Occupied memory.
- the recording type can be divided into three types: screen recording (ie simultaneous recording and recording), the method is shown in FIG. 6; single recording screen, the method is shown in FIG. 7; This method is shown in Figure 8.
- screen recording ie simultaneous recording and recording
- FIG. 6 single recording screen
- FIG. 7 single recording screen
- FIG. 8 This method is shown in Figure 8.
- the three types are described in detail below.
- FIG. 6 is a flowchart of a recording screen and a recording method according to an alternative embodiment of the present invention. As shown in FIG. 6, the method includes the following steps:
- Step S602 performing parameter setting, including virtual screen parameters, including a video frame rate, such as 30 frames/second, a screen resolution, etc., setting audio format parameters, such as MP3, a synthesis time interval, and the like, such as 30 seconds.
- virtual screen parameters including a video frame rate, such as 30 frames/second, a screen resolution, etc.
- audio format parameters such as MP3, a synthesis time interval, and the like, such as 30 seconds.
- Step S604 after receiving the screen recording start command, first use the Android multi-screen display technology to create a virtual screen according to the set parameters.
- Step S606 acquiring a virtual screen video stream, writing to the memory, performing video encoding and decoding and compression processing, and adding a system time stamp to form a video stream such as an H.264 format.
- Acquire audio streams write to memory, perform audio codec and compression processing, and increase system timestamps to form audio streams such as MP3 format.
- step S608 it is determined whether a command to end recording is received, and if yes, go to step S620, otherwise go to step S610.
- step S610 it is judged whether a command to suspend recording is received, and if yes, the process goes to step S612, otherwise the process goes to step S616.
- step S612 the recording is stopped, that is, the acquisition of the video stream and the audio stream is stopped, and the writing to the memory is stopped.
- step S614 it is determined whether a command to continue recording is received, and if yes, go to step S606, otherwise go to step S612.
- step S616 it is determined whether the synchronization synthesis time interval is reached. If yes, the process goes to step S618, otherwise the process goes to step S606.
- Step S618 synchronizing the video stream and the audio stream according to a unified system timestamp, and writing a result file, such as a multimedia video file in an MP4 format, from the memory, and then releasing the occupied memory.
- step S620 the video stream and the audio stream are synchronously synthesized according to the unified system timestamp, and the result file is written from the memory, such as the multimedia video file in the MP4 format, and then the occupied memory is released, and the recording ends, and the process ends.
- FIG. 7 is a flowchart of a separate screen recording method according to an alternative embodiment 2 of the embodiment of the present invention. As shown in FIG. 7, the method includes the following steps:
- Step S702 performing parameter setting, including virtual screen parameters, including a video frame rate, such as 30 frames/second, a screen resolution, etc., setting parameters such as a synthesis time interval, such as 30 seconds.
- virtual screen parameters including a video frame rate, such as 30 frames/second, a screen resolution, etc.
- setting parameters such as a synthesis time interval, such as 30 seconds.
- Step S704 after receiving the separate screen recording start command, first use the Android multi-screen display technology to create a virtual screen according to the set parameters.
- Step S706 acquiring a virtual screen video stream, writing to the memory, performing video encoding and decoding and compression processing, and adding a system time stamp to form a video stream such as an H.264 format.
- step S708 it is determined whether a command to end the recording screen is received, and if yes, the process goes to step S720, otherwise to step S710.
- step S710 it is determined whether a command to pause the recording is received, and if yes, the process goes to step S712, otherwise the process goes to step S716.
- step S712 the recording is stopped, that is, the acquisition of the video stream is stopped, and the writing to the memory is stopped.
- step S714 it is determined whether a command to continue recording is received, and if yes, go to step S706, otherwise go to step S712.
- step S716 it is determined whether the synchronization synthesis time interval is reached. If yes, the process goes to step S718, otherwise the process goes to step S706.
- step S718 the video stream is written from the memory to the result file, such as a multimedia video file in the MP4 format, and then the occupied memory is released.
- the result file such as a multimedia video file in the MP4 format
- step S720 the video stream is written into the result file from the memory, such as a multimedia video file in the MP4 format, and then the occupied memory is released, and the recording is ended, and the process ends.
- the memory such as a multimedia video file in the MP4 format
- FIG. 8 is a flowchart of a separate recording method according to an alternative embodiment 2 of the embodiment of the present invention. As shown in FIG. 8, the method includes the following steps:
- Step S802 performing parameter setting, setting audio format parameters, such as MP3, setting parameters such as a synthesis time interval, such as 30 seconds.
- Step S804 after receiving the separate recording start command, acquiring the audio stream, writing to the memory, performing audio encoding and decoding and compression processing, and adding a system time stamp to form an audio stream such as an MP3 format.
- step S806 it is determined whether a command to end recording is received, and if yes, the process goes to step S818, otherwise to step S808.
- step S808 it is judged whether a command to suspend recording is received, and if yes, the process goes to step S810, otherwise the process goes to step S814.
- step S810 the recording is stopped, that is, the acquisition of the audio stream is stopped, and the writing to the memory is stopped.
- step S812 it is determined whether a command to continue recording is received, and if yes, go to step S806, otherwise go to step S810.
- step S814 it is determined whether the synchronization synthesis time interval is reached. If yes, the process proceeds to step S816, otherwise, the process proceeds to step S804.
- step S816 the audio stream is written from the memory to the result file, such as an audio file in the MP3 format, and then the occupied memory is released.
- FIG. 9 is a schematic structural diagram of a screen recording system according to an alternative embodiment 3 of the present invention.
- the screen recording system includes: a parameter configuration module 910, a video collection module 920, an audio collection module 930, and a command monitoring module. 940, Synchronization Synthesis Module 950, the various modules of the system embodiment of the present invention are described in detail below.
- the parameter configuration module 910 is configured to configure recording parameters, including recording type, that is, screen recording (simultaneous recording and recording), or separate recording, or separate recording, and specific parameters of the recording and recording, including video capture.
- Record rate such as 30 frames/second
- video resolution video resolution
- video format such as H.264
- voice format such as MP3
- MP4 multimedia video file format
- the video capture module 920 is configured to utilize the multi-screen display technology of Android to create a virtual screen according to the set parameters, obtain a video stream of the virtual screen, write the memory, and perform time stamp and video codec compression processing to obtain, for example, H2. .64 format video stream.
- the audio collection module 930 is responsible for collecting audio streams, writing to the memory, and performing time stamping and audio codec compression processing to obtain an audio stream such as an MP3 format.
- the command monitoring module 940 monitors the commands in the screen recording process, and after receiving the commands, performs corresponding distribution processing and distributes them to other corresponding modules for processing. For example, the monitoring of commands such as recording, pausing, continuing, ending recording, and synchronizing time interval is received, and these commands are sent to other corresponding modules for processing.
- the synchronous synthesizing module 950 is configured to synchronously synthesize the video stream and the audio stream in the memory according to the unified system time stamp, and write the result file from the memory, such as a multimedia video file in the MP4 format, and then release the occupied memory.
- modules or steps of the present invention described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein. Perform the steps shown or described, or separate them into individual integrated circuit modules, or Multiple of these modules or steps are fabricated as a single integrated circuit module. Thus, the invention is not limited to any specific combination of hardware and software.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Signal Processing For Digital Recording And Reproducing (AREA)
- Television Signal Processing For Recording (AREA)
Abstract
本发明公开了一种屏幕录制的方法及装置,其中,屏幕录制的方法,包括:创建虚拟屏幕,其中,该虚拟屏幕中包含有待屏幕录制的内容;获取上述虚拟屏幕的视频流;以及根据上述视频流生成视频文件。通过本发明,可以录制帧率更高的视频文件,提高了屏幕录制的帧率和效率。
Description
本发明涉及通信领域,具体而言,涉及一种屏幕录制的方法及装置。
随着安卓(Android)移动终端的普及,在教育、会议、演讲等过程中,经常采用Android移动终端来演示相关内容,为方便用户回顾,通常需要将屏幕画面及现场声音录制下来,形成多媒体视频以便回放。
相关技术中,Android移动终端的屏幕录制采用的通常方法是,通过连续截取屏幕画面的方式录制屏幕,形成一帧一帧的图像,然后编码压缩成视频文件,同时录制语音形成语音文件,最后两者合成形成录屏的多媒体视频文件。
上述的屏幕录制方法存在以下几个问题:首先,截屏的方式录屏需要消耗较多处理器运算资源,而且帧率很低,通常限制在5帧/秒以下;其次,图像文件和语音文件的合成需要消耗时间,导致结束录屏指令发出后,需要一段时间才能产生最终的视频文件;再次,在录制过程中每次暂停、恢复都将产生新的视频和语音文件,后续需要拼接合成,会出现卡顿现象;最后,由于图像文件和语音文件的合成使用各自的时间戳,因此音频和视频很难非常精确的同步。
针对相关技术中屏幕录制的上述问题,目前尚未提出有效的解决方案。
发明内容
发明提供了一种屏幕录制的方法及装置,以至少解决相关技术中屏幕录制帧率低的问题。
根据本发明实施例的一个方面,提供了一种屏幕录制的方法,包括:创建虚拟屏幕,其中,该虚拟屏幕中包含有待屏幕录制的内容;获取虚拟屏幕的视频流;以及,根据上述视频流生成视频文件。
优选地,根据视频流生成视频文件之前,还包括:获取音频流;根据视频流生成视频文件,包括:根据视频流和音频流以系统时间为基准生成视频文件。
优选地,根据视频流和音频流以系统时间为基准生成视频文件,包括:将视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳,将音频流写入第二内存进行音频编码处理并以系统时间为基准添加时间戳;根据视频编码处理后的视频流和音频编码处理后的音频流以系统时间为基准生成视频文件。
优选地,将视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳,包括:将视频流写入第一内存并以系统时间为基准添加时间戳,按照第一预定时间间隔对第一内存中写入的视频流进行视频编码处理。将音频流写入第二内存进行音频编码处理并以系统时间为基准添加时间戳,包括:将音频流写入第二内存并以系统时间为基准添加时间戳,按照第二预定时间间隔对第二内存中写入的音频流进行音频编码处理。根据视频编码处理后的视频流和音频编码处理后的音频流以系统时间为基准生成视频文件,包括:按照第三预定时间间隔,以系统时间为基准将视频编码处理后的视频流和音频编码处理后的音频流写入视频文件,并释放相应的内存空间。
优选地,上述方法还包括:响应暂停请求,暂停获取视频流和音频流;判断是否接收到开始请求;当接收到开始请求,重新开始获取视频流和音频流。
优选地,方法还包括:创建第一线程和第二线程,其中,第一线程与第二线程为不同的线程。将视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳,包括:通过第一线程将视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳。将音频流写入第二内存进行音频编码处理并以系统时间为基准添加时间戳,包括:通过第二线程将音频流写入第二内存进行音频编码处理并以系统时间为基准添加时间戳。
根据本发明实施例的另一个方面,提供了一种屏幕录制的装置,包括:第一创建模块,设置为创建虚拟屏幕,其中,该虚拟屏幕中包含有待屏幕录制的内容;第一获取模块,设置为获取虚拟屏幕的视频流;以及,生成模块,设置为根据上述视频流生成视频文件。
优选地,装置还包括:第二获取模块,设置为获取音频流;生成模块,设置为根据视频流和音频流以系统时间为基准生成视频文件。
优选地,生成模块,包括:第一处理单元,设置为将视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳;第二处理单元,设置为将音频流写入第二内存进行音频编码处理并以系统时间为基准添加时间戳;生成单元,设置为根据视频编码处理后的视频流和音频编码处理后的音频流以系统时间为基准生成视频文件。
优选地,第一处理单元,设置为将视频流写入第一内存并以系统时间为基准添加时间戳,按照第一预定时间间隔对第一内存中写入的视频流进行视频编码处理。第二处理单元,设置为将音频流写入第二内存并以系统时间为基准添加时间戳,按照第二预定时间间隔对第二内存中写入的音频流进行音频编码处理。生成单元,设置为按照第三预定时间间隔,以系统时间为基准将视频编码处理后的视频流和音频编码处理后的音频流写入视频文件,并释放相应的内存空间。
优选地,上述装置还包括:暂停模块,设置为响应暂停请求,暂停获取视频流和音频流;判断是否接收到开始请求;当接收到开始请求,重新开始获取视频流和音频流。
优选地,装置还包括:第二创建模块,设置为创建第一线程和第二线程,其中,第一线程与第二线程为不同的线程;第一处理单元,设置为通过第一线程将视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳;第二处理单元,设置为通过第二线程将音频流写入第二内存进行音频编码处理并以系统时间为基准添加时间戳。
通过本发明实施例,创建虚拟屏幕,获取虚拟屏幕的视频流,根据该视频流生成视频文件,可以录制帧率较高的视频文件,提高了屏幕录制的帧率。
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:
图1是根据本发明实施例的屏幕录制的方法的流程图;
图2是根据本发明实施例的屏幕录制的装置的结构框图;
图3是根据本发明实施例一个可选实施方式的屏幕录制的装置的结构框图;
图4是根据本发明实施例一个可选实施方式的生成模块的结构框图;
图5是根据本发明实施例可选实施方式二的屏幕录制方法的流程图;
图6是根据本发明实施例可选实施方式二的录屏和录音方法的流程图;
图7是根据本发明实施例可选实施方式二的单独录屏方法的流程图;
图8是根据本发明实施例可选实施方式二的单独录音方法的流程图;以及
图9是根据本发明实施例可选实施方式三的屏幕录制系统的结构示意图。
下文中将参考附图并结合实施例来详细说明本发明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。
在本实施例中提供了一种屏幕录制的方法,图1是根据本发明实施例的屏幕录制的方法的流程图,如图1所示,该方法包括步骤S102至步骤S106:
步骤S102,创建虚拟屏幕,其中,该虚拟屏幕中包含有待屏幕录制的内容。
步骤S104,获取上述虚拟屏幕的视频流。
步骤S106,根据上述视频流生成视频文件。
通过本发明实施例,创建虚拟屏幕,虚拟屏幕中包含待屏幕录制的内容,获取虚拟屏幕的视频流,根据该视频流生成视频文件,提高了屏幕录制的帧率。
在上述步骤S102中,以运行Android操作系统为例的终端为例,可以通过Android操作系统的多屏显示功能创建虚拟屏幕。
实际应用中,在记录屏幕内容的同时,还可以记录声音内容。作为一个例子,在演讲中,屏幕上显示演讲幻灯片,演讲者进行口头演讲,口头演讲的音声和屏幕显示的幻灯片构成演讲的完整内容。为了录制语音,在本发明实施例一个可选实施方式中,上述步骤S106根据视频流生成视频文件之前,还可以获取音频流。可选地,可以提供操作接口,由用户选择录制语音还是屏幕,或者同时录制语音和屏幕。
相关技术中,分别生成语音和屏幕内容的文件,然后将语音的文件和屏幕内容的文件合成得到视频文件。由于语音的文件和屏幕视频的文件采用不同的时间基准,因此语音和视频难以实现精确同步,这就导致了语音和屏幕内容不一致。因此,在本发明实施例的一个可选实施方式中,上述步骤S106根据视频流生成视频文件可以包括:根据上述视频流和音频流以系统时间为基准生成视频文件。通过该实施方式,语音和视频均以系统时间为基准,实现了语音和视频的精确同步。
相关技术中,将图像或语音写入文件中,在录制结束时,对文件中的语音和视频进行编码,对文件的读写操作需要消耗大量的运算资源。在本发明实施例的一个可选
实施方式中,上述根据视频流和音频流以系统时间为基准生成视频文件,包括:将上述视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳,将上述音频流写入第二内存进行音频编码处理并以系统时间为基准添加时间戳;根据视频编码处理后的视频流和音频编码处理后的音频流以系统时间为基准生成视频文件。通过该实施方式,在内存中进行处理,提高了处理效率。
此外,相关技术中,在录制结束后才合成视频文件,这导致在录制结束后还需要等待一段时间才能得到视频文件。在本发明实施例的一个可选实施方式中,将视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳,包括:将视频流写入第一内存并以系统时间为基准添加时间戳,按照第一预定时间间隔对第一内存中写入的视频流进行视频编码处理。将音频流写入第二内存进行音频编码处理并以系统时间为基准添加时间戳,包括:将音频流写入第二内存并以系统时间为基准添加时间戳,按照第二预定时间间隔对第二内存中写入的音频流进行音频编码处理。通过该实施方式,在获取到视频流或音频流后,按照一定的时间间隔进行视频和音频编码处理,而不是在结束时才进行处理,从而该实施方式可以在录制结束时快速得到视频文件。
在本发明实施例的一个可选实施方式中,根据视频编码处理后的视频流和音频编码处理后的音频流以系统时间为基准生成视频文件,包括:按照第三预定时间间隔,以系统时间为基准将视频编码处理后的视频流和音频编码处理后的音频流写入视频文件,并释放相应的内存空间。通过该实施方式,保证了内存空间不被一直占用,从而可以实现不限时长的录制。
在本发明实施例的一个可选实施方式中,可以通过不同的线程并行处理视频和音频,从而提高处理速度。因此,上述方法还包括:创建第一线程和第二线程,其中,第一线程与第二线程为不同的线程。将视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳,包括:通过第一线程将视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳;将音频流写入第二内存进行音频编码处理并以系统时间为基准添加时间戳,包括:通过第二线程将音频流写入第二内存进行音频编码处理并以系统时间为基准添加时间戳。通过该可选实施方式,实现了音频和视频的并行处理,提高了处理速度。
可选地,上述方法还可以包括:响应暂停请求,暂停获取视频流和音频流;判断是否接收到开始请求;当接收到开始请求,重新开始获取视频流和音频流。
在本实施例中提供了一种屏幕录制的装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定
功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。
图2是根据本发明实施例的屏幕录制的装置的结构框图,如图2所示,该装置包括:第一创建模块10、第一获取模块20和生成模块30,其中,第一创建模块10,设置为创建虚拟屏幕,其中,该虚拟屏幕中包含有待屏幕录制的内容;第一获取模块20,与第一创建模块10相连,设置为获取虚拟屏幕的视频流;生成模块30,与第一获取模块20相连,设置为根据上述视频流生成视频文件。
在本发明实施例的一个可选实施方式中,如图3所示,上述装置还可以包括:第二获取模块40,与生成模块30相连,设置为获取音频流。生成模块30,设置为根据上述视频流和音频流以系统时间为基准生成视频文件。
在本发明实施例的一个可选实施方式中,如图4所示,上述生成模块30包括:第一处理单元310,设置为将视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳;第二处理单元320,设置为将音频流写入第二内存进行音频编码处理并以系统时间为基准添加时间戳;生成单元330,设置为根据视频编码处理后的视频流和音频编码处理后的音频流以系统时间为基准生成视频文件。
在本发明实施例的一个可选实施方式中,第一处理单元310,设置为将视频流写入第一内存并以系统时间为基准添加时间戳,按照第一预定时间间隔对第一内存中写入的视频流进行视频编码处理;第二处理单元320,设置为将音频流写入第二内存并以系统时间为基准添加时间戳,按照第二预定时间间隔对第二内存中写入的音频流进行音频编码处理。
在本发明实施例的一个可选实施方式中,上述生成单元330,设置为按照第三预定时间间隔,以系统时间为基准将视频编码处理后的视频流和音频编码处理后的音频流写入视频文件,并释放相应的内存空间。
在本发明实施例的一个可选实施方式中,上述装置还可以包括:暂停模块,设置为响应暂停请求,暂停获取视频流和音频流;判断是否接收到开始请求;当接收到开始请求,重新开始获取视频流和音频流。
在本发明实施例的一个可选实施方式中,上述装置还可以包括:第二创建模块,设置为创建第一线程和第二线程,其中,第一线程与第二线程为不同的线程;第一处理单元,设置为通过第一线程将视频流写入第一内存进行视频编码处理并以系统时间
为基准添加时间戳;第二处理单元,设置为通过第二线程将音频流写入第二内存进行音频编码处理并以系统时间为基准添加时间戳。
下面通过实例对本发明实施例进行描述。
可选实施方式一
在本可选实施方式中,通过Android系统的多屏显示功能,创建一路虚拟屏幕,并且采集虚拟屏幕的视频流,写入内存中,增加系统时间戳,并进行编码、压缩;同时录制语音,采集语音流,也写入内存中,增加系统时间戳,并进行编码、压缩,然后在内存中将编码压缩后视频流和语音流根据同一时间戳进行合成,最后形成指定格式的多媒体视频文件,比如动态图像专家组第四层(Moving Picture Experts Group Layer 4,简称为MP4)格式。优选地,在本实例中,可以配置视频帧率,比如30帧/秒,视频编码压缩格式,比如国际标准化组织和国际电信联盟共同提出的继MP4之后的新一代数字视频压缩格式H.264,定期合成时间间隔,比如30秒。
本实例的屏幕录制方法,主要包括以下步骤:
1,进行参数配置,包括录制类型,是屏幕录制,即同时录屏和录音,还是单独录屏,或单独录音,以及录屏、录音的具体参数,包括视频帧率、视频分辨率、视频格式、语音格式、多媒体视频文件格式等。
2,屏幕录制,收到录制开始命令后,首先利用Android的多屏显示功能,根据设置的参数,创建虚拟屏幕。
3,获取虚拟屏幕的视频流,写入一块内存中,进行视频编解码和压缩处理,并增加系统时间戳,用于和音频流的合成同步,得到比如H.264格式的视频流。
4,语音录制,收到录制开始命令后,获取音频流,写入另一块内存中,进行音频编解码和压缩处理,并增加系统时间戳,用于和视频流的合成同步,得到比如MP3格式的音频流。
5,录制过程中如果收到暂停命令,则停止获取视频流和音频流,也不再往内存里写视频流和音频流。
6,如果是暂停状态,并收到继续命令,则转到步骤3,继续进行录制。
7,如果合成时间间隔到了,则将视频流和语音流按照同一个系统时间戳进行合成,写入结果文件,即比如MP4格式的多媒体视频文件,并释放占用的内存。
8,如果收到录制结束命令,则将视频流和语音流按照同一个系统时间戳进行合成,写入结果文件,即比如MP4格式的多媒体视频文件,并释放占用的内存,并结束录制,流程结束。
需要说明的是,处理同时录屏和录音外,也可以只进行录音,不进行录屏;也可以只进行录屏,不进行录音。
本实例的屏幕录制系统,包括:
参数配置模块,该模块负责对录制参数进行配置,包括录制类型,即屏幕录制(同时录屏和录音),还是单独录屏,或单独录音,以及录屏、录音的具体参数,包括视频采集帧率,比如30帧/秒、视频分辨率、视频格式,比如H.264、语音格式,比如动态图像专家组第三层(Moving Picture Experts Group Layer 3,简称为MP3)格式、多媒体视频文件格式,比如MP4等。
视频采集模块,该模块负责利用Android的多屏显示技术,根据设置的参数,创建虚拟屏幕,获取虚拟屏幕的视频流,写入内存,并进行时间戳和视频编解码压缩处理,得到比如H2.64格式的视频流。
音频采集模块,该模块负责音频流的采集,写入内存,并进行时间戳和音频编解码压缩处理,得到比如MP3格式的音频流。
命令监控模块,该模块对屏幕录制过程中的命令进行监控,收到命令后,进行相应的分发处理,分发给其他相应的模块进行处理。比如开始录制、暂停、继续、结束录制、合成时间间隔到达等命令的监控,收到这些命令后发给其他相应模块进行处理。
同步合成模块,该模块负责对内存中视频流和音频流根据统一的系统时间戳进行同步合成,并从内存中写入结果文件,比如MP4格式的多媒体视频文件,然后释放占用的内存。
通过本可选实施方式,由于在内存中进行视频流音频流的编解码、压缩等处理,效率较高,而且边录制边定期处理,录制结束后,将实时产生录制结果文件。由于视频流和语音流采用的是系统同一个时间戳,两者能够实现精确同步。而且由于在内存中进行定期处理,处理完成后就写入结果文件,释放这部分内存,这样消耗的内存总量总是有限的,从而能够实现不限时长的录制。另外,分别创建线程处理视频采集、处理和语音采集、处理,即多线程处理,从而实现更快速的录制。
可选实施方式二
图5是根据本发明实施例可选实施方式二的屏幕录制方法的流程图,如图5所示,该方法包括步骤S502至步骤S508。
步骤S502,参数配置,包括录制类型,屏幕录制(即同时录屏录音)、单独录屏、单独录音,视频采集帧率,比如30帧/秒,音频格式参数,比如MP3,合成时间间隔等参数,比如30秒。
步骤S504,屏幕录制,收到录制开始指令,首先创建一个虚拟屏幕,然后获取虚拟屏幕的视频流,写入内存中,并进行视频编解码和压缩处理,增加系统时间戳,形成比如H.264格式的视频流。
步骤S506,语音录制,收到录制开始指令,获取音频流,写入内存中,并进行音频编解码和压缩处理,并增加系统时间戳,形成比如MP3格式的音频流。
步骤S508,合成多媒体视频文件,收到录屏结束指令,或者合成时间间隔到了,将视频流和音频流按照统一系统时间戳进行合成,写入结果文件,比如MP4格式的多媒体视频文件,并释放占用的内存。
在该可选实施方式中,录制类型可以分为三种:屏幕录制(即同时录屏和录音),该方法如图6所示;单独录屏,该方法如图7所示;单独录音,该方法如图8所示。下面针对这三种类型分别详细说明。
图6是根据本发明实施例可选实施方式二的录屏和录音方法的流程图,如图6所示,包括如下步骤:
步骤S602,进行参数设置,包括虚拟屏幕参数,包括视频帧率,比如30帧/秒、屏幕分辨率等,设置音频格式参数,比如MP3,合成时间间隔等参数,比如30秒。
步骤S604,收到屏幕录制开始命令后,首先利用Android的多屏显示技术,根据设置的参数,创建虚拟屏幕。
步骤S606,获取虚拟屏幕视频流,写入内存,进行视频编解码和压缩处理,并增加系统时间戳,形成比如H.264格式的视频流。获取音频流,写入内存,进行音频编解码和压缩处理,并增加系统时间戳,形成比如MP3格式的音频流。
步骤S608,判断是否收到结束录制的命令,如果是,则转步骤S620,否则进入步骤S610。
步骤S610,判断是否收到暂停录制的命令,如果是,则进入步骤S612,否则转步骤S616。
步骤S612,停止录制,即停止获取视频流和音频流,停止写入内存。
步骤S614,判断是否收到继续录制的命令,如果是则转步骤S606,否则转步骤S612。
步骤S616,判断同步合成时间间隔是否达到,如果是,则进入步骤S618,否则转步骤S606。
步骤S618,将视频流和音频流根据统一的系统时间戳进行同步合成,并从内存中写入结果文件,比如MP4格式的多媒体视频文件,然后释放占用的内存。
步骤S620,将视频流和音频流根据统一的系统时间戳进行同步合成,并从内存中写入结果文件,比如MP4格式的多媒体视频文件,然后释放占用的内存,并结束录制,流程结束。
图7是根据本发明实施例可选实施方式二的单独录屏方法的流程图,如图7所示,包括如下步骤:
步骤S702,进行参数设置,包括虚拟屏幕参数,包括视频帧率,比如30帧/秒、屏幕分辨率等,设置合成时间间隔等参数,比如30秒。
步骤S704,收到单独录屏开始命令后,首先利用Android的多屏显示技术,根据设置的参数,创建虚拟屏幕。
步骤S706,获取虚拟屏幕视频流,写入内存,进行视频编解码和压缩处理,并增加系统时间戳,形成比如H.264格式的视频流。
步骤S708,判断是否收到结束录屏的命令,如果是,则转步骤S720,否则进入步骤S710。
步骤S710,判断是否收到暂停录屏的命令,如果是,则进入步骤S712,否则转步骤S716。
步骤S712,停止录制,即停止获取视频流,停止写入内存。
步骤S714,判断是否收到继续录屏的命令,如果是则转步骤S706,否则转步骤S712。
步骤S716,判断同步合成时间间隔是否达到,如果是,则进入步骤S718,否则转步骤S706。
步骤S718,将视频流从内存中写入结果文件,比如MP4格式的多媒体视频文件,然后释放占用的内存。
步骤S720、将视频流从内存中写入结果文件,比如MP4格式的多媒体视频文件,然后释放占用的内存,并结束录屏,流程结束。
图8是根据本发明实施例可选实施方式二的单独录音方法的流程图,如图8所示,包括如下步骤:
步骤S802,进行参数设置,设置音频格式参数,比如MP3,设置合成时间间隔等参数,比如30秒。
步骤S804,收到单独录音开始命令后,获取音频流,写入内存,进行音频编解码和压缩处理,并增加系统时间戳,形成比如MP3格式的音频流
步骤S806,判断是否收到结束录音的命令,如果是,则转步骤S818,否则进入步骤S808。
步骤S808,判断是否收到暂停录音的命令,如果是,则进入步骤S810,否则转步骤S814。
步骤S810,停止录制,即停止获取音频流,停止写入内存。
步骤S812,判断是否收到继续录音的命令,如果是则转步骤S806,否则转步骤S810。
步骤S814,判断同步合成时间间隔是否达到,如果是,则进入步骤S816,否则转步骤S804。
步骤S816,将音频流从内存中写入结果文件,比如MP3格式的音频文件,然后释放占用的内存。
步骤S818,将音频流从内存中写入结果文件,比如MP3格式的音频文件,然后释放占用的内存,并结束录音,流程结束。
可选实施方式三
图9是根据本发明实施例可选实施方式三的屏幕录制系统的结构示意图,如图9所示,屏幕录制系统包括:参数配置模块910,视频采集模块920,音频采集模块930,命令监控模块940,同步合成模块950,以下对本发明系统实施例的各个模块进行详细的说明。
参数配置模块910,该模块负责对录制参数进行配置,包括录制类型,即屏幕录制(同时录屏和录音),还是单独录屏,或单独录音,以及录屏、录音的具体参数,包括视频采集帧率,比如30帧/秒、视频分辨率、视频格式,比如H.264、语音格式,比如MP3、多媒体视频文件格式,比如MP4等。
视频采集模块920,该模块负责利用Android的多屏显示技术,根据设置的参数,创建虚拟屏幕,获取虚拟屏幕的视频流,写入内存,并进行时间戳和视频编解码压缩处理,得到比如H2.64格式的视频流。
音频采集模块930,该模块负责音频流的采集,写入内存,并进行时间戳和音频编解码压缩处理,得到比如MP3格式的音频流。
命令监控模块940,该模块对录屏过程中的命令进行监控,收到命令后,进行相应的分发处理,分发给其他相应的模块进行处理。比如开始录制、暂停、继续、结束录制、合成时间间隔到达等命令的监控,收到这些命令后发给其他相应模块进行处理。
同步合成模块950,该模块负责对内存中视频流和音频流根据统一的系统时间戳进行同步合成,并从内存中写入结果文件,比如MP4格式的多媒体视频文件,然后释放占用的内存。
工业实用性:通过上述描述可知,通过本发明实施例可以录制帧率较高的视频文件,提高了屏幕录制的帧率。
显然,本领域的技术人员应该明白,上述的本发明的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将
它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。
以上仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。
Claims (12)
- 一种屏幕录制的方法,其中,包括:创建虚拟屏幕,其中,所述虚拟屏幕中包含有待屏幕录制的内容;获取所述虚拟屏幕的视频流;以及根据所述视频流生成视频文件。
- 根据权利要求1所述的方法,其中,所述根据所述视频流生成视频文件之前,还包括:获取音频流;根据所述视频流生成视频文件,包括:根据所述视频流和所述音频流以系统时间为基准生成视频文件。
- 根据权利要求2所述的方法,其中,所述根据所述视频流和所述音频流以系统时间为基准生成视频文件,包括:将所述视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳,将所述音频流写入第二内存进行音频编码处理并以所述系统时间为基准添加时间戳;根据视频编码处理后的所述视频流和音频编码处理后的所述音频流以所述系统时间为基准生成视频文件。
- 根据权利要求3所述的方法,其中,将所述视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳,包括:将所述视频流写入第一内存并以系统时间为基准添加时间戳,按照第一预定时间间隔对所述第一内存中写入的所述视频流进行视频编码处理;将所述音频流写入第二内存进行音频编码处理并以所述系统时间为基准添加时间戳,包括:将所述音频流写入第二内存并以系统时间为基准添加时间戳,按照第二预定时间间隔对所述第二内存中写入的所述音频流进行音频编码处理;根据视频编码处理后的所述视频流和音频编码处理后的所述音频流以所述系统时间为基准生成视频文件,包括:按照第三预定时间间隔,以所述系统时 间为基准将视频编码处理后的所述视频流和音频编码处理后的所述音频流写入视频文件,并释放相应的内存空间。
- 根据权利要求3所述的方法,其中,还包括:响应暂停请求,暂停获取所述视频流和所述音频流;判断是否接收到开始请求;当接收到所述开始请求,重新开始获取所述视频流和所述音频流。
- 根据权利要求3所述的方法,其中,所述方法还包括:创建第一线程和第二线程,其中,所述第一线程与所述第二线程为不同的线程;将所述视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳,包括:通过所述第一线程将所述视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳;将所述音频流写入第二内存进行音频编码处理并以所述系统时间为基准添加时间戳,包括:通过所述第二线程将所述音频流写入第二内存进行音频编码处理并以所述系统时间为基准添加时间戳。
- 一种屏幕录制的装置,其中,包括:第一创建模块,设置为创建虚拟屏幕,其中,所述虚拟屏幕中包含有待屏幕录制的内容;第一获取模块,设置为获取所述虚拟屏幕的视频流;以及生成模块,设置为根据所述视频流生成视频文件。
- 根据权利要求7所述的装置,其中,所述装置还包括:第二获取模块,设置为获取音频流;所述生成模块,设置为根据所述视频流和所述音频流以系统时间为基准生成视频文件。
- 根据权利要求8所述的装置,其中,所述生成模块,包括:第一处理单元,设置为将所述视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳;第二处理单元,设置为将所述音频流写入第二内存进行音频编码处理并以所述系统时间为基准添加时间戳;生成单元,设置为根据视频编码处理后的所述视频流和音频编码处理后的所述音频流以所述系统时间为基准生成视频文件。
- 根据权利要求9所述的装置,其中,所述第一处理单元,设置为将所述视频流写入第一内存并以系统时间为基准添加时间戳,按照第一预定时间间隔对所述第一内存中写入的所述视频流进行视频编码处理;所述第二处理单元,设置为将所述音频流写入第二内存并以系统时间为基准添加时间戳,按照第二预定时间间隔对所述第二内存中写入的所述音频流进行音频编码处理;所述生成单元,设置为按照第三预定时间间隔,以所述系统时间为基准将视频编码处理后的所述视频流和音频编码处理后的所述音频流写入视频文件,并释放相应的内存空间。
- 根据权利要求9所述的装置,其中,还包括:暂停模块,设置为响应暂停请求,暂停获取所述视频流和所述音频流;判断是否接收到开始请求;当接收到所述开始请求,重新开始获取所述视频流和所述音频流。
- 根据权利要求9所述的装置,其中,所述装置还包括:第二创建模块,设置为创建第一线程和第二线程,其中,所述第一线程与所述第二线程为不同的线程;所述第一处理单元,设置为通过所述第一线程将所述视频流写入第一内存进行视频编码处理并以系统时间为基准添加时间戳;所述第二处理单元,设置为通过所述第二线程将所述音频流写入第二内存进行音频编码处理并以所述系统时间为基准添加时间戳。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410798079.7 | 2014-12-18 | ||
CN201410798079.7A CN105763926A (zh) | 2014-12-18 | 2014-12-18 | 屏幕录制的方法及装置 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2016095369A1 true WO2016095369A1 (zh) | 2016-06-23 |
Family
ID=56125739
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2015/076127 WO2016095369A1 (zh) | 2014-12-18 | 2015-04-09 | 屏幕录制的方法及装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN105763926A (zh) |
WO (1) | WO2016095369A1 (zh) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107426606A (zh) * | 2017-06-26 | 2017-12-01 | 联想(北京)有限公司 | 录制屏幕的方法、装置、电子设备和系统 |
CN108600668A (zh) * | 2018-03-27 | 2018-09-28 | 维沃移动通信有限公司 | 一种录屏帧率调整方法及移动终端 |
CN111355729A (zh) * | 2020-02-27 | 2020-06-30 | 深圳市瑞驰信息技术有限公司 | 一种实时录屏推流与拉流显示引擎框架及数据传输方法 |
CN112804549A (zh) * | 2021-01-15 | 2021-05-14 | 北京字节跳动网络技术有限公司 | 直播数据处理方法及设备 |
CN113709553A (zh) * | 2021-09-30 | 2021-11-26 | 深圳市欢太数字科技有限公司 | 一种屏幕录制方法、装置、芯片和终端 |
CN115484423A (zh) * | 2021-06-16 | 2022-12-16 | 荣耀终端有限公司 | 一种转场特效添加方法及电子设备 |
CN117135299A (zh) * | 2023-04-27 | 2023-11-28 | 荣耀终端有限公司 | 视频录制方法和电子设备 |
Families Citing this family (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP3537278A4 (en) | 2016-11-29 | 2019-11-27 | Huawei Technologies Co., Ltd. | RECORDING AND REPRODUCTION METHOD FOR SCREEN VIDEO AND SCREEN RECORDING DEVICE AND PLAYBACK TRANSMITTER |
CN107277607A (zh) * | 2017-06-09 | 2017-10-20 | 努比亚技术有限公司 | 一种屏幕图像录制方法、终端及计算机可读存储介质 |
CN108200275A (zh) * | 2017-12-27 | 2018-06-22 | 努比亚技术有限公司 | 一种录屏控制方法、设备及计算机可读存储介质 |
CN109600661B (zh) * | 2018-08-01 | 2022-06-28 | 北京微播视界科技有限公司 | 用于录制视频的方法和装置 |
CN109255990A (zh) * | 2018-09-30 | 2019-01-22 | 杭州乔智科技有限公司 | 一种基于ar增强现实的教学系统 |
CN109672837A (zh) * | 2019-01-24 | 2019-04-23 | 深圳慧源创新科技有限公司 | 航拍设备实时视频录制方法、移动终端和计算机存储介质 |
CN112565873A (zh) * | 2020-12-01 | 2021-03-26 | 梦想合力(北京)科技有限公司 | 屏幕录制方法和装置、设备及存储介质 |
CN112672201B (zh) * | 2020-12-18 | 2023-12-12 | 努比亚技术有限公司 | 一种录屏帧率控制方法、设备及计算机可读存储介质 |
CN113473214B (zh) * | 2021-03-25 | 2023-05-02 | 统信软件技术有限公司 | 一种屏幕录制方法、装置、计算设备及可读存储介质 |
CN113810639B (zh) * | 2021-09-28 | 2023-09-29 | 深圳万兴软件有限公司 | 一种录制鼠标信息可再编辑的方法、装置及相关介质 |
CN117177066B (zh) * | 2022-05-30 | 2024-09-20 | 荣耀终端有限公司 | 一种拍摄方法及相关设备 |
CN115086751A (zh) * | 2022-07-15 | 2022-09-20 | 福建合诚信息科技有限公司 | 一种浏览器屏幕录制的自动控制方法 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101609401A (zh) * | 2009-07-02 | 2009-12-23 | 深圳市万兴软件有限公司 | 一种无干扰屏幕录制方法和系统 |
US20140073298A1 (en) * | 2012-09-13 | 2014-03-13 | Klip, Inc. | Method and system for screencasting smartphone video game software to online social networks |
US20140205259A1 (en) * | 2013-01-24 | 2014-07-24 | Kiran Kamity | Screen recording for creating contents in mobile devices |
CN104092920A (zh) * | 2014-07-16 | 2014-10-08 | 浙江航天长峰科技发展有限公司 | 一种音视频同步方法 |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103686312B (zh) * | 2013-12-05 | 2017-02-08 | 中国航空无线电电子研究所 | 一种dvr多路音视频记录方法 |
-
2014
- 2014-12-18 CN CN201410798079.7A patent/CN105763926A/zh active Pending
-
2015
- 2015-04-09 WO PCT/CN2015/076127 patent/WO2016095369A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101609401A (zh) * | 2009-07-02 | 2009-12-23 | 深圳市万兴软件有限公司 | 一种无干扰屏幕录制方法和系统 |
US20140073298A1 (en) * | 2012-09-13 | 2014-03-13 | Klip, Inc. | Method and system for screencasting smartphone video game software to online social networks |
US20140205259A1 (en) * | 2013-01-24 | 2014-07-24 | Kiran Kamity | Screen recording for creating contents in mobile devices |
CN104092920A (zh) * | 2014-07-16 | 2014-10-08 | 浙江航天长峰科技发展有限公司 | 一种音视频同步方法 |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107426606A (zh) * | 2017-06-26 | 2017-12-01 | 联想(北京)有限公司 | 录制屏幕的方法、装置、电子设备和系统 |
CN108600668A (zh) * | 2018-03-27 | 2018-09-28 | 维沃移动通信有限公司 | 一种录屏帧率调整方法及移动终端 |
CN111355729A (zh) * | 2020-02-27 | 2020-06-30 | 深圳市瑞驰信息技术有限公司 | 一种实时录屏推流与拉流显示引擎框架及数据传输方法 |
CN112804549A (zh) * | 2021-01-15 | 2021-05-14 | 北京字节跳动网络技术有限公司 | 直播数据处理方法及设备 |
CN115484423A (zh) * | 2021-06-16 | 2022-12-16 | 荣耀终端有限公司 | 一种转场特效添加方法及电子设备 |
CN113709553A (zh) * | 2021-09-30 | 2021-11-26 | 深圳市欢太数字科技有限公司 | 一种屏幕录制方法、装置、芯片和终端 |
CN113709553B (zh) * | 2021-09-30 | 2024-08-09 | 深圳市与飞科技有限公司 | 一种屏幕录制方法、装置、芯片和终端 |
CN117135299A (zh) * | 2023-04-27 | 2023-11-28 | 荣耀终端有限公司 | 视频录制方法和电子设备 |
Also Published As
Publication number | Publication date |
---|---|
CN105763926A (zh) | 2016-07-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2016095369A1 (zh) | 屏幕录制的方法及装置 | |
WO2019205870A1 (zh) | 视频流处理方法、装置、计算机设备及存储介质 | |
WO2019205886A1 (zh) | 字幕数据推送方法、字幕展示方法、装置、设备及介质 | |
WO2019205872A1 (zh) | 视频流处理方法、装置、计算机设备及存储介质 | |
US10930318B2 (en) | Gapless video looping | |
US9473677B2 (en) | Method and server system for synchronization of audio/video media files | |
US20150062353A1 (en) | Audio video playback synchronization for encoded media | |
WO2016138844A1 (zh) | 音视频文件直播方法和系统、服务器 | |
US9003061B2 (en) | Methods and apparatus for an embedded appliance | |
US11812103B2 (en) | Dynamic playout of transition frames while transitioning between playout of media streams | |
CA3210903A1 (en) | Embedded appliance for multimedia capture | |
JP2016536945A (ja) | 動画提供方法および動画提供システム | |
WO2016002496A1 (ja) | 情報処理装置および方法 | |
CN112584087B (zh) | 视频会议录制方法、电子装置和存储介质 | |
WO2020215454A1 (zh) | 一种屏幕录制的方法、客户端和终端设备 | |
US11076197B1 (en) | Synchronization of multiple video-on-demand streams and methods of broadcasting and displaying multiple concurrent live streams | |
US10902884B2 (en) | Methods and apparatus for ordered serial synchronization of multimedia streams upon sensor changes | |
US20220165306A1 (en) | Playback device | |
CN102522096A (zh) | 多路音视频同步回放系统及其方法 | |
CN109862385B (zh) | 直播的方法、装置、计算机可读存储介质及终端设备 | |
CN115767158A (zh) | 同步播放方法、终端设备及存储介质 | |
CN104853245A (zh) | 一种电影预览方法和装置 | |
CN114257844B (zh) | 一种多视频同步播放方法、装置、设备及可读存储介质 | |
JP2012084972A (ja) | Mxf処理装置 | |
KR20210004877A (ko) | 미디어 데이터 프로세싱 방법 및 장치 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 15868886 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 15868886 Country of ref document: EP Kind code of ref document: A1 |