CN116095358A - Video generation method, device, electronic equipment and medium - Google Patents

Video generation method, device, electronic equipment and medium Download PDF

Info

Publication number
CN116095358A
CN116095358A CN202310076842.4A CN202310076842A CN116095358A CN 116095358 A CN116095358 A CN 116095358A CN 202310076842 A CN202310076842 A CN 202310076842A CN 116095358 A CN116095358 A CN 116095358A
Authority
CN
China
Prior art keywords
video
video data
coding
time
electronic device
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
CN202310076842.4A
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.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication 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 Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202310076842.4A priority Critical patent/CN116095358A/en
Publication of CN116095358A publication Critical patent/CN116095358A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/231Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/23424Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving splicing one content stream with another content stream, e.g. for inserting or substituting an advertisement
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • H04N21/234309Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements by transcoding between formats or standards, e.g. from MPEG-2 to MPEG-4 or from Quicktime to Realvideo
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4334Recording operations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/44016Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving splicing one content stream with another content stream, e.g. for substituting a video clip
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • H04N21/440218Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display by transcoding between formats or standards, e.g. from MPEG-2 to MPEG-4

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • Marketing (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

The application discloses a video generation method, a video generation device, electronic equipment and a video generation medium, and belongs to the technical field of videos. The video generation method comprises the following steps: receiving a first input of a user in the process of recording video; responding to a first input, acquiring N pieces of first video data, and carrying out video coding on the N pieces of first video data according to a first coding direction to obtain a first video segment, wherein N is a positive integer; generating a target video from the first video segment and a second video segment, the second video segment comprising: video clips obtained by video coding the M second video data according to the second coding direction; wherein the first encoding direction and the second encoding direction are different, and M is a positive integer.

Description

Video generation method, device, electronic equipment and medium
Technical Field
The application belongs to the technical field of videos, and particularly relates to a video generation method, a device, electronic equipment and a medium.
Background
In general, when a user wants to obtain a video with a special playing effect, a special effect can be added to a certain video segment in an original video by using a video special effect application, specifically, the user needs to find the position of the video segment in the video special effect application, then intercept the segment, perform special effect processing on the intercepted video segment, and finally insert the intercepted video segment into the original video, so that the electronic device can generate a video containing the video segment with the special playing effect.
However, generating a video containing a video clip with a trick-play effect requires cumbersome operations in a video special effect application, and the overall process is complex and time consuming.
Therefore, the process of causing the user to generate the special effect video satisfying the demand using the electronic device is cumbersome and time-consuming.
Disclosure of Invention
The embodiment of the application aims to provide a video generation method, a video generation device, electronic equipment and a video generation medium, which can solve the problems that a process of generating special effect videos meeting requirements by using the electronic equipment by a user is tedious and time-consuming.
In a first aspect, an embodiment of the present application provides a video generating method, including: receiving a first input of a user in the process of recording video; responding to a first input, acquiring N pieces of first video data, and carrying out video coding on the N pieces of first video data according to a first coding direction to obtain a first video segment, wherein N is a positive integer; generating a target video from the first video segment and a second video segment, the second video segment comprising: video clips obtained by video coding the M second video data according to the second coding direction; wherein the first encoding direction and the second encoding direction are different, and M is a positive integer.
In a second aspect, an embodiment of the present application provides a video generating apparatus, including: the device comprises a receiving module, an obtaining module, a coding module and a generating module. The receiving module is used for receiving a first input of a user in the video recording process. And the acquisition module is used for responding to the first input received by the receiving module and acquiring N pieces of first video data. The coding module is used for video coding the N first video data acquired by the acquisition module according to the first coding direction to obtain a first video segment, wherein N is a positive integer. The generating module is used for generating a target video according to the first video segment and the second video segment obtained by encoding by the encoding module, and the second video segment comprises: and video clips obtained by video coding the M second video data according to the second coding direction. Wherein the first encoding direction and the second encoding direction are different, and M is a positive integer.
In a third aspect, embodiments of the present application provide an electronic device comprising a processor and a memory storing a program or instructions executable on the processor, which when executed by the processor, implement the steps of the method as described in the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium having stored thereon a program or instructions which when executed by a processor implement the steps of the method according to the first aspect.
In a fifth aspect, embodiments of the present application provide a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and where the processor is configured to execute a program or instructions to implement a method according to the first aspect.
In a sixth aspect, embodiments of the present application provide a computer program product stored in a storage medium, the program product being executable by at least one processor to implement the method according to the first aspect.
In the embodiment of the application, the electronic device may acquire N first video data according to a first input of a user during a video recording process, and perform video encoding on the acquired N first video data according to a first encoding direction to obtain a first video segment, where N is a positive integer; and then generating a target video according to the first video segment and the second video segment (the second video segment comprises video segments obtained by video coding M pieces of second video data according to the second coding direction). Wherein the first encoding direction and the second encoding direction are different, and M is a positive integer. The electronic equipment can acquire N first video data according to the first input of a user in the video recording process, video coding is carried out on the N first video data according to the first coding direction to obtain a first video segment, video coding is carried out on M second video data according to the second coding direction to obtain a second video segment, and finally, a target video is generated according to the first video segment and the second video segment.
Drawings
Fig. 1 is one of flow diagrams of a video generating method according to an embodiment of the present application;
fig. 2 is a schematic diagram of a display interface of an electronic device according to an embodiment of the present application;
FIG. 3 is a second flowchart of a video generating method according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a reverse order encoding process provided by an embodiment of the present application;
FIG. 5 is a third flow chart of a video generating method according to an embodiment of the present disclosure;
FIG. 6 is a flowchart of a video generating method according to an embodiment of the present disclosure;
FIG. 7 is a fifth flow chart of a video generating method according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a video generating apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 10 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
Technical solutions in the embodiments of the present application will be clearly described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application are within the scope of the protection of the present application.
The terms first, second and the like in the description and in the claims, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged, as appropriate, such that embodiments of the present application may be implemented in sequences other than those illustrated or described herein, and that the objects identified by "first," "second," etc. are generally of a type and not limited to the number of objects, e.g., the first object may be one or more. Furthermore, in the description and claims, "and/or" means at least one of the connected objects, and the character "/", generally means that the associated object is an "or" relationship.
The video generating method, the device, the electronic equipment and the medium provided by the embodiment of the application are described in detail below through specific embodiments and application scenes thereof with reference to the accompanying drawings.
The video generation method provided by the embodiment of the application can be applied to the generation of the scenes of the video which can be played in the reverse order by using the electronic equipment.
For a scene of a video which can be played in a reverse order by using the electronic equipment, the user is assumed to use the electronic equipment to shoot a section of video which is out of the sea, the sun in the video slowly rises from the sea level and slowly illuminates the whole sky, however, in some special scenes, the user needs to play the video in a reverse order to enhance the interestingness of video playing, for example, when a cloud is encountered in the process of rising the sun, the user wants to change the sun in the video from bottom to top to bottom to fall so as to enhance the interestingness of video playing. Under the real condition, a user can only wait for the completion of the whole video shooting, firstly find out the video clip which is wanted to be played in the reverse order by utilizing the video special effect application, then intercept the clip, process the intercepted video clip in the reverse order, and finally insert the intercepted video clip into the original video. However, the entire process of generating the reverse order video requires the user to apply by a third party, and is complicated to operate and inefficient.
In the embodiment of the application, when the user shoots a section of marine sunrise video by using the electronic equipment, a cloud is encountered when the sun in the video slowly rises from the sea level, if the user wants to change the sun in the video from bottom to top to fall from top to bottom so as to enhance the interestingness of video playing, the user can perform inverted marking on a video fragment shot later by only clicking an inverted switch on a target control in the electronic equipment, after clicking a positive sequence switch on the target control, the user can perform positive sequence marking on a video fragment shot later, the user can select the video fragment needing inverted processing at any time in the shooting process, and finally, after the video shooting is completed, the electronic equipment performs inverted processing on all the video fragments marked in the inverted sequence and performs splicing processing on the video fragment marked in the positive sequence, so that videos including the positive sequence playing and the inverted sequence playing are directly generated, and the user does not need to use a third application to perform complex post processing on the shot video, thereby simplifying the method of generating the inverted sequence video meeting the requirements by using the electronic equipment, and improving the generation efficiency of the inverted sequence video.
The execution subject of the video generation method provided in the embodiment of the present application may be a video generation apparatus. The video generating device may be an electronic device, or a functional module in the electronic device. The technical solution provided in the embodiments of the present application will be described below by taking an electronic device as an example.
Fig. 1 shows a flowchart of a video generating method according to an embodiment of the present application. As shown in fig. 1, a video generating method provided in an embodiment of the present application may include the following steps 101 to 103.
Step 101, the electronic device receives a first input of a user in a video recording process.
Optionally, in the embodiment of the present application, when a user wants to record a certain scene using the electronic device, the electronic device may be triggered to start an application with a video recording function, and after a first identifier in an interface of the application is selected and input (for example, a click input), the user may aim at the scene to be photographed, and then a second identifier in the interface of the application may be selected and input (for example, a click input), so that the electronic device may start recording a video of the scene.
The first identifier is used for selecting whether the electronic equipment is triggered to enter a positive sequence recording mode or a reverse sequence recording mode; the second identifier is used for selectively triggering the electronic equipment to start recording video.
It should be noted that, the "positive sequence recording mode" can be understood as follows: when the video recorded in the positive sequence recording mode is played after the recording is finished, the pictures in the video are played in positive sequence according to the time sequence; the above "reverse recording mode" can be understood as: when the video recorded in the reverse recording mode is played after the recording is finished, the pictures in the video are played in reverse according to the time sequence.
Optionally, in an embodiment of the present application, the first identifier may be an icon of a combined mutual exclusion switch, where the combined mutual exclusion switch includes a positive sequence switch and a reverse sequence switch. When the user selects the reverse switch, the positive switch is automatically grey and closed, and the reverse switch is highlighted and opened; when the user selects the positive sequence switch, the negative sequence switch is automatically turned on and turned off, and the positive sequence switch is highlighted and turned on.
Optionally, in the embodiment of the present application, the second identifier may be an icon of a shutter switch, and when a user selects to open the shutter switch, the shutter switch is highlighted, and the electronic device starts recording video; when the user selects to close the shutter switch, the shutter switch is grayed out and the electronic device stops recording video.
Optionally, in the embodiment of the present application, the first input is used to switch a video recording mode of the electronic device, which may be used to switch the electronic device from a positive sequence recording mode to a reverse sequence recording mode, and may also be used to switch the electronic device from the reverse sequence recording mode to the positive sequence recording mode.
Optionally, in an embodiment of the present application, the first input includes, but is not limited to: the touch input of the first identifier by the user through the touch device such as a finger or a stylus, or a specific gesture input by the user, or other feasibility inputs, may be specifically determined according to actual use requirements, and the embodiment of the invention is not limited. The specific gesture in the embodiment of the application may be any one of a single-click gesture, a sliding gesture, a dragging gesture, a pressure recognition gesture, a long-press gesture, an area change gesture, a double-press gesture and a double-click gesture; the click input in the embodiment of the application may be single click input, double click input, or any number of click inputs, and may also be long press input or short press input.
For example, the first input may specifically be: in the process of recording video, a user inputs clicking on a positive sequence switch in the combined mutual exclusion switch.
For example, the first input may specifically be: in the process of recording video, a user inputs clicking on a reverse switch in the combined mutual exclusion switch.
In one example, as shown in fig. 2, after a user triggers an electronic device to start an application with a video recording function, after clicking a positive sequence switch 2 in a combined mutual exclusion switch 1 in an interface of the application, a scene to be photographed is aligned, and then clicking a shutter switch 3 in the application interface to trigger the electronic device to start recording a video of the scene in a positive sequence recording mode. In the video recording process, after clicking the reverse sequence switch 4 (namely, the first input) in the combined mutual exclusion switch 1, the positive sequence switch 2 is automatically turned on and turned off, and the reverse sequence switch 4 is turned on, so that the electronic equipment is triggered to be switched from the current positive sequence recording mode to the reverse sequence recording mode.
In another example, after triggering the electronic device to start an application with a video recording function, clicking a reverse-order switch in a combined mutual exclusion switch in an interface of the application, aligning a scene to be photographed, and clicking a shutter switch in the interface of the application to trigger the electronic device to start recording a video of the scene in a reverse-order recording mode. In the video recording process, after clicking a positive sequence switch (namely a first input) in the combined mutual exclusion switch, the negative sequence switch is automatically grey-set and closed, and the positive sequence switch is highlighted and opened, so that the electronic equipment is triggered to be switched from a current negative sequence recording mode to a positive sequence recording mode.
In yet another example, after triggering the electronic device to start an application with a video recording function, a user aims at a scene to be photographed, and then clicks a shutter switch in an interface of the application to trigger the electronic device to start recording a video of the scene in a reverse recording mode by default. In the video recording process, after clicking a positive sequence switch (namely a first input) in the combined mutual exclusion switch, the negative sequence switch is automatically grey-set and closed, and the positive sequence switch is highlighted and opened, so that the electronic equipment is triggered to be switched from a current negative sequence recording mode to a positive sequence recording mode.
Step 102, the electronic device responds to the first input to obtain N pieces of first video data, and video codes the N pieces of first video data according to a first coding direction to obtain a first video clip.
In this embodiment, N is a positive integer.
Optionally, in this embodiment of the present application, the N first video data may be N image data corresponding to N image frames in a video recorded by an electronic device in a reverse recording mode, or may be N image data corresponding to N image frames in a video recorded by an electronic device in a forward recording mode.
It can be understood that, during the video recording process, if the electronic device is in the positive sequence recording mode before the user performs the selection input on the first identifier (i.e., before the user switches the recording mode of the electronic device), after the user performs the selection input on the first identifier (i.e., switches the electronic device from the current positive sequence recording mode to the reverse sequence recording mode), the N pieces of first video data are N pieces of image data corresponding to N image frames in the video recorded by the electronic device in the reverse sequence recording mode; if the electronic device is in the reverse recording mode before the user inputs the first identifier (i.e., before the user switches the recording mode of the electronic device), and if the user inputs the first identifier (i.e., switches the electronic device from the current reverse recording mode to the positive recording mode), the N first video data are N image data corresponding to N image frames in the video recorded by the electronic device in the positive recording mode.
Optionally, in the embodiment of the present application, the first encoding direction is an encoding direction when encoding N pieces of first video data, and when the N pieces of first video data are N pieces of image data corresponding to N image frames in a video recorded by an electronic device in a reverse recording mode, the first encoding direction is reverse encoding; when the N pieces of first video data are N pieces of image data corresponding to N image frames in video recorded by the electronic equipment in the positive sequence recording mode, the first coding direction is positive sequence coding.
It should be noted that, when the camera module of the electronic device records a video of a certain scene, original data of the video can be generated, and after the electronic device receives the original data of the recorded video, the original data of the recorded video needs to be data-encoded and then can be stored as a corresponding video format, and the video file is stored. That is, the video recording process is also a process of encoding these raw data in real time. In general, the video encoding formats currently in mainstream include h.264, h.265, MPEG-4, MPEG-2, WMA-HD, and VC-1, and in the video recording process, when encoding the original data of the recorded video, a video image of a period of time is generally regarded as being spliced by P image frames. Assuming that the frame rate at the time of video capturing is 30 frames per second (Frames Per Second, FPS), the image data received by the electronic device in one second is the image data of 30 image frames. If the 30 image frames are obtained in the positive sequence recording mode, the encoding direction when video encoding is performed on the image data of the 30 image frames is: frame 1, frame 2, frame 3, … … up to frame 30; if the 30 image frames are image frames obtained in the reverse recording mode, the encoding direction when video encoding is performed on the image data of the 30 image frames is: frame 30, frame 29, frame 28, frame … …, up to frame 1.
Optionally, in the embodiment of the present application, the manner in which the electronic device encodes the N pieces of first video data may be any one of the following: transform coding, motion estimation and motion compensation coding, entropy coding, etc.
Optionally, in the embodiment of the present application, when the N first video data are N image data corresponding to N image frames in a video recorded by the electronic device in the reverse recording mode, after the electronic device encodes the N first video data according to the first encoding direction, the obtained image of the first video segment when being played is played in reverse.
Optionally, in the embodiment of the present application, when the N first video data are N image data corresponding to N image frames in a video recorded by the electronic device in a positive sequence recording mode, the electronic device encodes the N first video data according to a first encoding direction, and then the obtained image of the first video segment when being played is played in positive sequence.
Step 103, the electronic device generates a target video according to the first video segment and the second video segment.
In this embodiment of the present application, the second video clip includes: and video clips obtained by video coding the M second video data according to the second coding direction.
In this embodiment of the present application, the first encoding direction and the second encoding direction are different, and M is a positive integer.
Optionally, in an embodiment of the present application, the M pieces of second video data are: in the process of recording video, video data whose acquisition time is before the N pieces of first video data is acquired. Optionally, in a possible implementation manner of the embodiment of the present application, when the user inputs the first identifier, i.e. after the recording mode of the electronic device is switched from the positive sequence recording mode (or the reverse sequence recording mode) to the reverse sequence recording mode (or the positive sequence recording mode), the electronic device ends the recording of the previous video segment (i.e. the second video segment) and stores the second video segment. Wherein the second video clip includes M second video data. Further optionally, in the embodiment of the present application, the electronic device encodes N first video data in a first video segment according to a first encoding direction, encodes M second video data in a second video segment according to a second encoding direction, and then performs a splicing process on the encoded first video segment and second video segment to generate the target video.
Optionally, in another possible implementation manner of the embodiment of the present application, during recording a video, a user may perform a slide-up input on a video recording interface, so that an electronic device may display a "file management" window on the video recording interface, then the user may input a target file in the "file management" window, so that a second video segment in the target file may be added to a video splicing list, then the user uses the electronic device to record a video segment in a positive sequence recording mode (or a reverse sequence recording mode), obtain a first video segment, encode N first video data in the first video segment according to a first encoding direction, and then splice the N first video data with the second video segment, so as to generate the target video.
It will be appreciated that the generated target video includes both video segments that can be played in a positive order and video segments that can be played in a reverse order. In order for the electronic device to better identify which video data needs to be forward encoded and which video data needs to be reverse encoded, a tag may be added to the N first video data before video encoding the N first video data, as described in detail below.
Optionally, in the embodiment of the present application, as shown in fig. 3 in conjunction with fig. 1, before "video encoding N pieces of first video data according to the first encoding direction to obtain the first video segment" in step 102, the video generating method provided in the embodiment of the present application may further include the following step 201.
Step 201, the electronic device adds a first mark to N pieces of first video data.
In this embodiment of the present application, the first marks are used to indicate that the encoding directions corresponding to the N first video data are the first encoding directions.
Optionally, in this embodiment of the present application, before the user performs selection input on the first identifier (i.e., before the user switches the recording mode of the electronic device), the electronic device is in the positive sequence recording mode (or the reverse sequence recording mode), after the user performs selection input on the first identifier, that is, after the electronic device switches from the current positive sequence recording mode (or the reverse sequence recording mode) to the reverse sequence recording mode (or the positive sequence recording mode), the electronic device ends recording a current second video segment and stores the second video segment, then newly builds a first file, and adds a first mark to the first file. The first file is a video file storing N first video data, and the first mark is used for marking that the encoding direction of the video data in the video file is a reverse encoding direction (or a positive encoding direction).
Optionally, in an embodiment of the present application, the first flag may be instruction information, where the instruction information is used to instruct the electronic device to encode the video data in the video file indicated by the first flag according to the first encoding direction.
It should be noted that, after the electronic device is switched from the current positive-sequence recording mode to the reverse-sequence recording mode, the user does not affect the positive-sequence recording process, i.e. the recording picture after the recording mode is switched can still be normal positive-sequence recording, but only writes an instruction information into the new video file.
Optionally, in the embodiment of the present application, if the N first video data are video data obtained after the electronic device switches to the reverse recording mode, in a video recording process in the reverse recording mode, the electronic device may perform reverse encoding on the N first video data written in the first file, and after the video recording is completed, when the reverse encoding is completed, the first video in the derived first file is played by an arbitrary player, and the video images are all played in reverse.
Specifically, the electronic device may receive the N first video data first, store the N first video data as the initial video data, write the N-1 th first video data into the N first video data, write the N-2 nd first video data into the N-1 st first video data, and push the N first video data until the 1 st first video data is written into the 2 nd first video data, and then encode the N first video data after the N first video data are arranged in reverse order, to obtain N first video data encoded in reverse order.
The above-described process will be described in detail with reference to specific examples. Taking the example that the first file includes 5 (n=5) first video data, as shown in fig. 4, the first row of video data is 5 first video data input, assuming that the 1 st first video data indicates an image of letter a, the 2 nd first video data indicates an image of letter A, B, the 3 rd first video data indicates an image of letter A, B, C, the 4 th first video data indicates an image of letter A, B, C, D, and the 5 th first video data indicates an image of letter A, B, C, D, E. The second row of reverse-order encoded data represents the corresponding reverse-order encoded data of each video data, namely, the 5 th first video data (i.e. the last video data) is saved first and is used as the initial video data, the 4 th first video data is written into the 5 th first video data, the 3 rd first video data is written into the 4 th first video data, and the same is performed until the 1 st first video data is written into the 2 nd first video data, then the 5 first video data after the reverse-order arrangement are encoded, and the obtained 5 first video data after the reverse-order encoding are obtained, namely, the encoded data of the first video segment is obtained. When the video playing device decodes and plays the encoded datase:Sub>A, the animation effect displayed by the video playing device is that five letters of ABCDE-ABCD-ABC-AB-A are reduced to display pictures one by one.
Optionally, in the embodiment of the present application, before the user performs selection input on the first identifier (i.e., before the user switches the recording mode of the electronic device), the electronic device is in the reverse recording mode, and after the user performs selection input on the first identifier (i.e., switches the electronic device from the current reverse recording mode to the positive recording mode), the electronic device ends recording the second video segment, newly builds a first file, and adds a first flag to the first file. The first file is a video file for storing N first video data, and the first mark is used for marking that the corresponding encoding direction is a positive sequence encoding direction.
It should be noted that, the process of the electronic device for positive sequence encoding of video data may refer to the existing encoding technology, which is not described herein.
Therefore, before the electronic device performs video coding on the N first video data, a first mark can be added to the N first video data to mark the coding direction corresponding to the N first video data as the first coding direction, so that the electronic device can better identify the coding direction of the video data, and the accuracy of the electronic device in coding the video data is improved.
Optionally, in the embodiment of the present application, as shown in fig. 5 in conjunction with fig. 1, before step 102, the video generating method provided in the embodiment of the present application may further include the following step 301.
Step 301, the electronic device adds a second mark to the M second video data.
In this embodiment of the present application, the second marks are used to identify that the encoding directions corresponding to the M second video data are the second encoding directions.
Optionally, in the embodiment of the present application, after the video recording starts and if the user selects and inputs the first identifier, the electronic device is in a positive sequence recording mode (or a reverse sequence recording mode), the electronic device creates a second file, then adds a second mark to the second file, and M second video data in the video recording process are stored in the second file. The second file is a video file for storing M second video data, and the second mark is used for indicating that the encoding direction of the video data in the video file is a positive sequence encoding direction (or a reverse sequence encoding direction).
Therefore, the electronic device can acquire the M second video data before acquiring the N first video data, and add the second mark to the M second video data to indicate that the encoding direction corresponding to the M second video data is the second encoding direction, so that the electronic device can better identify the encoding direction of the video data, and the accuracy of the electronic device for encoding the video data is improved.
According to the video generation method provided by the embodiment of the application, in the process of recording video, the electronic equipment can acquire N pieces of first video data according to the first input of a user, and video coding is carried out on the acquired N pieces of first video data according to the first coding direction to obtain a first video segment, wherein N is a positive integer; and then generating a target video according to the first video segment and the second video segment (the second video segment comprises video segments obtained by video coding M pieces of second video data according to the second coding direction). Wherein the first encoding direction and the second encoding direction are different, and M is a positive integer. The electronic equipment can acquire N first video data according to the first input of a user in the video recording process, video coding is carried out on the N first video data according to the first coding direction to obtain a first video segment, video coding is carried out on M second video data according to the second coding direction to obtain a second video segment, and finally, a target video is generated according to the first video segment and the second video segment.
The process of the electronic device acquiring N pieces of first video data is specifically described below.
Alternatively, in the embodiment of the present application, as shown in fig. 6 in conjunction with fig. 1, the "acquiring N pieces of first video data" in the above step 102 may be specifically implemented by the following step 102 a.
Step 102a, the electronic device determines the video data collected in the first period as N first video data.
In this embodiment of the present application, the starting time of the first period is: the input time of the first input; the ending time of the first time period is as follows: a time after a first preset time period from a start time of the first time period.
Optionally, in this embodiment of the present application, the first preset duration may be a duration preset by a user in a target template, where the target template may be a time template that is selected and invoked by the user in an electronic device and capable of switching a video recording mode at regular time before video recording.
Further optionally, in an embodiment of the present application, the target template includes X first instructions and Y second instructions, where the first instructions are used to instruct the electronic device to keep in a positive sequence recording mode or a reverse sequence recording mode within a preset duration, and X is a positive integer; the second instruction is used for indicating the electronic equipment to be kept in a reverse order recording mode or a positive order recording mode within a preset time period, and Y is a positive integer. Wherein X and Y may be the same or different; the video recording mode after the electronic equipment executes the first instruction is opposite to the video recording mode after the electronic equipment executes the second instruction.
It should be noted that, the above "video recording mode" can be understood as: the video recording mode of the electronic equipment is a positive sequence recording mode or a reverse sequence recording mode.
It can be understood that if the video recording mode after the electronic device executes the first instruction is the positive sequence recording mode, the video recording mode after the electronic device executes the second instruction is the reverse sequence recording mode; if the video recording mode after the electronic equipment executes the first instruction is the reverse order recording mode, the video recording mode after the electronic equipment executes the second instruction is the positive order recording mode.
In one example, the time template may be: positive sequence 10S + reverse sequence 10S, i.e. the time template comprises 1 first instruction and 1 second instruction. The first instruction indicates that the electronic device is kept in a positive sequence recording mode in a first 10S of video starting recording, and the second switching instruction indicates that the electronic device is kept in a reverse sequence recording mode in a second 10S of video starting recording.
In another example, the time template may be: the reverse order 5S + positive order 10S + reverse order 10S, i.e. the time template comprises 2 first instructions and 1 second instruction. The 1 st first instruction indicates that the electronic device is kept in a reverse order recording mode in 5S of video beginning recording, the 1 st second instruction indicates that the electronic device is kept in a positive order recording mode in 6S to 15S of video beginning recording, and the 2 nd first instruction indicates that the electronic device is kept in a reverse order recording mode in 16S to 25S of video beginning recording.
Optionally, in an embodiment of the present application, the input time of the first input may be a time when the electronic device receives the second instruction.
It can be appreciated that when the second instruction instructs the electronic device to switch from the reverse recording mode to the positive recording mode, the starting time of the first period is: the starting time of the electronic equipment in the positive sequence recording mode and the ending time of the first time period are as follows: the time of the electronic equipment in the positive sequence recording mode meets the time after the preset duration corresponding to the second instruction; when the second instruction indicates that the electronic equipment is switched from the positive sequence recording mode to the reverse sequence recording mode, the starting moment of the first time period is as follows: the starting time of the electronic equipment in the reverse recording mode and the ending time of the first time period are as follows: and the time when the electronic equipment is in the reverse recording mode is higher than the time after the preset time corresponding to the second instruction.
In one example, assume that the time template is: the electronic equipment starts to record the video and then is in the reverse recording mode for 10S after receiving a second switching instruction to instruct the electronic equipment to switch from the reverse recording mode to the positive recording mode, and then the starting time of the first time period is as follows: 11S after the electronic equipment starts recording the video, the ending time of the first time period is as follows: the time after 20S when the electronic device starts recording video (i.e., the time when the electronic device is in the positive sequence recording mode exceeds the time after 10S). It will be appreciated that the N pieces of video data collected by the electronic device in 11S to 20S (i.e., the first period), i.e., 10S in the positive sequence recording mode, are determined as N pieces of first video data.
In another example, assume that the time template is: after the electronic equipment starts to record the video and is in the positive sequence recording mode for 5S, the electronic equipment receives a second switching instruction to instruct the electronic equipment to switch from the positive sequence recording mode to the reverse sequence recording mode, and then the starting moment of the first time period is as follows: 6S after the electronic equipment starts recording the video, the ending time of the first time period is as follows: the time after 10S when the electronic device starts recording video (i.e., the time when the electronic device is in the reverse recording mode exceeds the time after 5S). It will be appreciated that the N pieces of video data collected by the electronic device in the 6 th to 10 th (i.e., first period of time), i.e., in 5S in the reverse recording mode, are determined as N pieces of first video data.
It should be noted that, the target template may be a time template pre-stored in the electronic device or a time template customized by a user, and the switching sequence of the positive sequence recording mode and the reverse sequence recording mode in the time template and the preset time in each recording mode may be set arbitrarily, which is not limited herein.
Therefore, after the user sets the input time of the first input and the first preset duration, the electronic device can collect video data in a time period from the input time of the first input to the time within the first preset duration, and determine the collected video data as N pieces of first video data, so that the user can obtain various video contents meeting requirements by using the electronic device.
Of course, users sometimes need to record video including a mix of positive and negative video segments using an electronic device, as will be described in detail below.
Optionally, in an embodiment of the present application, the second video clip further includes: the video generation method provided in the embodiment of the present application may further include the following step 401 after the step 102a, where Q is a positive integer, and referring to fig. 7, in the video segment obtained by video encoding Q third video data according to the second encoding direction.
In step 401, the electronic device determines the video data collected in the second period of time as Q third video data.
In this embodiment of the present application, the starting time of the second period is: the end time of the first time period; the ending time of the second time period is as follows: a time after a second preset time period from the start time of the second time period.
Optionally, in this embodiment of the present application, the starting time of the second period is: and the electronic equipment executes the second instruction and then is in a first preset time period from the positive sequence recording mode (or the reverse sequence recording mode).
It can be appreciated that the starting time of the second time period is: and the electronic equipment receives the first instruction again after executing the second instruction.
Optionally, in this embodiment of the present application, the second preset duration may be a duration preset by a user in the first instruction received by the electronic device again or preset in the target template.
In one example, assume that the time template is: after the electronic device starts to record the video, the electronic device is in the reverse recording mode according to the 1 st first instruction and is kept in the forward recording mode for 10S, and is kept in the reverse recording mode according to the second instruction, then the electronic device receives the 2 nd first instruction again, the electronic device is instructed to switch from the forward recording mode to the reverse recording mode, and the starting moment of the second time period is as follows: the 21 st S (i.e. the time when the 2 nd first instruction is received) when the electronic device starts recording the video, the end time of the second time period is: after 30S after the electronic device starts recording video (i.e., the time when the electronic device is in the reverse recording mode exceeds the time after 10S). It will be appreciated that the Q video data collected by the electronic device in 21S to 30S (i.e., the second period), i.e., 10S in the reverse recording mode, are determined as Q third video data. And after the electronic equipment obtains the Q third video data, video encoding is carried out on the Q third video data in a reverse coding mode to obtain a second video segment.
In another example, assume that the time template is: after the electronic device starts to record the video, the electronic device is in a positive sequence recording mode according to a 1 st first instruction and is kept in a negative sequence recording mode for 5S, and is kept in a negative sequence recording mode according to a second instruction, then the electronic device receives a 2 nd first instruction again, the electronic device is instructed to switch from the negative sequence recording mode to the positive sequence recording mode, and then the starting moment of the second time period is as follows: the 16 th S (i.e. the time when the 2 nd first instruction is received) when the electronic device starts recording the video, and the end time of the second time period is: after 25S after the electronic device starts recording video (i.e., the time when the electronic device is in the positive sequence recording mode exceeds the time after 10S). It will be appreciated that the Q video data collected by the electronic device during the 16 th to 25 th (i.e., second period of time), i.e., 10S in the positive sequence recording mode, are determined as Q third video data. And after the electronic equipment obtains Q pieces of third video data, video encoding is carried out on the Q pieces of third video data in a positive sequence encoding mode to obtain a second video segment.
In the embodiment of the application, after obtaining X video files containing second video data and Y video files containing first video data according to X first instructions and Y second instructions in a target template, the electronic device performs video encoding on all first video data according to a first encoding direction to obtain Y first video segments, performs video encoding on all second video data according to a second encoding direction to obtain X second video segments, and finally performs sorting and splicing processing on the Y first video segments and the X second video segments according to the acquisition time of the video files to obtain a target video.
Therefore, after the electronic device collects the first video data in the first time period, the electronic device can collect the third video data in the second time period after the first time period, and video encoding is performed on the collected third video data according to the second encoding direction to obtain a second video clip, so that a user can use the electronic device to obtain any required first video clip and second video clip.
According to the method provided by the embodiment of the application, the execution subject can be a video generation device. In the embodiment of the present application, a video generating apparatus is described by taking an example in which the video generating apparatus executes a video generating method.
Fig. 8 shows a video generating apparatus 60 according to the above embodiment, the video generating apparatus 60 including: a receiving module 61, an obtaining module 62, an encoding module 63 and a generating module 64. The receiving module 61 is configured to receive a first input from a user during a process of recording video. The acquiring module 62 is configured to acquire N pieces of first video data in response to the first input received by the receiving module. The encoding module 63 is configured to perform video encoding on the N first video data acquired by the acquiring module according to the first encoding direction, so as to obtain a first video segment, where N is a positive integer. The generating module 64 is configured to generate a target video according to the first video segment and the second video segment obtained by encoding by the encoding module, where the second video segment includes: and video clips obtained by video coding the M second video data according to the second coding direction. Wherein the first encoding direction and the second encoding direction are different, and M is a positive integer.
In one possible implementation manner, the M pieces of second video data are: in the process of recording video, video data whose acquisition time is before the N pieces of first video data is acquired.
In one possible implementation manner, the video generating apparatus 60 further includes: and a determining module. The determining module is used for determining the video data collected in the first time period as N pieces of first video data. Wherein, the starting moment of the first time period is: the input time of the first input, the end time of the first time period is: a time after a first preset time period from a start time of the first time period.
In one possible implementation manner, the second video clip further includes: and video encoding the Q third video data according to the second encoding direction to obtain video fragments, wherein Q is a positive integer. The determining module is further configured to determine the video data collected in the second period of time as Q third video data. Wherein, the starting moment of the second time period is: the end time of the first time period is as follows: a time after a second preset time period from the start time of the second time period.
In one possible implementation manner, the video generating apparatus 60 further includes: and adding a module. The adding module is used for adding first marks to the N first video data, wherein the first marks are used for marking the corresponding coding directions of the N first video data as first coding directions.
In one possible implementation manner, the video generating apparatus 60 further includes: and adding a module. The adding module is used for adding second marks to the M second video data, wherein the second marks are used for marking the corresponding coding directions of the M second video data as second coding directions.
According to the video generating device, N first video data can be obtained according to the first input of a user in the video recording process, video encoding is carried out on the N first video data according to the first encoding direction to obtain the first video segments, video encoding is carried out on M second video data according to the second encoding direction to obtain the second video segments, and finally, target videos are generated according to the first video segments and the second video segments.
The video generating apparatus in the embodiment of the present application may be an electronic device, or may be a component in an electronic device, for example, an integrated circuit or a chip. The electronic device may be a terminal, or may be other devices than a terminal. By way of example, the electronic device may be a mobile phone, tablet computer, notebook computer, palm computer, vehicle-mounted electronic device, mobile internet appliance (mobile internet device, MID), augmented reality (augmented reality, AR)/Virtual Reality (VR) device, robot, wearable device, ultra-mobile personal computer, UMPC, netbook or personal digital assistant (personal digital assistant, PDA), etc., but may also be a server, network attached storage (network attached storage, NAS), personal computer (personal computer, PC), television (TV), teller machine or self-service machine, etc., and the embodiments of the present application are not limited in particular.
The video generating apparatus in the embodiment of the present application may be an apparatus having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiments of the present application.
The video generating apparatus provided in the embodiment of the present application can implement each process implemented by the embodiments of the methods of fig. 1 to 7, and in order to avoid repetition, a description is omitted here.
Optionally, in the embodiment of the present application, as shown in fig. 9, the embodiment of the present application further provides an electronic device 80, including a processor 81 and a memory 82, where a program or an instruction capable of being executed on the processor 81 is stored in the memory 82, and the program or the instruction implements each process step of the embodiment of the method when executed by the processor 81, and the process steps can achieve the same technical effect, so that repetition is avoided and redundant description is omitted herein.
The electronic device in the embodiment of the application includes the mobile electronic device and the non-mobile electronic device.
Fig. 10 is a schematic hardware structure of an electronic device implementing an embodiment of the present application.
The electronic device 100 includes, but is not limited to: radio frequency unit 1001, network module 1002, audio output unit 1003, input unit 1004, sensor 1005, display unit 1006, user input unit 1007, interface unit 1008, memory 1009, and processor 110.
Those skilled in the art will appreciate that the electronic device 100 may further include a power source (e.g., a battery) for powering the various components, and that the power source may be logically coupled to the processor 110 via a power management system to perform functions such as managing charging, discharging, and power consumption via the power management system. The electronic device structure shown in fig. 10 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than shown, or may combine certain components, or may be arranged in different components, which are not described in detail herein.
The processor 110 is specifically configured to receive a first input from a user during a process of recording video; responding to a first input, acquiring N pieces of first video data, and carrying out video coding on the N pieces of first video data according to a first coding direction to obtain a first video segment, wherein N is a positive integer; generating a target video from the first video segment and a second video segment, the second video segment comprising: video clips obtained by video coding the M second video data according to the second coding direction; wherein the first encoding direction and the second encoding direction are different, and M is a positive integer.
According to the electronic device provided by the embodiment of the invention, as N pieces of first video data can be acquired according to the first input of a user in the video recording process of the electronic device, the N pieces of first video data are subjected to video coding according to the first coding direction to obtain the first video segments, the M pieces of second video data are subjected to video coding according to the second coding direction to obtain the second video segments, and finally, the target video is generated according to the first video segments and the second video segments, and the video coding directions of the first video segments and the second video segments are opposite, the target video obtained after the shooting is directly the video comprising the video segments with opposite playing effects, and the user does not need to carry out complex post-processing on the shot video by using video special effect application, so that the process of generating special effect video meeting requirements by the user by using the electronic device is simplified, and the time is saved.
Optionally, in the embodiment of the present application, the processor 110 is specifically configured to determine the video data collected in the first period of time to be N first video data; wherein, the starting moment of the first time period is: the input time of the first input; the end time of the first time period is: a time after a first preset time period from a start time of the first time period.
Therefore, after the user sets the input time of the first input and the first preset duration, the electronic device can collect video data in a time period from the input time of the first input to the time within the first preset duration, and determine the collected video data as N pieces of first video data, so that the user can obtain various video contents meeting requirements by using the electronic device.
Optionally, in the embodiment of the present application, the processor 110 is specifically configured to determine the video data collected in the second period of time as Q third video data; wherein, the starting moment of the second time period is: the end time of the first time period; the end time of the second time period is: a time after a second preset time period from the start time of the second time period.
Therefore, after the user sets the input time of the first input and the first preset duration, the electronic device can collect video data in a time period from the input time of the first input to the time within the first preset duration, and determine the collected video data as N pieces of first video data, so that the user can obtain various video contents meeting requirements by using the electronic device.
Optionally, in the embodiment of the present application, the processor 110 is specifically configured to add a first flag to the N first video data, where the first flag is used to indicate that a coding direction corresponding to the N first video data is a first coding direction.
Therefore, before the electronic device performs video coding on the N first video data, a first mark can be added to the N first video data to mark the coding direction corresponding to the N first video data as the first coding direction, so that the electronic device can better identify the coding direction of the video data, and the accuracy of the electronic device in coding the video data is improved.
Optionally, in the embodiment of the present application, the processor 110 is specifically configured to add a second flag to the M second video data, where the second flag is used to indicate that a coding direction corresponding to the M second video data is a second coding direction.
Therefore, the electronic device can acquire the M second video data before acquiring the N first video data, and add the second mark to the M second video data to indicate that the encoding direction corresponding to the M second video data is the second encoding direction, so that the electronic device can better identify the encoding direction of the video data, and the accuracy of the electronic device for encoding the video data is improved.
It should be appreciated that in embodiments of the present application, the input unit 1004 may include a graphics processor (graphics processing unit, GPU) 1041 and a microphone 1042, the graphics processor 1041 processing image data of still pictures or video obtained by an image capturing device (e.g., a camera) in a video capturing mode or an image capturing mode. The display unit 1006 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 1007 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also referred to as a touch screen. The touch panel 1071 may include two parts of a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and so forth, which are not described in detail herein.
The memory 1009 may be used to store software programs as well as various data. The memory 1009 may mainly include a first memory area storing programs or instructions and a second memory area storing data, wherein the first memory area may store an operating system, application programs or instructions (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like. Further, the memory 1009 may include volatile memory or nonvolatile memory, or the memory 1009 may include both volatile and nonvolatile memory. The nonvolatile memory may be a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an electrically Erasable EPROM (EEPROM), or a flash memory. The volatile memory may be random access memory (random access memory, RAM), static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (ddr SDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), and direct memory bus RAM (DRRAM). Memory 1009 in embodiments of the present application includes, but is not limited to, these and any other suitable types of memory.
Processor 110 may include one or more processing units; optionally, the processor 110 integrates an application processor that primarily processes operations involving an operating system, user interface, application programs, etc., and a modem processor that primarily processes wireless communication signals, such as a baseband processor. It will be appreciated that the modem processor described above may not be integrated into the processor 110.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Furthermore, it should be noted that the scope of the methods and apparatus in the embodiments of the present application is not limited to performing the functions in the order shown or discussed, but may also include performing the functions in a substantially simultaneous manner or in an opposite order depending on the functions involved, e.g., the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solutions of the present application may be embodied essentially or in a part contributing to the prior art in the form of a computer software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the methods described in the embodiments of the present application.
The embodiments of the present application have been described above with reference to the accompanying drawings, but the present application is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those of ordinary skill in the art without departing from the spirit of the present application and the scope of the claims, which are also within the protection of the present application.

Claims (10)

1. A method of video generation, the method comprising:
receiving a first input of a user in the process of recording video;
responding to the first input, acquiring N pieces of first video data, and carrying out video coding on the N pieces of first video data according to a first coding direction to obtain a first video segment, wherein N is a positive integer;
generating a target video according to the first video segment and the second video segment, wherein the second video segment comprises: video clips obtained by video coding the M second video data according to the second coding direction;
wherein the first encoding direction and the second encoding direction are different, and M is a positive integer.
2. The method of claim 1, wherein the M second video data are: in the process of recording video, the acquired time is the video data before the N pieces of first video data.
3. The method of claim 1, wherein the acquiring N first video data comprises:
determining the video data collected in the first time period as the N first video data;
wherein, the starting moment of the first time period is: the input time of the first input, the end time of the first time period is: a time after a first preset time period from the start time of the first time period.
4. The method of claim 3, wherein the second video clip further comprises: video segments obtained by video coding the Q third video data according to the second coding direction; q is a positive integer;
after the acquiring the N first video data, the method further includes:
determining the video data collected in the second time period as the Q third video data;
wherein, the starting moment of the second time period is: the end time of the first time period; the ending time of the second time period is as follows: and a time after a second preset time period from the starting time of the second time period.
5. The method of claim 1, wherein prior to video encoding the N first video data in the first encoding direction to obtain a first video segment, the method further comprises:
and adding first marks to the N first video data, wherein the first marks are used for marking the coding directions corresponding to the N first video data as the first coding directions.
6. The method of claim 1, wherein prior to the acquiring the N first video data, the method further comprises:
And adding second marks to the M second video data, wherein the second marks are used for marking the coding directions corresponding to the M second video data as the second coding directions.
7. A video generating apparatus, characterized in that the video generating apparatus comprises: the device comprises a receiving module, an acquisition module, a coding module and a generating module;
the receiving module is used for receiving a first input of a user in the process of recording the video;
the acquisition module is used for responding to the first input received by the receiving module to acquire N pieces of first video data;
the coding module is used for video coding the N first video data acquired by the acquisition module according to a first coding direction to obtain a first video segment, wherein N is a positive integer;
the generating module is configured to generate a target video according to the first video segment and the second video segment obtained by encoding by the encoding module, where the second video segment includes: video clips obtained by video coding the M second video data according to the second coding direction;
wherein the first encoding direction and the second encoding direction are different, and M is a positive integer.
8. The video generating apparatus according to claim 7, characterized in that the video generating apparatus further comprises: a determining module;
The determining module is used for determining the video data collected in the first time period as the N first video data;
wherein, the starting moment of the first time period is: an input time of the first input; the end time of the first time period is as follows: a time after a first preset time period from the start time of the first time period.
9. The video generating apparatus according to claim 7, characterized in that the video generating apparatus further comprises: adding a module;
the adding module is configured to add a first flag to the N first video data, where the first flag is used to indicate that a coding direction corresponding to the N first video data is the first coding direction.
10. An electronic device comprising a processor and a memory storing a program or instructions executable on the processor, which when executed by the processor, implement the steps of the video generation method of any one of claims 1 to 6.
CN202310076842.4A 2023-01-19 2023-01-19 Video generation method, device, electronic equipment and medium Pending CN116095358A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310076842.4A CN116095358A (en) 2023-01-19 2023-01-19 Video generation method, device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310076842.4A CN116095358A (en) 2023-01-19 2023-01-19 Video generation method, device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN116095358A true CN116095358A (en) 2023-05-09

Family

ID=86213709

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310076842.4A Pending CN116095358A (en) 2023-01-19 2023-01-19 Video generation method, device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN116095358A (en)

Similar Documents

Publication Publication Date Title
CN108616696B (en) Video shooting method and device, terminal equipment and storage medium
CN107870999B (en) Multimedia playing method, device, storage medium and electronic equipment
CN112954199B (en) Video recording method and device
CN112714253B (en) Video recording method and device, electronic equipment and readable storage medium
CN112672061B (en) Video shooting method and device, electronic equipment and medium
US20140365893A1 (en) Causing elements to be displayed
CN113794831B (en) Video shooting method, device, electronic equipment and medium
CN113852756B (en) Image acquisition method, device, equipment and storage medium
CN114302009A (en) Video processing method, video processing device, electronic equipment and medium
CN112307252A (en) File processing method and device and electronic equipment
CN115729412A (en) Interface display method and device
CN115756275A (en) Screen capture method, screen capture device, electronic equipment and readable storage medium
CN114025237B (en) Video generation method and device and electronic equipment
CN114125297B (en) Video shooting method, device, electronic equipment and storage medium
CN112261483B (en) Video output method and device
CN112367487B (en) Video recording method and electronic equipment
CN116095358A (en) Video generation method, device, electronic equipment and medium
CN114584704A (en) Shooting method and device and electronic equipment
CN114245017A (en) Shooting method and device and electronic equipment
CN114025100A (en) Shooting method, shooting device, electronic equipment and readable storage medium
CN114222069B (en) Shooting method, shooting device and electronic equipment
CN116389665A (en) Video recording method and device, electronic equipment and readable storage medium
CN116074580A (en) Video processing method and device
CN117395462A (en) Method and device for generating media content, electronic equipment and readable storage medium
CN116847187A (en) Shooting method, shooting device, electronic equipment and storage medium

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