WO2018010662A1 - 视频文件的转码方法,装置及存储介质 - Google Patents
视频文件的转码方法,装置及存储介质 Download PDFInfo
- Publication number
- WO2018010662A1 WO2018010662A1 PCT/CN2017/092615 CN2017092615W WO2018010662A1 WO 2018010662 A1 WO2018010662 A1 WO 2018010662A1 CN 2017092615 W CN2017092615 W CN 2017092615W WO 2018010662 A1 WO2018010662 A1 WO 2018010662A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- target
- video
- source
- stream
- transcoding
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 76
- 230000015654 memory Effects 0.000 claims description 16
- 238000004590 computer program Methods 0.000 claims 2
- 230000008569 process Effects 0.000 abstract description 27
- 230000005540 biological transmission Effects 0.000 description 7
- 238000010586 diagram Methods 0.000 description 5
- 230000000694 effects Effects 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000006872 improvement Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000002457 bidirectional effect Effects 0.000 description 1
- 230000003139 buffering effect Effects 0.000 description 1
- 230000000593 degrading effect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/44—Processing 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/4402—Processing 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/44—Processing 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/4402—Processing 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/440236—Processing 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 media transcoding, e.g. video is transformed into a slideshow of still pictures, audio is converted into text
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/434—Disassembling of a multiplex stream, e.g. demultiplexing audio and video streams, extraction of additional data from a video stream; Remultiplexing of multiplex streams; Extraction or processing of SI; Disassembling of packetised elementary stream
- H04N21/4341—Demultiplexing of audio and video streams
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/44—Processing 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/4402—Processing 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/440263—Processing 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 altering the spatial resolution, e.g. for displaying on a connected PDA
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing 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/44—Processing 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/4408—Processing 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 video stream encryption, e.g. re-encrypting a decrypted video stream for redistribution in a home network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/47—End-user applications
- H04N21/472—End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
- H04N21/47202—End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content for requesting content on demand, e.g. video on demand
Definitions
- the present application relates to the field of multimedia, and in particular to a method, device and storage medium for transcoding video files.
- the embodiment of the present application provides a transcoding method, a device, and a storage medium for a video file, so as to at least solve the technical problem that the video in the related art is not smoothly switched during the playing process.
- a method for transcoding a video file includes: obtaining a source video stream from a source video file to be transcoded; performing pre-transcoding processing on the source video stream to obtain a target Location information, where the target location information is used to indicate a target location of an IDR (instantaneous decoding refresh) frame; the source video stream is transcoded into at least two target video streams according to the target location information, where the at least The position of the IDR frame in each target video stream in the two-way target video stream is aligned with the target position, and the position-aligned IDR frame corresponds to the same video picture.
- IDR instantaneous decoding refresh
- a transcoding device for a video file including: a first acquiring unit, configured to obtain a source video stream from a source video file to be transcoded, and a processing unit, configured to perform pre-transcoding processing on the source video stream to obtain target location information, where the target location information And a first transcoding unit, configured to transcode the source video stream into at least two target video streams according to the target location information, where the at least two target video streams are The position of the IDR frame in each target video stream is aligned with the target position, and the position-aligned IDR frame corresponds to the same video picture.
- a non-volatile storage medium of a video file in which computer readable instructions are stored.
- the computer is caused to perform the video file transcoding method described above.
- the source video stream is obtained from the source video file to be transcoded, and the source video stream is pre-transcoded to obtain target location information, where the target location information is used to indicate the IDR. a target location of the frame; transcoding the source video stream into at least two target video streams according to the target location information, wherein a location and an IDR frame in each of the at least two target video streams
- the method of aligning the target position firstly performs pre-transcoding processing on the acquired source video stream, determines the target position of the IDR frame according to the target position information after the processing, and then, based on the acquired target position information, the source is obtained.
- the video stream is transcoded into at least two target video streams of different resolutions, wherein the position of the IDR frame in each of the at least two target video streams is aligned with the target position, so when the video is in the process of playing, Switching in the target video stream arbitrarily, there is no phenomenon of repeated playback when the video is switched, and smooth switching between video streams of different code streams is achieved.
- the object to achieve a technical effect a smooth handover can be performed during playback of video, and thus solves the technical problem in the related art video switching is not smooth during playback.
- FIG. 1 is a schematic diagram of a hardware environment of a transcoding method of a video file according to an embodiment of the present application
- FIG. 2 is a flowchart of a method for transcoding an optional video file according to an embodiment of the present application
- FIG. 3 is a flowchart of a method for transcoding an optional video file according to an embodiment of the present application
- FIG. 4 is a flow chart of optionally transcoding a source video stream into at least two target video streams according to an embodiment of the present application
- FIG. 5 is another flow chart of transcoding a source video stream into at least two target video streams according to an embodiment of the present application
- FIG. 6 is a flow chart of optionally encapsulating a source video stream and a source audio stream according to an embodiment of the present application
- FIG. 7 is a schematic diagram of an optional transcoding device for a video file according to an embodiment of the present application.
- FIG. 8 is a structural block diagram of a terminal according to an embodiment of the present application.
- the system automatically prompts the user whether to reduce the clarity of the played video, or automatically switches the high-definition playback state to low definition. Play status.
- a processing method for degraded playback of the played video enabling the server to send a low-rate video stream, reducing bandwidth usage, avoiding caching and cards The occurrence of Dunton.
- the picture group GOP includes an I frame, a P frame, and a B frame, wherein the I frame is an intra coded frame, the P frame is a forward predicted frame, and the B frame is a bidirectional interpolation frame.
- the I frame is a complete picture, and the P frame and the B frame are used to record changes with respect to the I frame. Without the I frame, the P frame and the B frame cannot be decoded.
- an embodiment of a method for transcoding a video file is provided.
- the transcoding method of the video file may be applied to a hardware environment formed by the server 102 and the terminal 104 as shown in FIG. 1.
- the server 102 is connected to the terminal 104 through a network.
- the network includes but is not limited to a wide area network, a metropolitan area network, or a local area network.
- the terminal 104 is not limited to a PC, a mobile phone, a tablet, or the like.
- the transcoding method of the video file in the embodiment of the present application may be performed by the server 102, may be performed by the terminal 104, or may be performed by the server 102 and the terminal 104 in common.
- the transcoding method of the video file performed by the terminal 104 in the embodiment of the present application may also be performed by a client installed thereon.
- the terminal 104 obtains a source video file to be transcoded from the server 102, where the obtained source video file includes a source audio stream and a source video stream.
- the terminal 104 separates the source video stream from the source audio stream to obtain the separated source video stream and source audio stream. Then, the terminal 104 performs pre-transcoding processing on the acquired source video stream according to the transcoding parameter, obtains a state file including related information such as frame type information, and determines a target position for indicating the target position of the IDR frame according to the state file. information. After the terminal 104 obtains the target location information, the separated source video stream can be transferred according to the target location information.
- the code is a target video stream having at least two resolutions different from each other, wherein an IDR position in each of the at least two target video streams is aligned with the target position.
- FIG. 2 is a flowchart of a method for transcoding an optional video file according to an embodiment of the present application. As shown in FIG. 2, the method may include steps S202-S204.
- Step S202 Acquire a source video stream from a source video file to be transcoded.
- the source audio stream and the source video in the source video file may be separated to obtain the separated source video stream and the source audio stream.
- Step S204 Perform pre-transcoding processing on the source video stream to obtain target location information, where the target location information is used to indicate a target location of the IDR frame.
- the terminal may perform pre-transcoding processing on the source video stream according to the configured transcoding parameter to obtain target location information for indicating a target location of the IDR frame, where the IDR frame is in any picture group GOP.
- the first I frame That is to say, by performing pre-transcoding processing on the source video stream, the position of the first I frame of any picture group GOP can be obtained.
- the above transcoding parameters include the resolution and code control mode of the video stream, and the resolution is lower than a predetermined value.
- Step S206 transcoding the source video stream into at least two target video streams according to the target location information, wherein the location of the IDR frame in each of the at least two target video streams is aligned with the target location, and the position is aligned.
- the IDR frame corresponds to the same video picture.
- the source video stream may be transcoded into at least two target video streams, for example, transcoded into a video stream with a resolution of 1080P, and transcoded into resolution.
- the rate is 720P video stream.
- the position of the IDR frame in the obtained video stream having a resolution of 1080P and the video stream having a resolution of 720P is aligned with the above-described target position.
- the pre-transcoding process is first performed on the acquired source video stream, and the target location of the IDR frame is determined according to the target location information after the processing, and then, based on the acquired target location information,
- the source video stream is transcoded into at least two target video streams of different resolutions, wherein the position of the IDR frame in each of the at least two target video streams is aligned with the target position, so when the video is in the process of playing, Can switch anywhere in the target video stream, not out
- the phenomenon of repeated playback when the video is switched is achieved, and the purpose of smooth switching between video streams of different code streams is achieved, thereby realizing the technical effect of smooth switching in the video playing process, thereby solving the related art in which the video is playing. Switching to technical problems that are not smooth during the process.
- the source video stream is transcoded into at least two target video streams according to the target location information, wherein each of the at least two target video streams is performed in the same manner.
- Transcoding processing Specifically, when the source video stream is transcoded to obtain each target video stream, the source video stream may be decoded to obtain original video data, where the original video data is composed of several video frames. After decoding the original video data, the frame position of the target position in the original video data is set as an IDR frame, and then each video frame other than the IDR frame in the original data is video-encoded to obtain a target video stream.
- the terminal may perform the first encoding process on the source video according to the configured transcoding parameters, and save in the encoding process, for each One frame generates statistical information such as quantized values, and frame type judgment information, and saves it as a state file; provides reference information for the second frame code, wherein the configured transcoding parameters can be selected as resolution 270P, code control
- the mode is crf (constant rate factor). That is, the target position information indicating the target position of the IDR frame has been recorded in the generated status file.
- the source video stream may be converted into the target video stream recorded in the same state file for indicating the target location of the IDR frame. At least two target videos.
- the IDR frames of any two of the at least two target videos obtained by the method are aligned, so that the smoothness of the video during the switching process can be ensured.
- a video website defaults to two resolutions, namely resolution of 1080P (ie, high definition), or resolution of 720P (ie, standard definition).
- resolution of 1080P ie, high definition
- 720P ie, standard definition
- user A chooses to play a video file named "xx Challenge Phase I" in high definition (ie, 1080P) in the video website, wherein before the video file is played, it has been followed in steps S202 to S208.
- the described technical solution is processed to obtain two target video streams, that is, a video stream with a resolution of 1080P and a video stream with a resolution of 720P.
- the positions of the IDR frames are aligned.
- the currently set HD playback can be manually or automatically adjusted to standard definition (ie, 720P) playback. Since the played video file is processed according to the method provided by the embodiment of the present application, the position of the IDR frame in the two target video streams after the transcoding is aligned, so the HD video stream is switched to When playing standard definition video streams, smooth switching can be achieved without repeating the phenomenon of playing back videos that have been played before switching. The overall improvement of the smoothness of video playback and improved user experience.
- the source video stream is a silent video stream. Therefore, the source video stream and the source audio stream need to be encapsulated to obtain a complete video file (ie, a target video file).
- step S202 shows that the source video stream obtained in step S202 is obtained by separating the source video stream and the source audio stream in the source video file, and then performing steps on the source video stream. S204 to the technical solution described in step S206. Then, in the embodiment of the present application, the source audio stream is also acquired, that is, when the source video file is separated, the source video stream is acquired while the source audio stream is acquired.
- the obtained source audio stream is transcoded into at least one target audio stream, and at least one target audio file is encapsulated with at least two source video streams to obtain a plurality of target video files, wherein Each target video file in the target video file is obtained by encapsulating one target audio stream and one target video stream.
- the source video stream is transcoded to obtain a target video stream with a resolution of 1080P and a target video stream with a resolution of 720P.
- the source audio stream obtained from the source video file can also be transcoded to obtain at least one source audio stream.
- the channel audio stream can be packaged with a target video stream with a resolution of 1080P and a target video stream with a resolution of 720P, respectively, to obtain a target video file with a resolution of 1080P and a resolution of 720P target video file.
- A1 can be packaged with a target video stream with a resolution of 1080P and a target video stream with a resolution of 720P, respectively, to obtain a target video file A11 with a resolution of 1080P.
- the target video file A12 with a resolution of 720P; and A2 is respectively packaged with a target video stream with a resolution of 1080P and a target video stream with a resolution of 720P, and a target video file A21 with a resolution of 1080P and a resolution of 720P target video file A22. That is to say, when two source audio streams are obtained, the number of target video files obtained is four. Similarly, when three source audio streams are obtained, the number of target video files obtained is six.
- the source video stream can be put into the video track
- the source audio stream can be put into the audio track. Get the target video file.
- the phenomenon of jamming does not occur when the target video file is switched, and the smoothness of the video switching is improved to some extent.
- a transcoding method for a video file is provided.
- the method at least two target video streams are obtained, wherein IDR frames of any two video streams are aligned. Therefore, during the playback of the target video file, smooth switching playback between different resolutions can be performed according to the network bandwidth, thereby improving the viewing experience of the user.
- FIG. 3 is a flowchart of an optional transcoding method of a video file according to an embodiment of the present application. As shown in FIG. 3, the method may include steps S301-S307.
- Step S301 the source video stream of the source video file to be transcoded is separated from the source audio stream.
- the source audio in the source video file may be The stream is separated from the source video to obtain a source video stream and a source audio stream after separation.
- Step S302 configuring a transcoding parameter, where the transcoding parameter includes a resolution and a code control mode, for example, configuring a set of low resolution 270P, code control mode is a transcoding parameter of crf;
- Step S303 performing a first encoding on the video according to the configured transcoding parameters
- Step S304 obtaining a state file including frame type information according to the first ⁇ code, specifically, storing statistical information such as a quantized value and frame type determination information for each frame in the first ⁇ encoding process, and Saving as a status file to provide reference information for the second ⁇ code, wherein the target location information for indicating the target location of the IDR frame is recorded in the status file;
- the source video stream is transcoded into at least two target video streams according to the target location information, where the location of the IDR frame in each of the at least two target video streams is aligned with the target location;
- the source video stream can be transcoded into at least two target video streams, for example, transcoded into a video stream with a resolution of 1080P, or transcoded into a video with a resolution of 720P. flow.
- the position of the IDR frame is aligned with the above target position;
- Step S306 obtaining a source audio stream from the source video file to be transcoded, and transcoding the separated audio file according to a specified specification to obtain a source audio stream;
- Step S307 Encapsulate the obtained source audio stream and the source video stream to obtain a target video file, where the transcoding obtains that the source audio stream is at least one source audio stream.
- the channel audio stream can be packaged with a target video stream with a resolution of 1080P and a target video stream with a resolution of 720P, respectively, to obtain a target video file with a resolution of 1080P and a resolution of 720P target video file.
- A1 can be packaged with a target video stream with a resolution of 1080P and a target video stream with a resolution of 720P, respectively, to obtain a target video file A11 with a resolution of 1080P.
- the target video file A12 with a resolution of 720P; and A2 is respectively packaged with a target video stream with a resolution of 1080P and a target video stream with a resolution of 720P, and a target video file A21 with a resolution of 1080P and a resolution of 720P target video file A22. That is to say, when two source audio streams are obtained, the number of target video files obtained is four. Similarly, when three source audio streams are obtained, the number of target video files obtained is six.
- FIG. 4 is a flowchart of optionally transcoding a source video stream into at least two target video streams according to an embodiment of the present application. As shown in FIG. 4, the method may include steps S401-S403.
- Step S401 reading and analyzing a state file generated during pre-transcoding
- Step S402 recording target location information for indicating IDR frame position information recorded in the state file
- Step S403 referring to the target location information recorded in the state file, transcoding the source video stream into at least two target video streams, wherein each of the target video streams in the transcoding process refers to the records recorded in the same state file.
- the frame on the target location in the original video file is designated as an IDR frame. Since each target video stream is based on consistent IDR location information, this allows the IDR locations of each target video stream to be aligned.
- FIG. 5 is another flow chart of transcoding a source video stream into at least two target video streams according to an embodiment of the present application. As shown in FIG. 5, the method may include steps S501-S504.
- Step S501 analyzing the state file to obtain target location information, where the target location information is used to indicate location information of the IDR;
- Step S502 the encoder according to the location information of the IDR and the transcoding parameters set by the specification 1, transcoding to obtain the target video stream 1;
- Step S503 the encoder transcodes the target video stream 2 according to the location information of the IDR and the transcoding parameter set by the specification 2;
- Step S504 including step S5041 and step S5042, the encoder forcibly specifies the location of the IDR frame in the target video stream 1 and the target video stream 2 according to the position of the IDR, wherein the IDR in the target video stream 1 and the target video stream 2 The frames are aligned with the IDR frame target position in the state file, thereby ensuring that the IDR frame positions in the target video stream 1 and the target video stream 2 are identical.
- the number of target video streams generated by transcoding is at least two paths. In the embodiment shown in FIG. 5, only two target video streams (target video stream 1 and target) are used. Video stream 2) is explained as an example.
- FIG. 6 is a flowchart of optionally encapsulating a source video stream and a source audio stream according to an embodiment of the present application. As shown in FIG. 6, the method may include steps S601-S602.
- Step S601 transcoding the source audio stream according to the set audio transcoding parameter by the audio encoder, and obtaining a target audio stream
- Step S602 the target audio stream and the target video stream are encapsulated to obtain a final target video file.
- the source audio stream obtained from the source video file may be transcoded to obtain at least one source audio stream.
- the road element audio stream can be separately packaged with the target video stream 1 and the target video stream 2 described in FIG. 5 to obtain a target video file 1 and a target video file 2.
- A1 and the target video stream 1 may be respectively encapsulated to obtain a target video file A11 and a target video file A12; and A2 and the target video stream 2 are respectively encapsulated.
- the target video file A21 and the target video file A22 are obtained. That is to say, when two source audio streams are obtained, the number of target video files obtained is four. Similarly, when three source audio streams are obtained, the number of target video files obtained is six.
- the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation.
- the technical solution of the present application which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
- the optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, or a network device, etc.) to perform the methods of various embodiments of the present application.
- a transcoding device for a video file for implementing the transcoding method of the above video file.
- the transcoding of the video file is a schematic diagram of an optional video file transcoding device according to an embodiment of the present application. As shown in FIG. 7, the device may include:
- the first obtaining unit 71 is configured to obtain a source video stream from the source video file to be transcoded
- the source audio stream and the source video in the source video file may be separated to obtain the separated source video stream and the source audio stream.
- the processing unit 73 is configured to perform pre-transcoding processing on the source video stream to obtain target location information, where the target location information is used to indicate a target location of the IDR frame, and the position-aligned IDR frame corresponds to the same video image;
- the terminal may perform pre-transcoding processing on the source video stream according to the configured transcoding parameter to obtain target location information for indicating a target location of the IDR frame, where the IDR frame is in any picture group GOP.
- the first I frame That is to say, by performing pre-transcoding processing on the source video stream, the position of the first I frame of any picture group GOP can be obtained.
- the above transcoding parameters include the resolution and code control mode of the video stream, and the resolution is lower than a predetermined value.
- the first transcoding unit 75 is configured to transcode the source video stream into at least two target video streams according to the target location information, where the location and the destination of the IDR frame in each of the at least two target video streams The position is aligned.
- the source video stream may be transcoded into at least two target video streams, for example, transcoded into a video stream with a resolution of 1080P, or transcoded into a resolution.
- the rate is 720P video stream.
- the position of the IDR frame in the obtained video stream having a resolution of 1080P and the video stream having a resolution of 720P is aligned with the above-described target position.
- the pre-transcoding process is first performed on the acquired source video stream, and the target location of the IDR frame is determined according to the target location information after the processing, and then, based on the acquired target location information, the source is obtained.
- the video stream is transcoded into at least two target video streams of different resolutions, wherein the position of the IDR frame in each of the at least two target video streams is aligned with the target position, so when the video is in the process of playing, Switching in the target video stream arbitrarily, there is no phenomenon of repeated playback when the video is switched, and the purpose of smooth switching between video streams of different code streams is achieved, thereby realizing the technology capable of smooth switching during video playback.
- the effect further solves the technical problem that the video is not smoothly switched during the playing process in the related art.
- first obtaining unit 71 in this embodiment may be used to perform step S202 in the embodiment of the present application.
- the processing unit 73 in this embodiment may be used to perform step S204 in the embodiment of the present application.
- the first transcoding unit 75 in the embodiment may be used to perform step S206 in the embodiment of the present application.
- the foregoing modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the contents disclosed in the foregoing embodiments. It should be noted that the foregoing module may be implemented in a hardware environment as shown in FIG. 1 as part of the device, and may be implemented by software or by hardware.
- the first transcoding unit transcodes the source video stream into one of the at least two target video streams according to the target location information, and includes: a decoding module, configured to decode the source video stream into the original video. And a setting module, configured to set a frame on the target position in the original video data as an IDR frame, and perform video encoding on the frame other than the target position in the original video data to obtain a target video stream.
- the terminal may perform the first encoding process on the source video according to the configured transcoding parameters, and save the encoding process in each frame.
- Generating statistical information such as quantized values, and determining information of the frame type, and saving the data as a state file; providing reference information for the second encoding, wherein the configured transcoding parameter can be selected as a resolution of 270P, and the code control mode is Clf. That is, the target position information indicating the target position of the IDR frame has been recorded in the generated status file.
- the source video stream when the source video stream is transcoded into at least two target video streams according to the target location information, the source video stream may be converted into at least according to the target location information recorded in the same state file for indicating the target location of the IDR frame. Two-way target video.
- the IDR frames of any two of the at least two target videos obtained by the above manner are aligned, so that the smoothness of the video during the switching process can be ensured.
- a video website defaults to two resolutions, namely resolution of 1080P (ie, high definition), or resolution of 720P (ie, standard definition).
- resolution of 1080P ie, high definition
- 720P ie, standard definition
- user A chooses to play a video file named "xx Challenge Phase I" in high definition (ie, 1080P) in the video website, wherein before the video file is played, it has been followed in steps S202 to S208.
- the described technical solution is processed to obtain two target video streams, that is, a video stream with a resolution of 1080P and a video stream with a resolution of 720P.
- the positions of the IDR frames are aligned.
- the video may be stuck during the playback process.
- the currently set HD playback can be manually or automatically adjusted to standard definition (ie, , 720P) play. Since the played video file is processed according to the method provided by the embodiment of the present application, the position of the IDR frame in the two target video streams after the transcoding is aligned, so the HD video stream is switched to When playing standard definition video streams, smooth switching can be achieved without repeating the phenomenon of playing back videos that have been played before switching. The overall improvement of the smoothness of video playback and improved user experience.
- the target location information is recorded in the state file
- the first transcoding unit includes: a transcoding module, configured to transcode the source video stream into a parallel manner according to the target location information recorded in the same state file. At least two target videos.
- the device further includes: a second acquiring unit, configured to: when acquiring the source video stream from the source video file to be transcoded, obtain the source audio stream from the source video file to be transcoded; the device further includes: a second transcoding unit, configured to: after obtaining the source audio stream from the source video file to be transcoded, transcode the source audio stream into at least one target audio stream, and perform at least one target audio stream and at least two target video streams Encapsulating, obtaining a plurality of target video files, wherein each of the plurality of target video files is obtained by encapsulating one target audio stream and one target video stream.
- a second acquiring unit configured to: when acquiring the source video stream from the source video file to be transcoded, obtain the source audio stream from the source video file to be transcoded
- the device further includes: a second transcoding unit, configured to: after obtaining the source audio stream from the source video file to be transcoded, transcode the source audio stream into at least one target audio stream, and perform at least one target audio
- the source video stream is a silent video stream. Therefore, the source video stream and the source audio stream need to be encapsulated to obtain a complete video file (ie, a target video file).
- the obtained source video stream is obtained by separating the source video stream and the source audio stream in the source video file. Then, in the embodiment of the present application, the source audio stream is also acquired, that is, when the source video file is separated, the source video stream is acquired while the source audio stream is acquired. After obtaining the source audio stream, the obtained source audio stream is transcoded into at least one target audio stream, and at least one target audio file is encapsulated with at least two source video streams to obtain a plurality of target video files, wherein Each target video file in the target video file is obtained by encapsulating one target audio stream and one target video stream.
- the source video stream is transcoded to obtain a target video stream with a resolution of 1080P and a target video stream with a resolution of 720P.
- the source audio stream obtained from the source video file can also be transcoded to obtain at least one source audio stream.
- the channel audio stream can be packaged with a target video stream with a resolution of 1080P and a target video stream with a resolution of 720P, respectively, to obtain a target video file with a resolution of 1080P and a resolution of 720P target video file.
- A1 can be packaged with a target video stream with a resolution of 1080P and a target video stream with a resolution of 720P, respectively, to obtain a target video file A11 with a resolution of 1080P.
- the target video file A12 with a resolution of 720P; and A2 is respectively packaged with a target video stream with a resolution of 1080P and a target video stream with a resolution of 720P, and a target video file A21 with a resolution of 1080P and a resolution of 720P target video file A22. That is to say, when two source audio streams are obtained, the number of target video files obtained is four. Similarly, when three source audio streams are obtained, the number of target video files obtained is six.
- the processing unit includes: a processing module, configured to perform pre-transcoding processing on the source video stream by using the configured transcoding parameter to obtain target location information, where the transcoding parameter includes resolution and code control mode, and the resolution is low. At a predetermined value.
- the terminal may pre-transcode the source video stream according to the configured transcoding parameters. Processing, obtaining target position information for indicating a target position of the IDR frame, wherein the IDR frame is the first I frame of any one of the picture groups GOP. That is to say, by performing pre-transcoding processing on the source video stream, the position of the first I frame of any picture group GOP can be obtained.
- the above transcoding parameters include the resolution and code control mode of the video stream, and the resolution is lower than a predetermined value.
- the foregoing modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the contents disclosed in the foregoing embodiments. It should be noted that the foregoing module may be implemented in a hardware environment as shown in FIG. 1 as part of the device, and may be implemented by software or by hardware, where the hardware environment includes a network environment.
- a server or a terminal for implementing the transcoding method of the above video file is further provided.
- FIG. 8 is a structural block diagram of a terminal according to an embodiment of the present application.
- the terminal may include: one or more (only one shown in the figure) processor 801, memory 803, And a transmission device 805 (such as the transmission device in the above embodiment), as shown in FIG. 8, the terminal may further include an input and output device 807.
- the memory 803 can be used to store the software program and the module, such as the transcoding method of the video file and the program instruction/module corresponding to the device in the embodiment of the present application, and the processor 801 runs the software program and the module stored in the memory 803. Thereby, various functional applications and data processing are performed, that is, the transcoding method of the above video file is implemented.
- Memory 803 can include high speed random access memory, and can also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory.
- memory 803 can further include memory remotely located relative to processor 801, which can be connected to the terminal over a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
- the transmission device 805 described above is used to receive or transmit data via a network, and can also be used for data transmission between the processor and the memory. Specific examples of the above network may include a wired network and a wireless network.
- the transmission device 805 includes a Network Interface Controller (NIC) that can be connected to other network devices and routers via a network cable to communicate with the Internet or a local area network.
- the transmission device 805 is a Radio Frequency (RF) module for communicating wirelessly with the Internet.
- NIC Network Interface Controller
- RF Radio Frequency
- the memory 803 is used to store an application.
- the processor 801 can call the application stored in the memory 803 through the transmission device 805 to perform the following steps:
- the stream is coded into at least two target video streams, wherein the position of the IDR frame in each of the at least two target video streams is aligned with the target position.
- the processor 801 is further configured to: decode the source video stream into original video data; set a frame at the target position in the original video data as an IDR frame, and perform a frame other than the target position in the original video data. Video coding, get a target video stream.
- the processor 801 is further configured to perform the following steps: transcoding the source video stream into at least two target videos in a parallel manner according to the target location information recorded in the same state file.
- the processor 801 is further configured to: obtain a source audio stream from the source video file to be transcoded; transcode the source audio stream into at least one target audio stream, and convert the at least one target audio stream with the at least two target videos
- the stream is encapsulated to obtain a plurality of target video files, wherein each of the plurality of target video files is obtained by encapsulating one target audio stream and one target video stream.
- the processor 801 is further configured to perform the following steps: performing pre-transcoding processing on the source video stream by using the configured transcoding parameters to obtain target location information, where the transcoding parameters include resolution and code control mode, and the resolution is lower than a predetermined one. value.
- the source video stream is pre-transcoded, and the target location of the IDR frame is determined according to the target location information after the processing. Then, based on the target location information, the source video is obtained.
- Switching in the target video stream does not cause repeated playback when the video is switched, and achieves the purpose of smooth switching between video streams of different code streams, thereby realizing the technical effect of smooth switching during video playback. Furthermore, the technical problem that the video is not smoothly switched during the playback process in the related art is solved.
- FIG. 8 is only illustrative, and the terminal can be a smart phone (such as an Android mobile phone, an iOS mobile phone, etc.), a tablet computer, a palm computer, and a mobile Internet device (MID). Terminal equipment such as PAD.
- FIG. 8 does not limit the structure of the above electronic device.
- Embodiments of the present application also provide a storage medium.
- the foregoing storage medium may be used to execute program code of a transcoding method of a video file.
- the foregoing storage medium may be located on at least one of the plurality of network devices in the network shown in the foregoing embodiment.
- the storage medium is arranged to store program code for performing the following steps:
- the foregoing storage medium may include, but is not limited to, a USB flash drive, a read-only memory (ROM), and a random access memory (RAM, Random Access). Memory, removable hard disk, disk or optical disk, etc., which can store program code.
- the integrated unit in the above embodiment if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in the above-described computer readable storage medium.
- the technical solution of the present application in essence or the contribution to the prior art, or all or part of the technical solution may be embodied in the form of a software product, which is stored in a storage medium.
- a number of instructions are included to cause one or more computer devices (which may be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present application.
- the disclosed client may be implemented in other manners.
- the device embodiments described above are merely illustrative.
- the division of the unit is only a logical function division.
- multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not executed.
- the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, unit or module, and may be electrical or otherwise.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
Abstract
本申请公开了一种视频文件的转码方法和装置。其中,该方法包括:从待转码的源视频文件中获取源视频流;对源视频流进行预转码处理,得到目标位置信息,其中,目标位置信息用于指示IDR帧的目标位置;根据目标位置信息将源视频流转码成至少两路目标视频流,其中,至少两路目标视频流中的每路目标视频流中IDR帧的位置与目标位置对齐,位置对齐的IDR帧对应同一个视频画面。本申请解决了相关技术中视频在播放过程中切换不流畅的技术问题。
Description
本申请要求于2016年7月13日提交中国专利局、申请号2016105509229,发明名称为“视频文件的转码方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及多媒体领域,具体而言,涉及一种视频文件的转码方法,装置及存储介质。
在现有社会中的视频行业中,视频播放体验对于每个视频网站都很重要,视频播放的流畅度是各大视频网站所追求目标。因为,流畅无卡顿的播放,对用户来说是最基本的要求。然而,由于当今社会中,由于国内的网络基础环境较差,因此,常出现网络拥塞等问题,进而,导致视频在线播放过程中出现缓冲、卡顿等现象,严重影响了用户体验。
针对上述的问题,目前尚未提出有效的解决方案。
发明内容
本申请实施例提供了一种视频文件的转码方法,装置及存储介质,以至少解决相关技术中视频在播放过程中切换不流畅的技术问题。
根据本申请实施例的一个方面,提供了一种视频文件的转码方法,包括:从待转码的源视频文件中获取源视频流;对所述源视频流进行预转码处理,得到目标位置信息,其中,所述目标位置信息用于指示IDR(instantaneous decoding refresh)帧的目标位置;根据所述目标位置信息将所述源视频流转码成至少两路目标视频流,其中,所述至少两路目标视频流中的每路目标视频流中IDR帧的位置与所述目标位置对齐,位置对齐的IDR帧对应同一个视频画面。
根据本申请实施例的另一方面,还提供了一种视频文件的转码装置,包括:
第一获取单元,用于从待转码的源视频文件中获取源视频流;处理单元,用于对所述源视频流进行预转码处理,得到目标位置信息,其中,所述目标位置信息用于指示IDR帧的目标位置;第一转码单元,用于根据所述目标位置信息将所述源视频流转码成至少两路目标视频流,其中,所述至少两路目标视频流中的每路目标视频流中IDR帧的位置与所述目标位置对齐,位置对齐的IDR帧对应同一个视频画面。
根据本申请实施例的另一方面,还提供了一种视频文件的非易失性存储介质,其中存储有计算机可读指令。当所述指令被执行时,使得计算机执行上述的视频文件转码方法。
在本申请实施例中,采用从待转码的源视频文件中获取源视频流;对所述源视频流进行预转码处理,得到目标位置信息,其中,所述目标位置信息用于指示IDR帧的目标位置;根据所述目标位置信息将所述源视频流转码成至少两路目标视频流,其中,所述至少两路目标视频流中的每路目标视频流中IDR帧的位置与所述目标位置对齐的方式,首先对获取到源视频流进行预转码处理,根据处理之后的到的目标位置信息确定IDR帧的目标位置,然后,在获取到目标位置信息的基础上,将源视频流转码成不同分辨率的至少两路目标视频流,其中,至少两路目标视频流中每个目标视频流中的IDR帧的位置与目标位置对齐,因此,当视频在播放过程中,可以任意在目标视频流中进行切换,不会出现视频进行切换时重复播放的现象,达到了不同码流的视频流之间的平滑切换的目的,从而实现了视频播放过程中能够进行流畅切换的技术效果,进而解决了相关技术中视频在播放过程中切换不流畅的技术问题。
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:
图1是根据本申请实施例的视频文件的转码方法的硬件环境的示意图;
图2是根据本申请实施例的一种可选的视频文件的转码方法的流程图;
图3是根据本申请实施例的一种可选的视频文件的转码方法的流程图;
图4是根据本申请实施例的一种可选的将源视频流转码成至少两路目标视频流的流程图;
图5是根据本申请实施例的另一种可选的将源视频流转码成至少两路目标视频流的流程图;
图6是根据本申请实施例的一种可选的将源视频流和源音频流进行封装的流程图;
图7是根据本申请实施例的一种可选的视频文件的转码装置的示意图;以及
图8是根据本申请实施例的一种终端的结构框图。
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。
需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
用户在视频网页中或者视频APP中观看视频时,经常会出现卡顿等现象,此时,系统会自动提示用户是否降低播放视频的清晰度,或者自动将高清晰度播放状态切换至低清晰度播放状态。对播放的视频进行清晰度的降级播放的处理方法,可以使服务器发送低码率的视频流,减少对带宽占用,避免缓存和卡
顿的发生。
现有技术中对视频进行清晰度的降级播放的处理的过程中,会出现视频切换不流畅的现象。例如,将1080P的视频流切换至720P的视频流时,还会重复播放一段已经播放过的视频。针对上述问题,发明人发现,视频帧在解码时,会参考画面组(Group of Pictures,简称GOP)单元中的其他帧,由于帧之间相互依赖的关系,清晰度切换的时刻点,只可能出现在上一个GOP的播放完毕,下一个GOP开启播放的时候。由于IDR帧数据位于GOP的开头,因此,只要保证高码流的IDR帧和低码流的IDR位置对齐,即保证高码流的IDR帧和低码流的IDR帧对应的画面一致,就可以保证视频播放时的流畅切换。画面组GOP中包括I帧、P帧和B帧,其中,I帧为内部编码帧、P帧为前向预测帧、B帧为双向内插帧。I帧是一个完整的画面,P帧和B帧用于记录相对于I帧的变化,没有I帧,P帧和B帧无法解码。
针对上述问题,下面将结合具体实施例对本申请实施例进行具体介绍。
根据本申请实施例,提供了一种视频文件的转码的方法实施例。
可选地,在本实施例中,上述视频文件的转码方法可以应用于如图1所示的由服务器102和终端104所构成的硬件环境中。如图1所示,服务器102通过网络与终端104进行连接,上述网络包括但不限于:广域网、城域网或局域网,终端104并不限定于PC、手机、平板电脑等。本申请实施例的视频文件的转码方法可以由服务器102来执行,也可以由终端104来执行,还可以是由服务器102和终端104共同执行。其中,终端104执行本申请实施例的视频文件的转码方法也可以是由安装在其上的客户端来执行。
图1中示出的硬件环境系统的主要工作原理是:
终端104从服务器102中获取待转码的源视频文件,其中,获取到的源视频文件中包括源音频流和源视频流。终端104将源视频流和源音频流进行分离,得到分离之后的源视频流和源音频流。然后,终端104按照转码参数对获取到的源视频流进行预转码处理,得到包含帧类型信息等相关信息的状态文件,并根据该状态文件确定用于指示IDR帧的目标位置的目标位置信息。终端104得到目标位置信息之后,就可以根据目标位置信息将上述分离得到的源视频流转
码成至少两路分辨率不相同的目标视频流,其中,至少两路目标视频流中每个目标视频流中的IDR位置与目标位置对齐。通过上述对齐IDR位置,就可以在视频流切换的过程中,实现平滑切换。
图2是根据本申请实施例的一种可选的视频文件的转码方法的流程图,如图2所示,该方法可以包括步骤S202-S204。
步骤S202,从待转码的源视频文件中获取源视频流。
在本申请实施例中,终端从服务器获取待转码的源视频文件之后,可以将源视频文件中的源音频流和源视频进行分离,得到分离之后的源视频流和源音频流。
步骤S204,对源视频流进行预转码处理,得到目标位置信息,其中,目标位置信息用于指示IDR帧的目标位置。
在本申请实施例中,终端可以按照配置的转码参数对源视频流进行预转码处理,得到用于指示IDR帧的目标位置的目标位置信息,其中,IDR帧为任一个画面组GOP中的第一个I帧。也就是说,通过对源视频流进行预转码处理,可以得到任一个画面组GOP的第一个I帧的位置。上述转码参数包括视频流的分辨率和码控方式,分辨率低于预定值。
步骤S206,根据目标位置信息将源视频流转码成至少两路目标视频流,其中,至少两路目标视频流中的每路目标视频流中IDR帧的位置与所述目标位置对齐,位置对齐的IDR帧对应同一个视频画面。
在本申请实施例中,在获取到上述目标位置信息之后,就可以将源视频流转码成至少两路的目标视频流,例如,转码成分辨率为1080P的视频流,及转码成分辨率为720P的视频流。并且,在得到的分辨率为1080P的视频流和分辨率为720P的视频流中IDR帧的位置与上述目标位置对齐。
通过上述步骤S202至步骤S206,首先对获取到源视频流进行预转码处理,根据处理之后的到的目标位置信息确定IDR帧的目标位置,然后,在获取到目标位置信息的基础上,将源视频流转码成不同分辨率的至少两路目标视频流,其中,至少两路目标视频流中每个目标视频流中的IDR帧的位置与目标位置对齐,因此,当视频在播放过程中,可以任意在目标视频流中进行切换,不会出
现视频进行切换时重复播放的现象,达到了不同码流的视频流之间的平滑切换的目的,从而实现了视频播放过程中能够进行流畅切换的技术效果,进而解决了相关技术中视频在播放过程中切换不流畅的技术问题。
通过上述步骤S206可知,在本申请实施例中,是依据目标位置信息将源视频流转码成至少两路目标视频流,其中,至少两路目标视频流中每路视频流均按照相同的方法进行转码处理。具体地,在对源视频流进行转码得到每路目标视频流时,可以先将源视频流进行解码,得到原始视频数据,其中,原始视频数据由若干个视频帧组成。在解码得到原始视频数据之后,将原始视频数据中目标位置的帧位置设置为IDR帧,然后,对原始数据中除了IDR帧之外的每个视频帧进行视频编码,得到一路目标视频流。
需要说明的是,在本申请上述步骤S204提供的技术方案中,终端获取到源视频流之后,可以对源视频按照配置的转码参数进行第一趟编码处理,保存在编码过程中,为每一帧生成量化值等统计信息,以及帧类型的判定信息,并将其保存为一个状态文件;为第二趟编码提供参考信息,其中,配置的转码参数可以选取为分辨率270P、码控方式为crf(constant rate factor)。也就是说,在生成的状态文件中已记录用于指示IDR帧的目标位置的目标位置信息。在步骤S206根据目标位置信息将源视频流转码成至少两路目标视频流时,可以根据上述同一个状态文件中已记录的用于指示IDR帧的目标位置的目标位置信息将源视频流转换成至少两路目标视频。
通过该方法得到的至少两路目标视频中任意两路视频的IDR帧都是对齐的,因此,就可以保证视频在切换过程中的流畅性。
举例言之,某视频网站中默认两种清晰度,即分辨率为1080P的清晰度(也即,高清),或者分辨率为720P的清晰度(也即,标清)。假设,用户A选择在该视频网站中高清(即,1080P)播放名称为:“xx挑战第一期”的视频文件,其中,在视频文件在播放之前,已按照上述步骤S202至步骤S208中所描述的技术方案进行处理,得到了两路目标视频流,即分辨率为1080P的视频流和分辨率为720P的视频流。通过上述方法得到的分辨率为1080P的视频流和分辨率为720P的视频流两路目标视频流中,IDR帧的位置是对齐的。
如果在播放上述视频文件的过程中,由于网络的原因,导致视频在播放的
过程中出现卡顿的现象,为了不影响播放的进度,可以将当前设置的高清播放手动或者自动调整为标清(即,720P)播放。由于播放的视频文件在播放之前已按照本申请实施例提供的方法进行处理,因此,转码之后的两路目标视频流中IDR帧的位置是对齐的,所以,在将播放高清视频流切换为播放标清视频流时,可以实现平滑切换,不会出现重复播放在切换之前已播放过的视频的现象。整体提高了视频播放的流畅性,提高了用户体验。
需要说明的是,上述源视频流是无声视频流,因此,还需将源视频流与源音频流进行封装,才能得到一个完整的视频文件(即,目标视频文件)。
通过对上述步骤S202中提供的技术方案的描述可知,步骤S202中获取到的源视频流是将源视频文件中的源视频流和源音频流进行分离得到的,然后,对源视频流执行步骤S204至步骤S206中描述的技术方案。那么,在本申请实施例中,同样要获取源音频流,也即是说,在对源视频文件进行分离时,在获取源视频流的同时,还要获取源音频流。并在获取源音频流之后,将获取到的源音频流转码成至少一路目标音频流,并将至少一路目标音频文件与至少两路源视频流进行封装,得到多个目标视频文件,其中,多个目标视频文件中的每个目标视频文件是通过对一路目标音频流和一路目标视频流进行封装得到的。
举例言之,在上述举例说明中可知,将源视频流转码得到分辨率为1080P的目标视频流和分辨率为720P的目标视频流。那么,还可以将从源视频文件中获取到的源音频流同样进行转码得到至少一路源音频流。
如果得到一路源音频流,则可以将该路元音频流分别与分辨率为1080P的目标视频流和分辨率为720P的目标视频流进行封装,得到分辨率为1080P的目标视频文件和分辨率为720P的目标视频文件。
如果得到两路源音频流,例如,A1和A2,则可以将A1分别与分辨率为1080P的目标视频流和分辨率为720P的目标视频流进行封装,得到分辨率为1080P的目标视频文件A11和分辨率为720P的目标视频文件A12;并将A2分别与分辨率为1080P的目标视频流和分辨率为720P的目标视频流进行封装,得到分辨率为1080P的目标视频文件A21和分辨率为720P的目标视频文件A22。也就是说,当得到两路源音频流时,得到的目标视频文件的数量为4个,同样地,当得到三路源音频流时,得到的目标视频文件的数量为6个。
需要说明的是,在本申请实施例中,将源视频流和源音频流进行封装的方式有很多种,例如,可以将源视频流放入视频轨,并将源音频流放入音频轨,得到目标视频文件。
在视频网页或者视频终端中播放通过上述方法获取到的目标视频文件时,不会在切换目标视频文件时出现卡顿的现象,在某种程度上提高了视频切换的流畅度。
综上,在本申请实施例中,提供了一种视频文件的转码方法,在该方法中,得到了至少两路目标视频流,其中,任意两路视频流的IDR帧对齐。因此,使得目标视频文件播放过程中,可以根据网络带宽的情况,在不同分辨率之间进行平滑切换播放,提高用户的观看体验。
图3是根据本申请实施例的一种可选的视频文件的转码方法的流程图,如图3所示,该方法可以包括步骤S301-S307。
步骤S301,将待转码的源视频文件的源视频流和源音频流分离;在本申请实施例中,终端从服务器获取待转码的源视频文件之后,可以将源视频文件中的源音频流和源视频进行分离,得到分离之后的源视频流和源音频流。
步骤S302,配置转码参数,其中,转码参数包括分辨率和码控方式,例如,配置一组低分辨率270P、码控方式为crf的转码参数;
步骤S303,依据配置的转码参数,对视频进行第一趟编码;
步骤S304,根据第一趟编码得到包括帧类型信息的状态文件,具体地,可以保存在第一趟编码过程中为每一帧生成量化值等统计信息,以及帧类型的判定信息,并将其保存为一个状态文件,以为第二趟编码提供参考信息,其中,用于指示IDR帧目标位置的目标位置信息记录在状态文件中,;
步骤S305,根据目标位置信息将源视频流转码成至少两路目标视频流,其中,至少两路目标视频流中的每路目标视频流中IDR帧的位置与目标位置对齐;在本申请实施例中,在获取到上述目标位置信息之后,就可以将源视频流转码成至少两路的目标视频流,例如,转码成分辨率为1080P的视频流,或者转码成分辨率为720P的视频流。并且,在得到的分辨率为1080P的视频流和分辨率为720P的视频流中IDR帧的位置与上述目标位置对齐;
步骤S306,从待转码的源视频文件中获取源音频流,将分离得到的音频文件,按照指定规格进行转码得到源音频流;
步骤S307,将得到的源音频流和源视频流,进行封装,得到目标视频文件,其中,转码得到源音频流至少为一路源音频流。
如果得到一路源音频流,则可以将该路元音频流分别与分辨率为1080P的目标视频流和分辨率为720P的目标视频流进行封装,得到分辨率为1080P的目标视频文件和分辨率为720P的目标视频文件。
如果得到两路源音频流,例如,A1和A2,则可以将A1分别与分辨率为1080P的目标视频流和分辨率为720P的目标视频流进行封装,得到分辨率为1080P的目标视频文件A11和分辨率为720P的目标视频文件A12;并将A2分别与分辨率为1080P的目标视频流和分辨率为720P的目标视频流进行封装,得到分辨率为1080P的目标视频文件A21和分辨率为720P的目标视频文件A22。也就是说,当得到两路源音频流时,得到的目标视频文件的数量为4个,同样地,当得到三路源音频流时,得到的目标视频文件的数量为6个。
图4是根据本申请实施例的一种可选的将源视频流转码成至少两路目标视频流的流程图,如图4所示,该方法可以包括步骤S401-S403。
步骤S401,读取并分析预转码时生成的状态文件;
步骤S402,记录状态文件中记录的用于指示IDR帧位置信息的目标位置信息;
步骤S403,参考状态文件中记录的目标位置信息,将源视频流转码成至少两路目标视频流,其中,上述每路目标视频流在转码过程中,都会参考同一个状态文件中记录的用于指示IDR位置信息的目标位置信息,然后,对原始视频文件中目标位置上的帧指定为IDR帧。由于每路目标视频流都基于一致IDR位置信息,这就使得每路目标视频流的IDR位置都能对齐。
图5是根据本申请实施例的另一种可选的将源视频流转码成至少两路目标视频流的流程图,如图5所示,该方法可以包括步骤S501-S504。
步骤S501,分析状态文件,得到目标位置信息,其中,目标位置信息用于指示IDR的位置信息;
步骤S502,编码器根据IDR的位置信息和规格1设定的转码参数,转码得到目标视频流1;
步骤S503,编码器根据IDR的位置信息和规格2设定的转码参数,转码得到目标视频流2;
步骤S504,包括步骤S5041和步骤S5042,编码器会根据IDR的位置,强制指定目标视频流1和目标视频流2中的IDR帧的位置,其中,目标视频流1和目标视频流2中的IDR帧均与状态文件中的IDR帧目标位置对齐,从而保证了目标视频流1和目标视频流2中的IDR帧位置一致。
需要说明的是,在本申请实施例中,转码生成的目标视频流的数量至少为两路,在图5所示的实施例中,仅以两种目标视频流(目标视频流1和目标视频流2)为例进行说明。
图6是根据本申请实施例的一种可选的将源视频流和源音频流进行封装的流程图,如图6所示,该方法可以包括步骤S601-S602。
步骤S601,通过音频编码器根据设定的音频转码参数对源音频流进行转码,并得到目标音频流;
步骤S602,将目标音频流和目标视频流进行封装,得到最终的目标视频文件。
在本申请实施例中,可以将从源视频文件中获取到的源音频流同样进行转码得到至少一路源音频流。
如果得到一路源音频流,则可以将该路元音频流分别与图5中描述的目标视频流1和目标视频流2进行封装,得到目标视频文件1和目标视频文件2。
如果得到两路源音频流,例如,A1和A2,则可以将A1分别与目标视频流1进行封装,得到目标视频文件A11和目标视频文件A12;并将A2分别与目标视频流2进行封装,得到目标视频文件A21和目标视频文件A22。也就是说,当得到两路源音频流时,得到的目标视频文件的数量为4个,同样地,当得到三路源音频流时,得到的目标视频文件的数量为6个。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述
为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例的方法。
根据本申请实施例,还提供了一种用于实施上述视频文件的转码方法的视频文件的转码装置。图视频文件的转码是根据本申请实施例的一种可选的视频文件的转码装置的示意图,如图7所示,该装置可以包括:
第一获取单元71,用于从待转码的源视频文件中获取源视频流;
在本申请实施例中,终端从服务器获取待转码的源视频文件之后,可以将源视频文件中的源音频流和源视频进行分离,得到分离之后的源视频流和源音频流。
处理单元73,用于对源视频流进行预转码处理,得到目标位置信息,其中,目标位置信息用于指示IDR帧的目标位置,位置对齐的IDR帧对应同一个视频画面;
在本申请实施例中,终端可以按照配置的转码参数对源视频流进行预转码处理,得到用于指示IDR帧的目标位置的目标位置信息,其中,IDR帧为任一个画面组GOP中的第一个I帧。也就是说,通过对源视频流进行预转码处理,可以得到任一个画面组GOP的第一个I帧的位置。上述转码参数包括视频流的分辨率和码控方式,分辨率低于预定值。
第一转码单元75,用于根据目标位置信息将源视频流转码成至少两路目标视频流,其中,至少两路目标视频流中的每路目标视频流中IDR帧的位置与目
标位置对齐。
在本申请实施例中,在获取到上述目标位置信息之后,就可以将源视频流转码成至少两路的目标视频流,例如,转码成分辨率为1080P的视频流,或者转码成分辨率为720P的视频流。并且,在得到的分辨率为1080P的视频流和分辨率为720P的视频流中IDR帧的位置与上述目标位置对齐。
在本申请实施例中,首先对获取到源视频流进行预转码处理,根据处理之后的到的目标位置信息确定IDR帧的目标位置,然后,在获取到目标位置信息的基础上,将源视频流转码成不同分辨率的至少两路目标视频流,其中,至少两路目标视频流中每个目标视频流中的IDR帧的位置与目标位置对齐,因此,当视频在播放过程中,可以任意在目标视频流中进行切换,不会出现视频进行切换时重复播放的现象,达到了不同码流的视频流之间的平滑切换的目的,从而实现了视频播放过程中能够进行流畅切换的技术效果,进而解决了相关技术中视频在播放过程中切换不流畅的技术问题。
需要说明的是,该实施例中的第一获取单元71可以用于执行本申请实施例中的步骤S202,该实施例中的处理单元73可以用于执行本申请实施例中的步骤S204,该实施例中的第一转码单元75可以用于执行本申请实施例中的步骤S206。
此处需要说明的是,上述模块与对应的步骤所实现的示例和应用场景相同,但不限于上述实施例所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在如图1所示的硬件环境中,可以通过软件实现,也可以通过硬件实现。
可选地,可选地,第一转码单元根据目标位置信息将源视频流转码成至少两路目标视频流中的一路目标视频流包括:解码模块,用于将源视频流解码成原始视频数据;设置模块,用于将原始视频数据中目标位置上的帧设置为IDR帧,并对原始视频数据中除目标位置之外的帧进行视频编码,得到一路目标视频流。
需要说明的是,在本申请实施例中,终端获取到源视频流之后,可以对源视频按照配置的转码参数进行第一趟编码处理,保存在编码过程中,为每一帧
生成量化值等统计信息,以及帧类型的判定信息,并将其保存为一个状态文件;为第二趟编码提供参考信息,其中,配置的转码参数可以选取为分辨率270P、码控方式为crf。也就是说,在生成的状态文件中已记录用于指示IDR帧的目标位置的目标位置信息。然后,根据目标位置信息将源视频流转码成至少两路目标视频流时,可以根据上述同一个状态文件中已记录的用于指示IDR帧的目标位置的目标位置信息将源视频流转换成至少两路目标视频。
通过上述方式得到的至少两路目标视频中任意两路视频的IDR帧都是对齐的,因此,就可以保证视频在切换过程中的流畅性。
举例言之,某视频网站中默认两种清晰度,即分辨率为1080P的清晰度(也即,高清),或者分辨率为720P的清晰度(也即,标清)。假设,用户A选择在该视频网站中高清(即,1080P)播放名称为:“xx挑战第一期”的视频文件,其中,在视频文件在播放之前,已按照上述步骤S202至步骤S208中所描述的技术方案进行处理,得到了两路目标视频流,即分辨率为1080P的视频流和分辨率为720P的视频流。通过上述方法得到的分辨率为1080P的视频流和分辨率为720P的视频流两路目标视频流中,IDR帧的位置是对齐的。
如果在播放上述视频文件的过程中,由于网络的原因,导致视频在播放的过程中出现卡顿的现象,为了不影响播放的进度,可以将当前设置的高清播放手动或者自动调整为标清(即,720P)播放。由于播放的视频文件在播放之前已按照本申请实施例提供的方法进行处理,因此,转码之后的两路目标视频流中IDR帧的位置是对齐的,所以,在将播放高清视频流切换为播放标清视频流时,可以实现平滑切换,不会出现重复播放在切换之前已播放过的视频的现象。整体提高了视频播放的流畅性,提高了用户体验。
可选地,目标位置信息记录在状态文件中,其中,第一转码单元包括:转码模块,用于根据同一个状态文件中记录的目标位置信息,以并行的方式将源视频流转码成至少两路目标视频。
可选地,装置还包括:第二获取单元,用于在从待转码的源视频文件中获取源视频流时,从待转码的源视频文件中获取源音频流;装置还包括:第二转码单元,用于在从待转码的源视频文件中获取源音频流之后,将源音频流转码成至少一路目标音频流,并将至少一路目标音频流与至少两路目标视频流进行
封装,得到多个目标视频文件,其中,多个目标视频文件中的每个目标视频文件是通过对一路目标音频流和一路目标视频流进行封装得到的。
需要说明的是,上述源视频流是无声视频流,因此,还需将源视频流与源音频流进行封装,才能得到一个完整的视频文件(即,目标视频文件)。
通过上述实施例可知,获取到的源视频流是将源视频文件中的源视频流和源音频流进行分离得到的。那么,在本申请实施例中,同样要获取源音频流,也即是说,在对源视频文件进行分离时,在获取源视频流的同时,还要获取源音频流。并在获取源音频流之后,将获取到的源音频流转码成至少一路目标音频流,并将至少一路目标音频文件与至少两路源视频流进行封装,得到多个目标视频文件,其中,多个目标视频文件中的每个目标视频文件是通过对一路目标音频流和一路目标视频流进行封装得到的。
举例言之,在上述举例说明中可知,将源视频流转码得到分辨率为1080P的目标视频流和分辨率为720P的目标视频流。那么,还可以将从源视频文件中获取到的源音频流同样进行转码得到至少一路源音频流。
如果得到一路源音频流,则可以将该路元音频流分别与分辨率为1080P的目标视频流和分辨率为720P的目标视频流进行封装,得到分辨率为1080P的目标视频文件和分辨率为720P的目标视频文件。
如果得到两路源音频流,例如,A1和A2,则可以将A1分别与分辨率为1080P的目标视频流和分辨率为720P的目标视频流进行封装,得到分辨率为1080P的目标视频文件A11和分辨率为720P的目标视频文件A12;并将A2分别与分辨率为1080P的目标视频流和分辨率为720P的目标视频流进行封装,得到分辨率为1080P的目标视频文件A21和分辨率为720P的目标视频文件A22。也就是说,当得到两路源音频流时,得到的目标视频文件的数量为4个,同样地,当得到三路源音频流时,得到的目标视频文件的数量为6个。
可选地,处理单元包括:处理模块,用于采用配置的转码参数对源视频流进行预转码处理,得到目标位置信息,其中,转码参数包括分辨率和码控方式,分辨率低于预定值。
在本申请实施例中,终端可以按照配置的转码参数对源视频流进行预转码
处理,得到用于指示IDR帧的目标位置的目标位置信息,其中,IDR帧为任一个画面组GOP中的第一个I帧。也就是说,通过对源视频流进行预转码处理,可以得到任一个画面组GOP的第一个I帧的位置。上述转码参数包括视频流的分辨率和码控方式,分辨率低于预定值。
此处需要说明的是,上述模块与对应的步骤所实现的示例和应用场景相同,但不限于上述实施例所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在如图1所示的硬件环境中,可以通过软件实现,也可以通过硬件实现,其中,硬件环境包括网络环境。
根据本申请实施例,还提供了一种用于实施上述视频文件的转码方法的服务器或终端。
图8是根据本申请实施例的一种终端的结构框图,如图视频文件的转码所示,该终端可以包括:一个或多个(图中仅示出一个)处理器801、存储器803、以及传输装置805(如上述实施例中的发送装置),如图8所示,该终端还可以包括输入输出设备807。
其中,存储器803可用于存储软件程序以及模块,如本申请实施例中的视频文件的转码方法和装置对应的程序指令/模块,处理器801通过运行存储在存储器803内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的视频文件的转码方法。存储器803可包括高速随机存储器,还可以包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器803可进一步包括相对于处理器801远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
上述的传输装置805用于经由一个网络接收或者发送数据,还可以用于处理器与存储器之间的数据传输。上述的网络具体实例可包括有线网络及无线网络。在一个实例中,传输装置805包括一个网络适配器(Network Interface Controller,NIC),其可通过网线与其他网络设备与路由器相连从而可与互联网或局域网进行通讯。在一个实例中,传输装置805为射频(Radio Frequency,RF)模块,其用于通过无线方式与互联网进行通讯。
其中,具体地,存储器803用于存储应用程序。
处理器801可以通过传输装置805调用存储器803存储的应用程序,以执行下述步骤:
从待转码的源视频文件中获取源视频流;对源视频流进行预转码处理,得到目标位置信息,其中,目标位置信息用于指示IDR帧的目标位置;根据目标位置信息将源视频流转码成至少两路目标视频流,其中,至少两路目标视频流中的每路目标视频流中IDR帧的位置与目标位置对齐。
处理器801还用于执行下述步骤:将源视频流解码成原始视频数据;将原始视频数据中目标位置上的帧设置为IDR帧,并对原始视频数据中除目标位置之外的帧进行视频编码,得到一路目标视频流。
处理器801还用于执行下述步骤:根据同一个状态文件中记录的目标位置信息,以并行的方式将源视频流转码成至少两路目标视频。
处理器801还用于执行下述步骤:从待转码的源视频文件中获取源音频流;将源音频流转码成至少一路目标音频流,并将至少一路目标音频流与至少两路目标视频流进行封装,得到多个目标视频文件,其中,多个目标视频文件中的每个目标视频文件是通过对一路目标音频流和一路目标视频流进行封装得到的。
处理器801还用于执行下述步骤:采用配置的转码参数对源视频流进行预转码处理,得到目标位置信息,其中,转码参数包括分辨率和码控方式,分辨率低于预定值。
采用本申请实施例,首先对获取到源视频流进行预转码处理,根据处理之后的到的目标位置信息确定IDR帧的目标位置,然后,在获取到目标位置信息的基础上,将源视频流转码成不同分辨率的至少两路目标视频流,其中,至少两路目标视频流中每个目标视频流中的IDR帧的位置与目标位置对齐,因此,当视频在播放过程中,可以任意在目标视频流中进行切换,不会出现视频进行切换时重复播放的现象,达到了不同码流的视频流之间的平滑切换的目的,从而实现了视频播放过程中能够进行流畅切换的技术效果,进而解决了相关技术中视频在播放过程中切换不流畅的技术问题。
可选地,本实施例中的具体示例可以参考上述实施例中所描述的示例,本实施例在此不再赘述。
本领域普通技术人员可以理解,图8所示的结构仅为示意,终端可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌上电脑以及移动互联网设备(Mobile Internet Devices,MID)、PAD等终端设备。图8其并不对上述电子装置的结构造成限定。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(Random Access Memory,RAM)、磁盘或光盘等。
本申请的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以用于执行视频文件的转码方法的程序代码。
可选地,在本实施例中,上述存储介质可以位于上述实施例所示的网络中的多个网络设备中的至少一个网络设备上。
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:
S1,从待转码的源视频文件中获取源视频流;
S2,对源视频流进行预转码处理,得到目标位置信息,其中,目标位置信息用于指示IDR帧的目标位置;
S3,根据目标位置信息将源视频流转码成至少两路目标视频流,其中,至少两路目标视频流中的每路目标视频流中IDR帧的位置与目标位置对齐,位置对齐的IDR帧对应同一个视频画面。
可选地,本实施例中的具体示例可以参考上述实施例中所描述的示例,本实施例在此不再赘述。
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access
Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
上述实施例中的集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在上述计算机可读取的存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在存储介质中,包括若干指令用以使得一台或多台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。
在本申请的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
在本申请所提供的几个实施例中,应该理解到,所揭露的客户端,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
以上所述仅是本申请的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。
Claims (11)
- 一种视频文件的转码方法,其特征在于,包括:终端从待转码的源视频文件中获取源视频流;终端对所述源视频流进行预转码处理,得到目标位置信息,其中,所述目标位置信息用于指示IDR(instantaneous decoding refresh)帧的目标位置;以及终端根据所述目标位置信息将所述源视频流转码成至少两路目标视频流,其中,所述至少两路目标视频流中的每路目标视频流中IDR帧的位置与所述目标位置对齐,位置对齐的IDR帧对应同一个视频画面。
- 根据权利要求1所述的方法,其特征在于,终端根据所述目标位置信息将所述源视频流转码成至少两路目标视频流中的一路目标视频流包括:终端将所述源视频流解码成原始视频数据;以及终端将所述原始视频数据中所述目标位置上的帧设置为IDR帧,并对所述原始视频数据中除所述目标位置之外的帧进行视频编码,得到所述一路目标视频流。
- 根据权利要求1所述的方法,其特征在于,所述目标位置信息记录在状态文件中,其中,终端根据所述目标位置信息将所述源视频流转码成至少两路目标视频流包括:终端根据同一个所述状态文件中记录的所述目标位置信息,以并行的方式将所述源视频流转码成至少两路目标视频。
- 根据权利要求1所述的方法,其特征在于,在终端从所述待转码的源视频文件中获取所述源视频流时,所述方法还包括:终端从所述待转码的源视频文件中获取源音频流;在从所述待转码的源视频文件中获取源音频流之后,所述方法还包括:终端将所述源音频流转码成至少一路目标音频流,并将所述至少一路目标音频流与所述至少两路目标视频流进行封装,得到多个目标视频文件,其中,所述多个目标视频文件中的每个目标视频文件是通过对一路所述目标 音频流和一路所述目标视频流进行封装得到的。
- 根据权利要求1所述的方法,其特征在于,所述对所述源视频流进行预转码处理,得到目标位置信息包括:采用配置的转码参数对所述源视频流进行预转码处理,得到所述目标位置信息,其中,所述转码参数包括分辨率和码控方式,所述分辨率低于预定值。
- 一种视频文件的转码装置,其特征在于,包括:第一获取单元,用于从待转码的源视频文件中获取源视频流;处理单元,用于对所述源视频流进行预转码处理,得到目标位置信息,其中,所述目标位置信息用于指示IDR帧的目标位置;以及第一转码单元,用于根据所述目标位置信息将所述源视频流转码成至少两路目标视频流,其中,所述至少两路目标视频流中的每路目标视频流中IDR帧的位置与所述目标位置对齐,位置对齐的IDR帧对应同一个视频画面。
- 根据权利要求6所述的装置,其特征在于,所述第一转码单元根据所述目标位置信息将所述源视频流转码成至少两路目标视频流中的一路目标视频流包括:解码模块,用于将所述源视频流解码成原始视频数据;以及设置模块,用于将所述原始视频数据中所述目标位置上的帧设置为IDR帧,并对所述原始视频数据中除所述目标位置之外的帧进行视频编码,得到所述一路目标视频流。
- 根据权利要求6所述的装置,其特征在于,所述目标位置信息记录在状态文件中,其中,所述第一转码单元包括:转码模块,用于根据同一个所述状态文件中记录的所述目标位置信息,以并行的方式将所述源视频流转码成至少两路目标视频。
- 根据权利要求6所述的装置,其特征在于,所述装置还包括:第二获取单元,用于在从所述待转码的源视频文件中获取所述源视频流时,从所述待转码的源视频文件中获取源音频流;所述装置还包括:第二转码单元,用于在从所述待转码的源视频文件中获取源音频流之后,将所述源音频流转码成至少一路目标音频流,并将所述至少一路目标音频流与所述至少两路目标视频流进行封装,得到多个目标视频文件,其中,所述多个目标视频文件中的每个目标视频文件是通过对一路所述目标音频流和一路所述目标视频流进行封装得到的。
- 根据权利要求6所述的装置,其特征在于,所述处理单元包括:处理模块,用于采用配置的转码参数对所述源视频流进行预转码处理,得到所述目标位置信息,其中,所述转码参数包括分辨率和码控方式,所述分辨率低于预定值。
- 一种非易失性存储介质,用于存储一个或多个计算机程序,其中,所述计算机程序包括具有一个或多个存储器的处理器可运行的指令,所述指令被计算机执行时,使得所述计算机执行以下操作:从待转码的源视频文件中获取源视频流;对所述源视频流进行预转码处理,得到目标位置信息,其中,所述目标位置信息用于指示IDR帧的目标位置;以及根据所述目标位置信息将所述源视频流转码成至少两路目标视频流,其中,所述至少两路目标视频流中的每路目标视频流中IDR帧的位置与所述目标位置对齐,位置对齐的IDR帧对应同一个视频画面。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610550922.9A CN106210884B (zh) | 2016-07-13 | 2016-07-13 | 视频文件的转码方法和装置 |
CN201610550922.9 | 2016-07-13 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2018010662A1 true WO2018010662A1 (zh) | 2018-01-18 |
Family
ID=57478120
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2017/092615 WO2018010662A1 (zh) | 2016-07-13 | 2017-07-12 | 视频文件的转码方法,装置及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN106210884B (zh) |
WO (1) | WO2018010662A1 (zh) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111818338A (zh) * | 2020-07-23 | 2020-10-23 | 腾讯音乐娱乐科技(深圳)有限公司 | 一种异常显示检测方法、装置、设备及介质 |
CN111901631A (zh) * | 2020-07-30 | 2020-11-06 | 有半岛(北京)信息科技有限公司 | 一种直播视频的转码方法、装置、服务器和存储介质 |
CN111949825A (zh) * | 2020-08-21 | 2020-11-17 | 上海连尚网络科技有限公司 | 在视频中添加和显示物品信息的方法、电子设备及存储介质 |
CN114466246A (zh) * | 2022-02-14 | 2022-05-10 | 维沃移动通信有限公司 | 一种视频处理方法及其装置 |
CN115022670A (zh) * | 2022-05-31 | 2022-09-06 | 咪咕文化科技有限公司 | 视频文件存储方法、还原方法、装置、设备及存储介质 |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106210884B (zh) * | 2016-07-13 | 2019-02-26 | 腾讯科技(深圳)有限公司 | 视频文件的转码方法和装置 |
EP3393129A1 (en) * | 2017-04-21 | 2018-10-24 | Alcatel-Lucent España, S.A. | Multimedia content delivery with reduced delay |
CN107343218A (zh) * | 2017-05-24 | 2017-11-10 | 广东小天才科技有限公司 | 一种视频编码的方法及装置 |
CN110213615B (zh) * | 2018-04-04 | 2021-11-02 | 腾讯科技(深圳)有限公司 | 视频转码方法、装置、服务器以及存储介质 |
CN111246215A (zh) * | 2018-11-28 | 2020-06-05 | 深圳市炜博科技有限公司 | 一种视频格式转换的方法及终端 |
CN109640114A (zh) * | 2018-12-12 | 2019-04-16 | 深圳市网心科技有限公司 | 视频编转码压缩方法、装置、设备及计算机可读存储介质 |
CN110213617B (zh) * | 2019-04-01 | 2022-03-18 | 腾讯科技(深圳)有限公司 | 视频流转码迁移方法、装置和系统 |
US11128688B2 (en) * | 2019-10-16 | 2021-09-21 | Disney Enterprises, Inc. | Transcoder conditioning for segment fluidity |
CN114979713A (zh) * | 2022-06-06 | 2022-08-30 | 北京奇艺世纪科技有限公司 | 帧对齐方法、装置、计算机设备和存储介质 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0812112A2 (en) * | 1996-06-05 | 1997-12-10 | Sun Microsystems, Inc. | System and method for indexing between trick play and normal play video streams in a video delivery system |
CN102100069A (zh) * | 2008-07-16 | 2011-06-15 | 汤姆逊许可证公司 | 用于快速信道改变以增大编码效率的可分级视频编码方法 |
CN102938848A (zh) * | 2011-08-15 | 2013-02-20 | Rgb网络有限公司 | 瞬时解码器刷新帧对准的多位速率代码转换器输出 |
CN104754366A (zh) * | 2015-03-03 | 2015-07-01 | 腾讯科技(深圳)有限公司 | 音视频文件直播方法、装置和系统 |
CN104780389A (zh) * | 2015-04-21 | 2015-07-15 | 无锡天脉聚源传媒科技有限公司 | 一种视频处理方法及装置 |
CN106210884A (zh) * | 2016-07-13 | 2016-12-07 | 腾讯科技(深圳)有限公司 | 视频文件的转码方法和装置 |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102263941A (zh) * | 2010-05-31 | 2011-11-30 | 苏州闻道网络科技有限公司 | 一种视频文件的转码方法和装置 |
-
2016
- 2016-07-13 CN CN201610550922.9A patent/CN106210884B/zh active Active
-
2017
- 2017-07-12 WO PCT/CN2017/092615 patent/WO2018010662A1/zh active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0812112A2 (en) * | 1996-06-05 | 1997-12-10 | Sun Microsystems, Inc. | System and method for indexing between trick play and normal play video streams in a video delivery system |
CN102100069A (zh) * | 2008-07-16 | 2011-06-15 | 汤姆逊许可证公司 | 用于快速信道改变以增大编码效率的可分级视频编码方法 |
CN102938848A (zh) * | 2011-08-15 | 2013-02-20 | Rgb网络有限公司 | 瞬时解码器刷新帧对准的多位速率代码转换器输出 |
CN104754366A (zh) * | 2015-03-03 | 2015-07-01 | 腾讯科技(深圳)有限公司 | 音视频文件直播方法、装置和系统 |
CN104780389A (zh) * | 2015-04-21 | 2015-07-15 | 无锡天脉聚源传媒科技有限公司 | 一种视频处理方法及装置 |
CN106210884A (zh) * | 2016-07-13 | 2016-12-07 | 腾讯科技(深圳)有限公司 | 视频文件的转码方法和装置 |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111818338A (zh) * | 2020-07-23 | 2020-10-23 | 腾讯音乐娱乐科技(深圳)有限公司 | 一种异常显示检测方法、装置、设备及介质 |
CN111818338B (zh) * | 2020-07-23 | 2022-10-11 | 腾讯音乐娱乐科技(深圳)有限公司 | 一种异常显示检测方法、装置、设备及介质 |
CN111901631A (zh) * | 2020-07-30 | 2020-11-06 | 有半岛(北京)信息科技有限公司 | 一种直播视频的转码方法、装置、服务器和存储介质 |
CN111901631B (zh) * | 2020-07-30 | 2023-02-17 | 有半岛(北京)信息科技有限公司 | 一种直播视频的转码方法、装置、服务器和存储介质 |
CN111949825A (zh) * | 2020-08-21 | 2020-11-17 | 上海连尚网络科技有限公司 | 在视频中添加和显示物品信息的方法、电子设备及存储介质 |
CN111949825B (zh) * | 2020-08-21 | 2024-05-28 | 上海连尚网络科技有限公司 | 在视频中添加和显示物品信息的方法、电子设备及存储介质 |
CN114466246A (zh) * | 2022-02-14 | 2022-05-10 | 维沃移动通信有限公司 | 一种视频处理方法及其装置 |
CN115022670A (zh) * | 2022-05-31 | 2022-09-06 | 咪咕文化科技有限公司 | 视频文件存储方法、还原方法、装置、设备及存储介质 |
CN115022670B (zh) * | 2022-05-31 | 2023-09-05 | 咪咕文化科技有限公司 | 视频文件存储方法、还原方法、装置、设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN106210884B (zh) | 2019-02-26 |
CN106210884A (zh) | 2016-12-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2018010662A1 (zh) | 视频文件的转码方法,装置及存储介质 | |
US9514783B2 (en) | Video editing with connected high-resolution video camera and video cloud server | |
US10187668B2 (en) | Method, system and server for live streaming audio-video file | |
JP7011031B2 (ja) | クロマ予測方法及びデバイス | |
US9716737B2 (en) | Video streaming in a wireless communication system | |
US11412021B2 (en) | Method and device for media streaming between server and client using RTP/RTSP standard protocol | |
US8396004B2 (en) | Video share model-based video fixing | |
US20140219634A1 (en) | Video preview creation based on environment | |
CN110784718B (zh) | 视频数据编码方法、装置、设备和存储介质 | |
WO2021057697A1 (zh) | 视频编解码方法和装置、存储介质及电子装置 | |
US9877056B1 (en) | Compressed media with still images selected from a video stream | |
KR20150131175A (ko) | Http를 통한 동적 적응형 스트리밍에서 미디어 세그먼트들의 손실 존재시의 회복력 | |
US11968379B2 (en) | Video decoding method and apparatus, video encoding method and apparatus, storage medium, and electronic device | |
CA3057894C (en) | Video compression using down-sampling patterns in two phases | |
US10085029B2 (en) | Switching display devices in video telephony | |
US11943473B2 (en) | Video decoding method and apparatus, video encoding method and apparatus, storage medium, and electronic device | |
US9218848B1 (en) | Restructuring video streams to support random access playback | |
JP6193569B2 (ja) | 受信装置、受信方法、及びプログラム、撮像装置、撮像方法、及びプログラム、送信装置、送信方法、及びプログラム | |
JP6501127B2 (ja) | 情報処理装置および方法 | |
KR20160015123A (ko) | 클라우드 스트리밍 서비스 시스템, 스틸 이미지 기반 클라우드 스트리밍 서비스 방법 및 이를 위한 장치 | |
JP6483850B2 (ja) | データ処理方法および装置 | |
CN104780392A (zh) | 一种视频文件的转码方法及装置 | |
CN106954073B (zh) | 一种视频数据输入和输出方法、装置与系统 | |
CN113747099B (zh) | 视频传输方法和设备 | |
CN115379251A (zh) | 一种视频直播流的转码方法、装置、系统及可读存储介质 |
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: 17826998 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: 17826998 Country of ref document: EP Kind code of ref document: A1 |