Movatterモバイル変換


[0]ホーム

URL:


CN115720276A - A transcoding method, device, equipment and storage medium - Google Patents

A transcoding method, device, equipment and storage medium
Download PDF

Info

Publication number
CN115720276A
CN115720276ACN202211213450.XACN202211213450ACN115720276ACN 115720276 ACN115720276 ACN 115720276ACN 202211213450 ACN202211213450 ACN 202211213450ACN 115720276 ACN115720276 ACN 115720276A
Authority
CN
China
Prior art keywords
transcoding
block
data
transcoded
video file
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
CN202211213450.XA
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.)
Xunlei Computer Shenzhen Co Ltd
Original Assignee
Xunlei Computer Shenzhen 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 Xunlei Computer Shenzhen Co LtdfiledCriticalXunlei Computer Shenzhen Co Ltd
Priority to CN202211213450.XApriorityCriticalpatent/CN115720276A/en
Publication of CN115720276ApublicationCriticalpatent/CN115720276A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Landscapes

Abstract

Translated fromChinese

本申请涉及数据处理技术领域,公开了一种转码方法、装置、设备及存储介质,应用于转码节点服务器,包括:利用下载器从云端服务器中流式下载待转码视频文件并将下载数据加载至缓存空间;同时利用转码器对所述缓存空间中的下载数据进行流式转码,得到对应的目标数据;将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器。可见,本申请基于下载器对视频文件进行流式下载,同时基于转码器对下载到的数据进行流式转码,从而达到边下载边转码的效果,提高大文件的转码效率,且流式转码直接在缓存空间执行,能够节省存储空间。

Figure 202211213450

This application relates to the technical field of data processing, and discloses a transcoding method, device, device, and storage medium, which are applied to a transcoding node server, including: using a downloader to stream-download a video file to be transcoded from a cloud server and downloading the data Loading into the cache space; at the same time, using a transcoder to stream-transcode the downloaded data in the cache space to obtain corresponding target data; storing the target data in a local storage space, and reading from the local storage space Obtaining the target data to upload to the cloud server. It can be seen that this application performs streaming download of video files based on the downloader, and at the same time performs streaming transcoding on the downloaded data based on the transcoder, thereby achieving the effect of transcoding while downloading, improving the transcoding efficiency of large files, and Streaming transcoding is performed directly in the cache space, saving storage space.

Figure 202211213450

Description

Translated fromChinese
一种转码方法、装置、设备及存储介质A transcoding method, device, equipment and storage medium

技术领域technical field

本发明涉及数据处理技术领域,特别涉及一种转码方法、装置、设备及存储介质。The present invention relates to the technical field of data processing, in particular to a transcoding method, device, equipment and storage medium.

背景技术Background technique

现有的转码方案不支持流式转码,需要转码节点将源资源文件整体下载完后再统一转码,对并发量较高的转码场景很不友好。以云点播场景下的转码过程为例,转码节点下载完整个资源文件之后先写入本地存储,然后再从本地存储读取资源文件并进行整体转码,转码完成后再整体写入本地存储,最后从本地存储读取转码完成的文件后写入云中。对于大文件的转码,上述过程需要较大的本地存储。且需要多次向本地存储中进行多次写入操作和多次读取操作,磁盘IO及网络IO消化较大。必定导致转码效率及成功率较低,特别是大文件的转码表现更为突出。The existing transcoding solution does not support streaming transcoding, and requires transcoding nodes to download the source resource files as a whole and then transcode them uniformly, which is not friendly to transcoding scenarios with high concurrency. Taking the transcoding process in the cloud-on-demand scenario as an example, the transcoding node downloads the entire resource file and writes it to the local storage first, then reads the resource file from the local storage and performs overall transcoding, and then writes the entire resource file after transcoding is complete Local storage, and finally read the transcoded file from the local storage and write it to the cloud. For the transcoding of large files, the above process requires relatively large local storage. And it needs to perform multiple write operations and multiple read operations to the local storage, and the disk IO and network IO digestion is relatively large. It will inevitably lead to low transcoding efficiency and success rate, especially the transcoding performance of large files is more prominent.

因此,上述技术问题亟待本领域技术人员解决。Therefore, above-mentioned technical problems urgently need those skilled in the art to solve.

发明内容Contents of the invention

有鉴于此,本发明的目的在于提供一种转码方法、装置、设备及存储介质,能够提高大文件的转码效率及节省存储空间。其具体方案如下:In view of this, the object of the present invention is to provide a transcoding method, device, device and storage medium, which can improve the transcoding efficiency of large files and save storage space. The specific plan is as follows:

本申请的第一方面提供了一种转码方法,应用于转码节点服务器,包括:The first aspect of the present application provides a transcoding method applied to a transcoding node server, including:

利用下载器从云端服务器中流式下载待转码视频文件并将下载数据加载至缓存空间;Use the downloader to stream download the video file to be transcoded from the cloud server and load the downloaded data into the cache space;

同时利用转码器对所述缓存空间中的下载数据进行流式转码,得到对应的目标数据;At the same time, a transcoder is used to stream-transcode the downloaded data in the buffer space to obtain corresponding target data;

将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器。storing the target data in a local storage space, and reading the target data from the local storage space to upload to the cloud server.

可选的,所述转码方法,还包括:Optionally, the transcoding method also includes:

确定在所述云端服务器中存储的所述待转码视频文件的分块模式,并根据所述分块模式对所述待转码视频文件进行分块,得到多个块数据;Determining the block pattern of the video file to be transcoded stored in the cloud server, and block the video file to be transcoded according to the block pattern to obtain a plurality of block data;

相应的,利用下载器从云端服务器中流式下载待转码视频文件,同时利用转码器对下载数据进行流式转码,包括:Correspondingly, use the downloader to stream-download the video file to be transcoded from the cloud server, and use the transcoder to stream-transcode the downloaded data, including:

利用多个下载器从所述云端服务器中流式并发下载多个所述块数据,同时利用多个转码器对下载数据进行流式并发转码。Using a plurality of downloaders to stream and concurrently download a plurality of the block data from the cloud server, and simultaneously utilizing a plurality of transcoders to perform streaming and concurrent transcoding on the downloaded data.

可选的,所述确定在所述云端服务器中存储的所述待转码视频文件的分块模式,包括:Optionally, the determining the block mode of the video file to be transcoded stored in the cloud server includes:

获取所述待转码视频文件的视频头信息;其中,所述视频头信息至少包含所述待转码视频文件的帧率、码率;Obtain the video header information of the video file to be transcoded; wherein, the video header information includes at least the frame rate and code rate of the video file to be transcoded;

根据所述视频头信息及自身转码器支持的转码方式确定所述待转码视频文件的所述分块模式。The block mode of the video file to be transcoded is determined according to the video header information and the transcoding mode supported by its own transcoder.

可选的,利用多个转码器对下载数据进行流式并发转码之后,还包括:Optionally, after streaming and concurrent transcoding of the downloaded data by using multiple transcoders, it also includes:

为各个所述块数据创建相应的块索引,并将所述块索引存储至所述本地存储空间。A corresponding block index is created for each of the block data, and the block index is stored in the local storage space.

可选的,所述为各个所述块数据创建相应的块索引,包括:Optionally, creating corresponding block indexes for each of the block data includes:

计算所述待转码视频文件的文件标识符,并为所述待转码视频文件的各个所述块数据分配相应的块编号;calculating the file identifier of the video file to be transcoded, and assigning a corresponding block number to each of the block data of the video file to be transcoded;

创建至少包含所述文件标识符、所述块编号及所述块数据的转码状态的所述块索引。Creating the chunk index including at least the file identifier, the chunk number, and a transcoding status of the chunk data.

可选的,所述将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器,包括:Optionally, the storing the target data in a local storage space, and reading the target data from the local storage space to upload to the cloud server includes:

按照所述块数据的块编号顺序将转码成功的所述块数据对应的所述目标数据存储至所述本地存储空间;storing the target data corresponding to the successfully transcoded block data in the local storage space according to the sequence of the block numbers of the block data;

按照所述块数据的块编号顺序从所述本地存储空间读取存储的转码成功的所述块数据对应的所述目标数据以上传至所述云端服务器。Reading the target data corresponding to the block data that has been successfully transcoded from the local storage space according to the sequence of the block numbers of the block data to upload to the cloud server.

可选的,所述按照所述块数据的块编号顺序将转码成功的所述块数据对应的所述目标数据存储至所述本地存储空间之前,还包括:Optionally, before storing the target data corresponding to the successfully transcoded block data in the local storage space according to the sequence of block numbers of the block data, the method further includes:

对所述块索引中的所述块数据的转码状态进行校验;verifying the transcoding status of the block data in the block index;

如果所述转码状态表征所述块数据转码成功,则按照所述块数据的块编号顺序将转码成功的所述块数据对应的所述目标数据存储至所述本地存储空间;If the transcoding status indicates that the block data has been successfully transcoded, storing the target data corresponding to the successfully transcoded block data in the local storage space according to the sequence of block numbers of the block data;

如果所述转码状态表征所述块数据转码未完成,则继续对所述块数据进行流式下载及流式转码;If the transcoding state indicates that the transcoding of the block data is not completed, continue to stream download and stream transcode the block data;

如果所述转码状态表征所述块数据转码失败,则判定所述待转码视频文件转码失败。If the transcoding status indicates that the transcoding of the block data fails, it is determined that the transcoding of the video file to be transcoded fails.

本申请的第二方面提供了一种转码装置,应用于转码节点服务器,包括:The second aspect of the present application provides a transcoding device applied to a transcoding node server, including:

下载模块,用于利用下载器从云端服务器中流式下载待转码视频文件并将下载数据加载至缓存空间;The download module is used to stream download the video file to be transcoded from the cloud server by using the downloader and load the downloaded data into the cache space;

转码模块,用于同时利用转码器对所述缓存空间中的下载数据进行流式转码,得到对应的目标数据;A transcoding module, configured to simultaneously use a transcoder to stream-transcode the downloaded data in the cache space to obtain corresponding target data;

存储上传模块,用于将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器。The storage and uploading module is configured to store the target data in a local storage space, and read the target data from the local storage space to upload to the cloud server.

本申请的第三方面提供了一种电子设备,所述电子设备包括处理器和存储器;其中所述存储器用于存储计算机程序,所述计算机程序由所述处理器加载并执行以实现前述转码方法。The third aspect of the present application provides an electronic device, the electronic device includes a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to realize the aforementioned transcoding method.

本申请的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机可执行指令,所述计算机可执行指令被处理器加载并执行时,实现前述转码方法。The fourth aspect of the present application provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are loaded and executed by a processor, the aforementioned transcoding method is implemented .

本申请中,转码节点服务器先利用下载器从云端服务器中流式下载待转码视频文件并将下载数据加载至缓存空间;同时利用转码器对所述缓存空间中的下载数据进行流式转码,得到对应的目标数据;最后将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器。可见,本申请基于下载器对视频文件进行流式下载,同时基于转码器对下载到的数据进行流式转码,从而达到边下载边转码的效果,提高大文件的转码效率,且流式转码直接在缓存空间执行,能够节省存储空间。In this application, the transcoding node server first uses the downloader to stream-download the video file to be transcoded from the cloud server and loads the downloaded data into the cache space; code to obtain corresponding target data; finally store the target data in a local storage space, and read the target data from the local storage space to upload to the cloud server. It can be seen that this application performs streaming download of video files based on the downloader, and at the same time performs streaming transcoding on the downloaded data based on the transcoder, thereby achieving the effect of transcoding while downloading, improving the transcoding efficiency of large files, and Streaming transcoding is performed directly in the cache space, saving storage space.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention, and those skilled in the art can also obtain other drawings according to the provided drawings without creative work.

图1为本申请提供的一种转码方法流程图;FIG. 1 is a flowchart of a transcoding method provided by the present application;

图2为本申请提供的一种具体的转码方法流程图;FIG. 2 is a flow chart of a specific transcoding method provided by the present application;

图3为本申请提供的一种具体的分块模式确定方法流程图;FIG. 3 is a flow chart of a specific method for determining a block mode provided by the present application;

图4为本申请提供的一种具体的分块流式转码方法示意图;FIG. 4 is a schematic diagram of a specific block stream transcoding method provided by the present application;

图5为本申请提供的一种具体的分块流式转码方法流程图;FIG. 5 is a flow chart of a specific block stream transcoding method provided by the present application;

图6为本申请提供的一种具体的块索引方法流程图;FIG. 6 is a flow chart of a specific block indexing method provided by the present application;

图7为本申请提供的一种转码装置结构示意图;FIG. 7 is a schematic structural diagram of a transcoding device provided by the present application;

图8为本申请提供的一种转码电子设备结构图。FIG. 8 is a structural diagram of a transcoding electronic device provided by the present application.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

现有的转码方案不支持流式转码,需要转码节点将源资源文件整体下载完后再统一转码,对并发量较高的转码场景很不友好。以云点播场景下的转码过程为例,转码节点下载完整个资源文件之后先写入本地存储,然后再从本地存储读取资源文件并进行整体转码,转码完成后再整体写入本地存储,最后从本地存储读取转码完成的文件后写入云中。对于大文件的转码,上述过程需要较大的本地存储。且需要多次向本地存储中进行多次写入操作和多次读取操作,磁盘IO及网络IO消化较大。必定导致转码效率及成功率较低,特别是大文件的转码表现更为突出。针对上述技术缺陷,本申请提供一种转码方案,基于下载器对视频文件进行流式下载,同时基于转码器对下载到的数据进行流式转码,从而达到边下载边转码的效果,提高大文件的转码效率,且流式转码直接在缓存空间执行,能够节省存储空间。The existing transcoding solution does not support streaming transcoding, and requires transcoding nodes to download the source resource files as a whole and then transcode them uniformly, which is not friendly to transcoding scenarios with high concurrency. Taking the transcoding process in the cloud-on-demand scenario as an example, the transcoding node downloads the entire resource file and writes it to the local storage first, then reads the resource file from the local storage and performs overall transcoding, and then writes the entire resource file after transcoding is complete Local storage, and finally read the transcoded file from the local storage and write it to the cloud. For the transcoding of large files, the above process requires relatively large local storage. And it needs to perform multiple write operations and multiple read operations to the local storage, and the disk IO and network IO digestion is relatively large. It will inevitably lead to low transcoding efficiency and success rate, especially the transcoding performance of large files is more prominent. In view of the above-mentioned technical defects, this application provides a transcoding solution, which is based on the downloader for streaming downloading of video files, and at the same time based on the transcoder for streaming transcoding of the downloaded data, so as to achieve the effect of transcoding while downloading , improve the transcoding efficiency of large files, and stream transcoding is directly executed in the cache space, which can save storage space.

图1为本申请实施例提供的一种转码方法流程图。参见图1所示,该转码方法应用于转码节点服务器,包括:FIG. 1 is a flow chart of a transcoding method provided by an embodiment of the present application. As shown in Figure 1, the transcoding method is applied to the transcoding node server, including:

S11:利用下载器从云端服务器中流式下载待转码视频文件并将下载数据加载至缓存空间。S11: Utilize the downloader to stream download the video file to be transcoded from the cloud server and load the downloaded data into the cache space.

本实施例中,先利用下载器从云端服务器中流式下载待转码视频文件并将下载数据加载至缓存空间。其中,下载器可以是转码节点服务器上内置的下载器,也可以是外置下载器,所述转码节点服务器通过下发下载指令来控制下载器对所述待转码视频文件进行下载。所述云端服务器中一般包含多种类型的云,如阿里云、华为云、腾讯云及其他类型云,每种云上可能存储有多个且多个类型的文件,存储方式为对象存储,本实施例仅对云上存储的视频文件进行下载。为了能准确找到所述待转码视频文件,可以生携带所述待转码视频文件的存储地址等信息的下载指令。本实施例对此不进行限定。In this embodiment, firstly, the video file to be transcoded is downloaded from the cloud server by using the downloader, and the downloaded data is loaded into the cache space. Wherein, the downloader may be a built-in downloader on the transcoding node server, or an external downloader, and the transcoding node server may control the downloader to download the video file to be transcoded by issuing a download instruction. The cloud server generally includes multiple types of clouds, such as Alibaba Cloud, Huawei Cloud, Tencent Cloud and other types of clouds. Each cloud may store multiple and multiple types of files, and the storage method is object storage. This Embodiments only download video files stored on the cloud. In order to accurately find the video file to be transcoded, a download instruction carrying information such as a storage address of the video file to be transcoded may be generated. This embodiment does not limit it.

本实施例中,下载器支持流式下载,即下载器从所述云端服务器中下载所述待转码视频文件的方式是流式下载。流式下载是一种边下载边播放的下载方式,在本实施例中是边下载边转码。当下载的文件太大或者一次性下载耗时太长时,可以通过流式下载,一次处理部分内容,直到完成文件的下载。In this embodiment, the downloader supports streaming download, that is, the downloader downloads the video file to be transcoded from the cloud server by streaming download. Streaming downloading is a downloading mode of playing while downloading, and transcoding while downloading in this embodiment. When the downloaded file is too large or takes too long to download at one time, you can process part of the content at a time through streaming download until the file download is complete.

本实施例中,在对所述待转码视频文件进行流式下载的同时,将即时下载的数据加载至缓存空间。所述缓存空间为所述转码节点服务器的内存,直接将待转码视频文件的流式下载至所述转码节点服务器的缓存空间中,而无需存储至本地内存,节省了磁盘IO。In this embodiment, while the video file to be transcoded is stream-downloaded, the data downloaded immediately is loaded into the cache space. The cache space is the memory of the transcoding node server, and the video file to be transcoded is directly downloaded to the cache space of the transcoding node server without storing in the local memory, which saves disk IO.

S12:同时利用转码器对所述缓存空间中的下载数据进行流式转码,得到对应的目标数据。S12: At the same time, use a transcoder to perform streaming transcoding on the downloaded data in the buffer space to obtain corresponding target data.

本实施例中,在利用下载器从所述云端服务器中流式下载所述待转码视频文件并将下载数据加载至缓存空间中的同时,利用转码器对所述缓存空间中的下载数据进行流式转码,得到对应的目标数据。转码器为所述转码节点服务器中内置的转码器,可以直接在所述转码节点服务器的内存中进行转码,提高了转码效率。且上述转码器支持流式转码,对存储至缓存空间的下载数据进行流式即时转码,例如,下载器进行逐字节下载并存储,同时转码器相应进行逐字节转码,整个过程是流式的,无需等待整个所述待转码视频文件下载完成再进行转码。In this embodiment, while the video file to be transcoded is stream-downloaded from the cloud server by the downloader and the downloaded data is loaded into the cache space, the downloaded data in the cache space is processed by the transcoder Stream transcoding to get the corresponding target data. The transcoder is a built-in transcoder in the transcoding node server, which can directly perform transcoding in the memory of the transcoding node server, thereby improving transcoding efficiency. Moreover, the transcoder above supports streaming transcoding, and performs streaming real-time transcoding on the downloaded data stored in the cache space. For example, the downloader downloads and stores byte by byte, and at the same time, the transcoder performs byte-by-byte transcoding accordingly. The whole process is streaming, and there is no need to wait for the entire video file to be transcoded to be downloaded before transcoding.

可以理解,转码后得到的转码数据也就是所述目标数据,所述目标数据在缓存空间中的存储顺序可以按照未转码前的字节顺序进行排列。It can be understood that the transcoded data obtained after transcoding is also the target data, and the storage sequence of the target data in the buffer space may be arranged according to the byte sequence before transcoding.

S13:将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器。S13: Store the target data in a local storage space, and read the target data from the local storage space to upload to the cloud server.

本实施例中,转码完成之后,便可以将所述目标数据存储至本地存储空间。本地存储可以为机械硬盘HDD或者云盘等存储设备。需要说明的是,所述目标数据是流式转码对应的转码后数据,多个所述目标数据拼接即可得到整个所述待转码视频文件的转码后数据。在将转码后数据从缓存空间存储至本地存储空间时,可以将即时生成的转码后数据,即所述目标数据单独存储至本地存储空间,也可以等待所述待转码视频文件全部转码完成后将所述目标数据拼接得到的整个所述待转码视频文件的转码后数据一起存储至本地存储空间。本实施例对此不进行限定。In this embodiment, after the transcoding is completed, the target data can be stored in the local storage space. Local storage can be a storage device such as a mechanical hard disk HDD or a cloud disk. It should be noted that the target data is transcoded data corresponding to streaming transcoding, and multiple pieces of target data can be spliced to obtain the transcoded data of the entire video file to be transcoded. When storing the transcoded data from the cache space to the local storage space, the instantly generated transcoded data, that is, the target data may be stored separately in the local storage space, or it may wait for all the video files to be transcoded to be transcoded. After the encoding is completed, the transcoded data of the entire video file to be transcoded obtained by splicing the target data is stored together in the local storage space. This embodiment does not limit it.

本实施例中,最后一步是将从所述本地存储空间读取所述目标数据以上传至所述云端服务器,至此客户端便可以对所述云端服务器中的转码后的所述待转码视频文件进行云点播。同样的,从所述本地存储空间读取所述目标数据时,可以单独读取所述目标数据,并单独上传至所述云端服务器,此时需要按照未解码数据在所述待转码视频文件中的位置对各个所述目标数据进行排序存储。也可以等待本地存储中存储了整个所述待转码视频文件的转码后数据之后,将其整个读取出来,并上传至所述云端服务器。In this embodiment, the last step is to read the target data from the local storage space and upload it to the cloud server, so that the client can perform the transcoding in the cloud server on the to-be-transcoded Video files are cloud-on-demand. Similarly, when reading the target data from the local storage space, the target data can be read separately and uploaded to the cloud server separately. The positions in the target data are sorted and stored. It is also possible to wait for the entire transcoded data of the video file to be transcoded to be stored in the local storage, read it out, and upload it to the cloud server.

可见,本申请实施例的转码节点服务器先利用下载器从云端服务器中流式下载待转码视频文件并将下载数据加载至缓存空间;同时利用转码器对所述缓存空间中的下载数据进行流式转码,得到对应的目标数据;最后将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器。本申请实施例基于下载器对视频文件进行流式下载,同时基于转码器对下载到的数据进行流式转码,从而达到边下载边转码的效果,提高大文件的转码效率,且流式转码直接在缓存空间执行,能够节省存储空间。It can be seen that the transcoding node server in the embodiment of the present application first uses the downloader to stream-download the video file to be transcoded from the cloud server and loads the downloaded data into the cache space; Stream transcoding to obtain corresponding target data; finally storing the target data in a local storage space, and reading the target data from the local storage space to upload to the cloud server. In the embodiment of the present application, the video file is stream-downloaded based on the downloader, and at the same time, the downloaded data is stream-transcoded based on the transcoder, so as to achieve the effect of transcoding while downloading and improve the transcoding efficiency of large files, and Streaming transcoding is performed directly in the cache space, saving storage space.

图2为本申请实施例提供的一种具体的转码方法流程图。参见图2所示,该转码方法应用于转码节点服务器,包括:FIG. 2 is a flow chart of a specific transcoding method provided by the embodiment of the present application. As shown in Figure 2, the transcoding method is applied to the transcoding node server, including:

S21:确定在云端服务器中存储的待转码视频文件的分块模式,并根据所述分块模式对所述待转码视频文件进行分块,得到多个块数据。S21: Determine the block pattern of the video file to be transcoded stored in the cloud server, and block the video file to be transcoded according to the block pattern to obtain multiple block data.

本实施例中,为了进一步提高流式下载及转码效率,可以对所述待转码视频文件进行分块,从而对分块后的数据进行并发下载及转码。为此,首先需要确定出在云端服务器中存储的待转码视频文件的分块模式,不同的待转码视频文件可能对应不同的分块模式,所述分块模式也即下载器支持的下载模式。例如,按照帧数下载或者按照字节范围下载。In this embodiment, in order to further improve streaming download and transcoding efficiency, the video file to be transcoded may be divided into blocks, so that the divided data can be downloaded and transcoded concurrently. To this end, it is first necessary to determine the block mode of the video file to be transcoded stored in the cloud server. Different video files to be transcoded may correspond to different block modes. The block mode is also the download supported by the downloader. model. For example, download by frame number or download by byte range.

本实施例中,在确定出所述待转码视频文件对应的所述分块模式之后,就可以进行分块了,主要根据所述分块模式对所述待转码视频文件进行分块,得到多个块数据。例如,当所述分块模式为按照帧数时,可以每隔100帧进行一次分块,当所述分块模式为按照字节范围时,可以每隔100个字节进行一次分块。本实施例对此不进行限定。In this embodiment, after the block mode corresponding to the video file to be transcoded is determined, it can be divided into blocks, and the video file to be transcoded is mainly divided into blocks according to the block mode, Get multiple blocks of data. For example, when the block mode is based on frame number, block may be performed every 100 frames, and when the block mode is based on byte range, block may be performed every 100 bytes. This embodiment does not limit it.

本实施例中确定所述分块模式的过程具体包括下述步骤(如图3所示):The process of determining the block mode in this embodiment specifically includes the following steps (as shown in Figure 3):

S211:获取所述待转码视频文件的视频头信息;其中,所述视频头信息至少包含所述待转码视频文件的帧率、码率;S211: Obtain video header information of the video file to be transcoded; wherein, the video header information includes at least a frame rate and a code rate of the video file to be transcoded;

S212:根据所述视频头信息及自身转码器支持的转码方式确定所述待转码视频文件的所述分块模式。S212: Determine the block mode of the video file to be transcoded according to the video header information and the transcoding mode supported by its own transcoder.

本实施例中,在分块时,先获取所述待转码视频文件的视频头信息。其中,所述视频头信息中至少包含所述待转码视频文件的帧率、码率。然后根据所述视频头信息及自身转码器支持的转码方式确定所述待转码视频文件的所述分块模式。In this embodiment, when dividing into blocks, the video header information of the video file to be transcoded is acquired first. Wherein, the video header information includes at least the frame rate and code rate of the video file to be transcoded. Then determine the block mode of the video file to be transcoded according to the video header information and the transcoding mode supported by its own transcoder.

具体的,分块前所述转码节点服务器需要并发从所述云端服务器的对象存储中获取所述待转码视频文件的视频头,视频头可能是文件头也可能是文件尾。所述转码节点服务器需要根据不同视频格式从文件头或文件尾请求相应字节的数据分析,然后根据视频头信息进行数据分片,也即根据转码器的要求进行分块。Specifically, the transcoding node server needs to concurrently obtain the video header of the video file to be transcoded from the object storage of the cloud server before splitting into blocks, and the video header may be a file header or a file trailer. The transcoding node server needs to request data analysis of corresponding bytes from the file header or file tail according to different video formats, and then perform data segmentation according to the video header information, that is, perform segmentation according to the requirements of the transcoder.

S22:利用多个下载器从所述云端服务器中流式并发下载多个所述块数据。S22: Utilize multiple downloaders to concurrently download multiple blocks of data from the cloud server.

S23:同时利用多个转码器对下载数据进行流式并发转码,得到对应的目标数据。S23: Simultaneously use multiple transcoders to perform streaming concurrent transcoding on the downloaded data to obtain corresponding target data.

本实施例中,在对所述转码视频文件进行分块的基础上,便可以进一步对所述转码视频文件进行并发流式下载及并发流式转码。并发流式下载和并发流式转码需要借助多个下载器和多个转码器。具体的,利用多个下载器从所述云端服务器中流式并发下载多个所述块数据,同时利用多个转码器对下载数据进行流式并发转码,得到对应的目标数据。可以理解,下载时是按照分块起始位置并发下载数据的,转码时同一时间可以多块并行转,对于单个块数据的流式转码来说,是逐个字节地转。对所述待转码视频文件进行分块是为了提升转码的并发能力。具体如图4所示。In this embodiment, on the basis of dividing the transcoded video file into blocks, concurrent streaming download and concurrent streaming transcoding can be further performed on the transcoded video file. Concurrent streaming downloads and concurrent streaming transcoding require multiple downloaders and multiple transcoders. Specifically, a plurality of downloaders are used to concurrently download a plurality of pieces of block data from the cloud server, and a plurality of transcoders are used to concurrently transcode the downloaded data in a streaming manner to obtain corresponding target data. It can be understood that when downloading, the data is downloaded concurrently according to the starting position of the blocks. When transcoding, multiple blocks can be converted in parallel at the same time. For streaming transcoding of a single block of data, it is converted byte by byte. The purpose of dividing the video file to be transcoded into blocks is to improve the concurrency capability of transcoding. Specifically shown in Figure 4.

S24:将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器。S24: Store the target data in a local storage space, and read the target data from the local storage space to upload to the cloud server.

本实施例中,关于上述步骤S24的具体过程,可以参考前述实施例中公开的相应内容,在此不再进行赘述。In this embodiment, for the specific process of the above step S24, reference may be made to the corresponding content disclosed in the foregoing embodiments, and details are not repeated here.

可见,本申请实施例先确定在云端服务器中存储的待转码视频文件的分块模式,并根据所述分块模式对所述待转码视频文件进行分块,得到多个块数据。然后利用多个下载器从所述云端服务器中流式并发下载多个所述块数据,同时利用多个转码器对下载数据进行流式并发转码,得到对应的目标数据。最后将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器。本申请实施例的所述转码节点服务器支持分块流式转码,可以并发按块流式下载数据的同时并发按块流式转码。按块流式下载及转码,从成本角度考虑,可以节省更多存储,从效率角度考虑,能大大提升转码效率,降低只能使用原画播放产生的带宽成本。It can be seen that in the embodiment of the present application, the block mode of the video file to be transcoded stored in the cloud server is determined first, and the video file to be transcoded is divided into blocks according to the block mode to obtain multiple block data. Then, a plurality of downloaders are used to concurrently download a plurality of block data from the cloud server, and a plurality of transcoders are used to concurrently transcode the downloaded data to obtain corresponding target data. Finally, the target data is stored in a local storage space, and the target data is read from the local storage space to upload to the cloud server. The transcoding node server in the embodiment of the present application supports block-by-block streaming transcoding, and can perform concurrent block-by-block streaming transcoding while concurrently downloading data by block. Streaming download and transcoding by block, from the perspective of cost, can save more storage. From the perspective of efficiency, it can greatly improve the efficiency of transcoding and reduce the bandwidth cost caused by only using the original picture to play.

图5为本申请实施例提供的一种具体的转码方法流程图。参见图5所示,该转码方法应用于转码节点服务器,包括:FIG. 5 is a flow chart of a specific transcoding method provided by the embodiment of the present application. As shown in Figure 5, the transcoding method is applied to the transcoding node server, including:

S31:确定在云端服务器中存储的待转码视频文件的分块模式,并根据所述分块模式对所述待转码视频文件进行分块,得到多个块数据。S31: Determine the block pattern of the video file to be transcoded stored in the cloud server, and block the video file to be transcoded according to the block pattern to obtain multiple block data.

S32:利用多个下载器从所述云端服务器中流式并发下载多个所述块数据。S32: Utilize multiple downloaders to concurrently download multiple blocks of data from the cloud server.

S33:同时利用多个转码器对下载数据进行流式并发转码。S33: Use multiple transcoders to perform streaming concurrent transcoding on the downloaded data.

本实施例中,关于上述步骤S31至步骤S33的具体过程,可以参考前述实施例中公开的相应内容,在此不再进行赘述。In this embodiment, regarding the specific process of the above step S31 to step S33, reference may be made to the corresponding content disclosed in the foregoing embodiments, and details are not repeated here.

S34:计算所述待转码视频文件的文件标识符,并为所述待转码视频文件的各个所述块数据分配相应的块编号。S34: Calculate the file identifier of the video file to be transcoded, and assign a corresponding block number to each block data of the video file to be transcoded.

S35:创建至少包含所述文件标识符、所述块编号及所述块数据的转码状态的块索引。S35: Create a block index including at least the file identifier, the block number, and the transcoding status of the block data.

本实施例中,在转码完成之后,需要进一步为各个所述块数据创建相应的块索引,并将所述块索引存储至所述本地存储空间。具体的,先计算所述待转码视频文件的文件标识符,并为所述待转码视频文件的各个所述块数据分配相应的块编号。其中,所述文件标识符为gcid或md5,所述块编号为块id如0、1等。完成后需要聚合计算目标码率文件的gcid(纯内存聚合,不涉及增加磁盘存储)。然后创建至少包含所述文件标识符、所述块编号及所述块数据的转码状态的块索引。本地分块索引结构示例如下:In this embodiment, after the transcoding is completed, it is necessary to further create a corresponding block index for each of the block data, and store the block index in the local storage space. Specifically, the file identifier of the video file to be transcoded is calculated first, and a corresponding block number is assigned to each block data of the video file to be transcoded. Wherein, the file identifier is gcid or md5, and the block number is block id such as 0, 1 and so on. After the completion, it is necessary to aggregate and calculate the gcid of the target bit rate file (pure memory aggregation, does not involve increasing disk storage). Then create a chunk index including at least the file identifier, the chunk number, and the transcoding status of the chunk data. An example of a local block index structure is as follows:

文件名:gcidFile name: gcid

内容(类似ts头文件):Content (similar to ts header file):

Block-num:xx//分块数Block-num: xx//Number of blocks

Gcdi_00_offset:0-1024//第0块的源文件起始offsetGcdi_00_offset:0-1024//The source file start offset of the 0th block

………………

Gcdi_00_ret:finish//第0块转码状态Gcdi_00_ret:finish//Transcoding status of the 0th block

…………………………

S36:按照所述块数据的块编号顺序将转码成功的所述块数据对应的所述目标数据存储至所述本地存储空间。S36: Store the target data corresponding to the successfully transcoded block data in the local storage space according to the sequence of the block numbers of the block data.

本实施例中,所述转码状态包括转码成功、转码未完成和转码失败,哪些块数据是转码成功的可以根据所述转码状态知晓。由于本地存储只存转码成功的相应块,因此在将所述目标数据存储至所述本地存储空间时,主要按照所述块数据的块编号顺序将转码成功的所述块数据对应的所述目标数据存储至所述本地存储空间。具体包括下述步骤(如图6所示):In this embodiment, the transcoding status includes transcoding successful, transcoding incomplete, and transcoding failed, and which block data is successfully transcoded can be known according to the transcoding status. Since the local storage only stores the corresponding blocks that have been successfully transcoded, when the target data is stored in the local storage space, all the corresponding blocks of the successfully transcoded data are mainly in accordance with the block numbers of the block data. The target data is stored in the local storage space. Specifically include the following steps (as shown in Figure 6):

S361:对所述块索引中的所述块数据的转码状态进行校验。S361: Verify the transcoding status of the block data in the block index.

S362:如果所述转码状态表征所述块数据转码成功,则按照所述块数据的块编号顺序将转码成功的所述块数据对应的所述目标数据存储至所述本地存储空间。S362: If the transcoding status indicates that the block data is successfully transcoded, store the target data corresponding to the successfully transcoded block data in the local storage space according to the sequence of block numbers of the block data.

S363:如果所述转码状态表征所述块数据转码未完成,则继续对所述块数据进行流式下载及流式转码;S363: If the transcoding state indicates that the transcoding of the block data is not completed, continue to stream download and stream transcode the block data;

S364:如果所述转码状态表征所述块数据转码失败,则判定所述待转码视频文件转码失败。S364: If the transcoding status indicates that the transcoding of the block data fails, determine that the transcoding of the video file to be transcoded fails.

本实施例中,转存之前,先对所述块索引中的所述块数据的转码状态进行校验。校验只会校验并行块是否转码完成和成功,如果所述转码状态表征所述块数据转码成功,则按照所述块数据的块编号顺序将转码成功的所述块数据对应的所述目标数据存储至所述本地存储空间。另外,如果成功还会更新本地分块索引。In this embodiment, before dumping, the transcoding status of the block data in the block index is checked first. The verification will only verify whether the transcoding of the parallel block is completed and successful. If the transcoding status indicates that the block data is successfully transcoded, the block data that has been successfully transcoded will be corresponding to the block number sequence of the block data. The target data of is stored in the local storage space. In addition, if successful, the local block index will be updated.

如果所述转码状态表征所述块数据转码未完成,则继续对所述块数据进行流式下载及流式转码。也即如果当前块未转完停止重启后会重新转码当前块。当从对象存储取数据遇到网络或其它不可预知问题时,重新触发转码还能过本地存储的块索引续转未转码的块。If the transcoding status indicates that the transcoding of the block data is not completed, continue to perform streaming download and streaming transcoding of the block data. That is, if the current block is not finished transcoding, it will re-transcode the current block after stopping and restarting. When retrieving data from object storage encounters network or other unpredictable problems, re-triggering transcoding can also continue transcoding untranscoded blocks through the block index of local storage.

如果所述转码状态表征所述块数据转码失败,则判定所述待转码视频文件转码失败。也即如果转码失败则标记整个文件转码失败(避免重复转)。If the transcoding status indicates that the transcoding of the block data fails, it is determined that the transcoding of the video file to be transcoded fails. That is, if the transcoding fails, the entire file will be marked as transcoding failed (to avoid repeated transcoding).

S37:按照所述块数据的块编号顺序从所述本地存储空间读取存储的转码成功的所述块数据对应的所述目标数据以上传至所述云端服务器。S37: Read the stored target data corresponding to the block data that has been successfully transcoded from the local storage space according to the sequence of the block numbers of the block data, and upload it to the cloud server.

本实施例中,最终按照所述块数据的块编号顺序从所述本地存储空间读取存储的转码成功的所述块数据对应的所述目标数据以上传至所述云端服务器。本地按块索引及存储,索引用源文件id(gcid/md5)+块id记录相应的原始文件offset,同时按块存储转码完成的块,全部转完后,按块id顺序将所有转码块数据上传到相应云存储,同时计算转码后id插入转码索引库提供客户端消费。In this embodiment, the target data corresponding to the block data that has been successfully transcoded is read from the local storage space according to the sequence of the block numbers of the block data, and uploaded to the cloud server. Locally index and store by block, the index uses the source file id (gcid/md5) + block id to record the corresponding original file offset, and at the same time store the transcoded blocks by block. The block data is uploaded to the corresponding cloud storage, and at the same time, the id after calculation and transcoding is inserted into the transcoding index library for client consumption.

可见,本申请实施例先确定在云端服务器中存储的待转码视频文件的分块模式,并根据所述分块模式对所述待转码视频文件进行分块,得到多个块数据。然后利用多个下载器从所述云端服务器中流式并发下载多个所述块数据,同时利用多个转码器对下载数据进行流式并发转码,得到对应的目标数据。在此基础上,计算所述待转码视频文件的文件标识符,并为所述待转码视频文件的各个所述块数据分配相应的块编号,以及创建至少包含所述文件标识符、所述块编号及所述块数据的转码状态的块索引。写入时,按照所述块数据的块编号顺序将转码成功的所述块数据对应的所述目标数据存储至所述本地存储空间。读取时,按照所述块数据的块编号顺序从所述本地存储空间读取存储的转码成功的所述块数据对应的所述目标数据以上传至所述云端服务器。本申请实施例中的本地存储支持块索引,能大大降低网络或其它异常导致的重复转码,同时能大大降低本地存储碎片,提升IO读写效率。It can be seen that in the embodiment of the present application, the block mode of the video file to be transcoded stored in the cloud server is determined first, and the video file to be transcoded is divided into blocks according to the block mode to obtain multiple block data. Then, a plurality of downloaders are used to concurrently download a plurality of block data from the cloud server, and a plurality of transcoders are used to concurrently transcode the downloaded data to obtain corresponding target data. On this basis, calculate the file identifier of the video file to be transcoded, assign a corresponding block number to each of the block data of the video file to be transcoded, and create an A block index for the block number and the transcoding status of the block data. When writing, the target data corresponding to the successfully transcoded block data is stored in the local storage space according to the block number sequence of the block data. When reading, the target data corresponding to the stored block data that has been successfully transcoded is read from the local storage space according to the sequence of the block numbers of the block data, and uploaded to the cloud server. The local storage in the embodiment of the present application supports block indexing, which can greatly reduce repeated transcoding caused by network or other abnormalities, and at the same time greatly reduce local storage fragmentation and improve IO read and write efficiency.

参见图7所示,本申请实施例还相应公开了一种转码装置,应用于转码节点服务器,包括:Referring to Figure 7, the embodiment of the present application also discloses a transcoding device correspondingly, which is applied to a transcoding node server, including:

下载模块11,用于利用下载器从云端服务器中流式下载待转码视频文件并将下载数据加载至缓存空间;Download module 11, is used for utilizing downloader to stream download video file to be transcoded from cloud server and load download data to cache space;

转码模块12,用于同时利用转码器对所述缓存空间中的下载数据进行流式转码,得到对应的目标数据;Thetranscoding module 12 is used to simultaneously utilize a transcoder to stream-transcode the downloaded data in the cache space to obtain corresponding target data;

存储上传模块13,用于将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器。The storage anduploading module 13 is configured to store the target data in a local storage space, and read the target data from the local storage space to upload to the cloud server.

可见,本申请实施例的转码节点服务器先利用下载器从云端服务器中流式下载待转码视频文件并将下载数据加载至缓存空间;同时利用转码器对所述缓存空间中的下载数据进行流式转码,得到对应的目标数据;最后将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器。本申请实施例基于下载器对视频文件进行流式下载,同时基于转码器对下载到的数据进行流式转码,从而达到边下载边转码的效果,提高大文件的转码效率,且流式转码直接在缓存空间执行,能够节省存储空间。It can be seen that the transcoding node server in the embodiment of the present application first uses the downloader to stream-download the video file to be transcoded from the cloud server and loads the downloaded data into the cache space; Stream transcoding to obtain corresponding target data; finally storing the target data in a local storage space, and reading the target data from the local storage space to upload to the cloud server. In the embodiment of the present application, the video file is stream-downloaded based on the downloader, and at the same time, the downloaded data is stream-transcoded based on the transcoder, so as to achieve the effect of transcoding while downloading and improve the transcoding efficiency of large files, and Streaming transcoding is performed directly in the cache space, saving storage space.

在一些具体实施例中,所述转码装置还包括:In some specific embodiments, the transcoding device further includes:

分块模块,用于确定在所述云端服务器中存储的所述待转码视频文件的分块模式,并根据所述分块模式对所述待转码视频文件进行分块,得到多个块数据;A block module, configured to determine the block pattern of the video file to be transcoded stored in the cloud server, and block the video file to be transcoded according to the block pattern to obtain multiple blocks data;

相应的,所述下载模块11,具体用于利用多个下载器从所述云端服务器中流式并发下载多个所述块数据;Correspondingly, thedownload module 11 is specifically configured to use multiple downloaders to concurrently download multiple pieces of block data from the cloud server;

所述转码模块12,具体用于同时利用多个转码器对下载数据进行流式并发转码。Thetranscoding module 12 is specifically configured to concurrently transcode the downloaded data in stream mode by using multiple transcoders at the same time.

在一些具体实施例中,所述分块模块,具体包括:In some specific embodiments, the block module specifically includes:

视频头获取单元,用于获取所述待转码视频文件的视频头信息;其中,所述视频头信息至少包含所述待转码视频文件的帧率、码率;A video header acquisition unit, configured to acquire video header information of the video file to be transcoded; wherein, the video header information includes at least the frame rate and code rate of the video file to be transcoded;

分块模式确定单元,用于根据所述视频头信息及自身转码器支持的转码方式确定所述待转码视频文件的所述分块模式;A block mode determining unit, configured to determine the block mode of the video file to be transcoded according to the video header information and the transcoding mode supported by its own transcoder;

分块单元,用于根据所述分块模式对所述待转码视频文件进行分块,得到多个块数据。A block unit, configured to block the video file to be transcoded according to the block mode to obtain a plurality of block data.

在一些具体实施例中,所述转码装置还包括:In some specific embodiments, the transcoding device further includes:

索引创建模块,用于为各个所述块数据创建相应的块索引,并将所述块索引存储至所述本地存储空间;an index creation module, configured to create a corresponding block index for each of the block data, and store the block index in the local storage space;

索引存储模块,用于将所述块索引存储至所述本地存储空间。An index storage module, configured to store the block index in the local storage space.

在一些具体实施例中,所述索引创建模块,具体包括:In some specific embodiments, the index creation module specifically includes:

计算及分配单元,用于计算所述待转码视频文件的文件标识符,并为所述待转码视频文件的各个所述块数据分配相应的块编号;A calculation and allocation unit, configured to calculate the file identifier of the video file to be transcoded, and assign a corresponding block number to each of the block data of the video file to be transcoded;

创建单元,用于创建至少包含所述文件标识符、所述块编号及所述块数据的转码状态的所述块索引。A creating unit, configured to create the block index including at least the file identifier, the block number, and the transcoding status of the block data.

在一些具体实施例中,所述存储上传模块13,具体包括:In some specific embodiments, the storage anduploading module 13 specifically includes:

数据存储单元,用于按照所述块数据的块编号顺序将转码成功的所述块数据对应的所述目标数据存储至所述本地存储空间;A data storage unit, configured to store the target data corresponding to the successfully transcoded block data in the local storage space according to the sequence of block numbers of the block data;

数据上传单元,用于按照所述块数据的块编号顺序从所述本地存储空间读取存储的转码成功的所述块数据对应的所述目标数据以上传至所述云端服务器。A data uploading unit, configured to read from the local storage space the target data corresponding to the block data that has been successfully transcoded according to the sequence of the block numbers of the block data, and upload it to the cloud server.

在一些具体实施例中,所述转码装置还包括:In some specific embodiments, the transcoding device further includes:

校验模块,用于对所述块索引中的所述块数据的转码状态进行校验;如果所述转码状态表征所述块数据转码成功,则按照所述块数据的块编号顺序将转码成功的所述块数据对应的所述目标数据存储至所述本地存储空间;如果所述转码状态表征所述块数据转码未完成,则继续对所述块数据进行流式下载及流式转码;如果所述转码状态表征所述块数据转码失败,则判定所述待转码视频文件转码失败。A verification module, configured to verify the transcoding status of the block data in the block index; if the transcoding status indicates that the transcoding of the block data is successful, then follow the sequence of the block numbers of the block data storing the target data corresponding to the successfully transcoded block data in the local storage space; if the transcoding status indicates that the transcoding of the block data has not been completed, continue to stream download the block data and streaming transcoding; if the transcoding status indicates that the transcoding of the block data fails, it is determined that the transcoding of the video file to be transcoded fails.

进一步的,本申请实施例还提供了一种电子设备。图8是根据一示例性实施例示出的电子设备20结构图,图中的内容不能认为是对本申请的使用范围的任何限制。Further, the embodiment of the present application also provides an electronic device. Fig. 8 is a structural diagram of anelectronic device 20 according to an exemplary embodiment, and the content in the diagram should not be regarded as any limitation on the application scope of this application.

图8为本申请实施例提供的一种电子设备20的结构示意图。该电子设备20,具体可以包括:至少一个处理器21、至少一个存储器22、电源23、通信接口24、输入输出接口25和通信总线26。其中,所述存储器22用于存储计算机程序,所述计算机程序由所述处理器21加载并执行,以实现前述任一实施例公开的转码方法中的相关步骤。FIG. 8 is a schematic structural diagram of anelectronic device 20 provided in an embodiment of the present application. Theelectronic device 20 may specifically include: at least one processor 21 , at least one memory 22 , a power supply 23 , a communication interface 24 , an input/output interface 25 and a communication bus 26 . Wherein, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21, so as to implement relevant steps in the transcoding method disclosed in any of the foregoing embodiments.

本实施例中,电源23用于为电子设备20上的各硬件设备提供工作电压;通信接口24能够为电子设备20创建与外界设备之间的数据传输通道,其所遵循的通信协议是能够适用于本申请技术方案的任意通信协议,在此不对其进行具体限定;输入输出接口25,用于获取外界输入数据或向外界输出数据,其具体的接口类型可以根据具体应用需要进行选取,在此不进行具体限定。In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on theelectronic device 20; the communication interface 24 can create a data transmission channel between theelectronic device 20 and external devices, and the communication protocol it follows is applicable Any communication protocol in the technical solution of the present application is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the external, and its specific interface type can be selected according to specific application needs, here Not specifically limited.

另外,存储器22作为资源存储的载体,可以是只读存储器、随机存储器、磁盘或者光盘等,其上所存储的资源可以包括操作系统221、计算机程序222及数据223等,存储方式可以是短暂存储或者永久存储。In addition, the memory 22, as a resource storage carrier, can be a read-only memory, random access memory, magnetic disk or optical disk, etc., and the resources stored thereon can include the operating system 221, computer programs 222 and data 223, etc., and the storage method can be short-term storage or permanent storage.

其中,操作系统221用于管理与控制电子设备20上的各硬件设备以及计算机程序222,以实现处理器21对存储器22中海量数据223的运算与处理,其可以是Windows Server、Netware、Unix、Linux等。计算机程序222除了包括能够用于完成前述任一实施例公开的由电子设备20执行的转码方法的计算机程序之外,还可以进一步包括能够用于完成其他特定工作的计算机程序。数据223可以包括电子设备20收集到的待转码视频文件。Wherein, the operating system 221 is used to manage and control each hardware device and computer program 222 on theelectronic device 20, so as to realize the calculation and processing of the massive data 223 in the memory 22 by the processor 21, which can be Windows Server, Netware, Unix, Linux, etc. In addition to computer programs that can be used to complete the transcoding method performed by theelectronic device 20 disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs that can be used to complete other specific tasks. The data 223 may include video files collected by theelectronic device 20 to be transcoded.

进一步的,本申请实施例还公开了一种存储介质,所述存储介质中存储有计算机程序,所述计算机程序被处理器加载并执行时,实现前述任一实施例公开的转码方法步骤。Further, the embodiment of the present application also discloses a storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the steps of the transcoding method disclosed in any of the foregoing embodiments are implemented.

本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same or similar parts of each embodiment can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for the related information, please refer to the description of the method part.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个…”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。Finally, it should also be noted that in this text, relational terms such as first and second etc. are only used to distinguish one entity or operation from another, and do not necessarily require or imply that these entities or operations, any such actual relationship or order exists. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

以上对本发明所提供的转码方法、装置、设备及存储介质进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The transcoding method, device, equipment, and storage medium provided by the present invention have been introduced in detail above. In this paper, specific examples are used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only for helping to understand this The method of the invention and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and scope of application. In summary, the content of this specification should not be understood To limit the present invention.

Claims (10)

Translated fromChinese
1.一种转码方法,其特征在于,应用于转码节点服务器,包括:1. A method for transcoding, characterized in that it is applied to a transcoding node server, comprising:利用下载器从云端服务器中流式下载待转码视频文件并将下载数据加载至缓存空间;Use the downloader to stream download the video file to be transcoded from the cloud server and load the downloaded data into the cache space;同时利用转码器对所述缓存空间中的下载数据进行流式转码,得到对应的目标数据;At the same time, a transcoder is used to stream-transcode the downloaded data in the buffer space to obtain corresponding target data;将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器。storing the target data in a local storage space, and reading the target data from the local storage space to upload to the cloud server.2.根据权利要求1所述的转码方法,其特征在于,还包括:2. The transcoding method according to claim 1, further comprising:确定在所述云端服务器中存储的所述待转码视频文件的分块模式,并根据所述分块模式对所述待转码视频文件进行分块,得到多个块数据;Determining the block pattern of the video file to be transcoded stored in the cloud server, and block the video file to be transcoded according to the block pattern to obtain a plurality of block data;相应的,利用下载器从云端服务器中流式下载待转码视频文件,同时利用转码器对下载数据进行流式转码,包括:Correspondingly, use the downloader to stream-download the video file to be transcoded from the cloud server, and use the transcoder to stream-transcode the downloaded data, including:利用多个下载器从所述云端服务器中流式并发下载多个所述块数据,同时利用多个转码器对下载数据进行流式并发转码。Using a plurality of downloaders to stream and concurrently download a plurality of the block data from the cloud server, and simultaneously utilizing a plurality of transcoders to perform streaming and concurrent transcoding on the downloaded data.3.根据权利要求2所述的转码方法,其特征在于,所述确定在所述云端服务器中存储的所述待转码视频文件的分块模式,包括:3. The transcoding method according to claim 2, wherein the determining the block mode of the video file to be transcoded stored in the cloud server comprises:获取所述待转码视频文件的视频头信息;其中,所述视频头信息至少包含所述待转码视频文件的帧率、码率;Obtain the video header information of the video file to be transcoded; wherein, the video header information includes at least the frame rate and code rate of the video file to be transcoded;根据所述视频头信息及自身转码器支持的转码方式确定所述待转码视频文件的所述分块模式。The block mode of the video file to be transcoded is determined according to the video header information and the transcoding mode supported by its own transcoder.4.根据权利要求2所述的转码方法,其特征在于,利用多个转码器对下载数据进行流式并发转码之后,还包括:4. The transcoding method according to claim 2, characterized in that, after using multiple transcoders to stream concurrently transcode the downloaded data, further comprising:为各个所述块数据创建相应的块索引,并将所述块索引存储至所述本地存储空间。A corresponding block index is created for each of the block data, and the block index is stored in the local storage space.5.根据权利要求4所述的转码方法,其特征在于,所述为各个所述块数据创建相应的块索引,包括:5. The transcoding method according to claim 4, wherein said creating a corresponding block index for each of said block data comprises:计算所述待转码视频文件的文件标识符,并为所述待转码视频文件的各个所述块数据分配相应的块编号;calculating the file identifier of the video file to be transcoded, and assigning a corresponding block number to each of the block data of the video file to be transcoded;创建至少包含所述文件标识符、所述块编号及所述块数据的转码状态的所述块索引。Creating the chunk index including at least the file identifier, the chunk number, and a transcoding status of the chunk data.6.根据权利要求5所述的转码方法,其特征在于,所述将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器,包括:6. The transcoding method according to claim 5, wherein the target data is stored in a local storage space, and the target data is read from the local storage space to upload to the cloud server ,include:按照所述块数据的块编号顺序将转码成功的所述块数据对应的所述目标数据存储至所述本地存储空间;storing the target data corresponding to the successfully transcoded block data in the local storage space according to the sequence of the block numbers of the block data;按照所述块数据的块编号顺序从所述本地存储空间读取存储的转码成功的所述块数据对应的所述目标数据以上传至所述云端服务器。Reading the target data corresponding to the block data that has been successfully transcoded from the local storage space according to the sequence of the block numbers of the block data to upload to the cloud server.7.根据权利要求6所述的转码方法,其特征在于,所述按照所述块数据的块编号顺序将转码成功的所述块数据对应的所述目标数据存储至所述本地存储空间之前,还包括:7. The transcoding method according to claim 6, wherein the target data corresponding to the successfully transcoded block data is stored in the local storage space according to the sequence of block numbers of the block data Previously, also included:对所述块索引中的所述块数据的转码状态进行校验;verifying the transcoding status of the block data in the block index;如果所述转码状态表征所述块数据转码成功,则按照所述块数据的块编号顺序将转码成功的所述块数据对应的所述目标数据存储至所述本地存储空间;If the transcoding status indicates that the block data has been successfully transcoded, storing the target data corresponding to the successfully transcoded block data in the local storage space according to the sequence of block numbers of the block data;如果所述转码状态表征所述块数据转码未完成,则继续对所述块数据进行流式下载及流式转码;If the transcoding state indicates that the transcoding of the block data is not completed, continue to stream download and stream transcode the block data;如果所述转码状态表征所述块数据转码失败,则判定所述待转码视频文件转码失败。If the transcoding status indicates that the transcoding of the block data fails, it is determined that the transcoding of the video file to be transcoded fails.8.一种转码装置,其特征在于,应用于转码节点服务器,包括:8. A transcoding device, characterized in that it is applied to a transcoding node server, comprising:下载模块,用于利用下载器从云端服务器中流式下载待转码视频文件并将下载数据加载至缓存空间;The download module is used to stream download the video file to be transcoded from the cloud server by using the downloader and load the downloaded data into the cache space;转码模块,用于同时利用转码器对所述缓存空间中的下载数据进行流式转码,得到对应的目标数据;A transcoding module, configured to simultaneously use a transcoder to stream-transcode the downloaded data in the cache space to obtain corresponding target data;存储上传模块,用于将所述目标数据存储至本地存储空间,并从所述本地存储空间读取所述目标数据以上传至所述云端服务器。The storage and uploading module is configured to store the target data in a local storage space, and read the target data from the local storage space to upload to the cloud server.9.一种电子设备,其特征在于,所述电子设备包括处理器和存储器;其中所述存储器用于存储计算机程序,所述计算机程序由所述处理器加载并执行以实现如权利要求1至7任一项所述的转码方法。9. An electronic device, characterized in that the electronic device comprises a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement claims 1 to 10. 7. The transcoding method described in any item.10.一种计算机可读存储介质,其特征在于,用于存储计算机可执行指令,所述计算机可执行指令被处理器加载并执行时,实现如权利要求1至7任一项所述的转码方法。10. A computer-readable storage medium, characterized in that it is used for storing computer-executable instructions, and when the computer-executable instructions are loaded and executed by a processor, the translation according to any one of claims 1 to 7 can be realized. code method.
CN202211213450.XA2022-09-302022-09-30 A transcoding method, device, equipment and storage mediumPendingCN115720276A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202211213450.XACN115720276A (en)2022-09-302022-09-30 A transcoding method, device, equipment and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202211213450.XACN115720276A (en)2022-09-302022-09-30 A transcoding method, device, equipment and storage medium

Publications (1)

Publication NumberPublication Date
CN115720276Atrue CN115720276A (en)2023-02-28

Family

ID=85253775

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202211213450.XAPendingCN115720276A (en)2022-09-302022-09-30 A transcoding method, device, equipment and storage medium

Country Status (1)

CountryLink
CN (1)CN115720276A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101049019A (en)*2004-10-252007-10-03苹果电脑有限公司Image scaling arrangement
CN102984547A (en)*2012-11-292013-03-20乐视致新电子科技(天津)有限公司Self-adaption cloud playback system
CN105025391A (en)*2014-04-302015-11-04腾讯科技(深圳)有限公司Video playing method and apparatus
CN106899858A (en)*2017-02-142017-06-27北京时间股份有限公司Video transcoding method, server and system
CN107153574A (en)*2016-03-032017-09-12北京大学Picture code-transferring method and system
CN108848397A (en)*2018-08-012018-11-20上海蒂茜科技有限公司A kind of application method of record screen playback reproducer
CN108965106A (en)*2018-06-212018-12-07北京达佳互联信息技术有限公司A kind of transmission of media file, method for down loading and device
CN111147869A (en)*2019-12-252020-05-12新浪网技术(中国)有限公司Video transcoding system and method based on distributed object storage

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101049019A (en)*2004-10-252007-10-03苹果电脑有限公司Image scaling arrangement
CN102984547A (en)*2012-11-292013-03-20乐视致新电子科技(天津)有限公司Self-adaption cloud playback system
CN105025391A (en)*2014-04-302015-11-04腾讯科技(深圳)有限公司Video playing method and apparatus
CN107153574A (en)*2016-03-032017-09-12北京大学Picture code-transferring method and system
CN106899858A (en)*2017-02-142017-06-27北京时间股份有限公司Video transcoding method, server and system
CN108965106A (en)*2018-06-212018-12-07北京达佳互联信息技术有限公司A kind of transmission of media file, method for down loading and device
CN108848397A (en)*2018-08-012018-11-20上海蒂茜科技有限公司A kind of application method of record screen playback reproducer
CN111147869A (en)*2019-12-252020-05-12新浪网技术(中国)有限公司Video transcoding system and method based on distributed object storage

Similar Documents

PublicationPublication DateTitle
CN107689976B (en) A file transmission method and device
CN107172070B (en) Resource access processing method and device
CN114564446B (en)File storage method, device, system and storage medium
CN112068925A (en)File uploading method and device based on WebUploader component, electronic equipment and readable storage medium
CN114564227A (en) Application program updating method, apparatus, electronic device and storage medium
CN117827772A (en) Object storage file data and metadata separation storage method and device
CN110489387A (en)Compress softwares method, apparatus, electronic equipment and storage medium
CN112748877A (en)File integration uploading method and device and file downloading method and device
US12072850B2 (en)Virtual file system for dynamically providing media content
CN115129360A (en)Code file management method and device, electronic equipment and storage medium
CN111107133A (en)Generation method of difference packet, data updating method, device and storage medium
CN114138558A (en) Object storage method, device, electronic device and storage medium
WO2020113382A1 (en)Hardware upgrading method, apparatus and device, and storage medium
CN115720276A (en) A transcoding method, device, equipment and storage medium
CN117492645A (en)Cross-platform file transmission method and device, electronic equipment and storage medium
CN113220237B (en)Distributed storage method, device, equipment and storage medium
CN117591018A (en) A request processing method and device in a distributed object storage system
CN110740138A (en) Data transmission method and device
CN117082053A (en)Method for uploading and downloading cloud-native file service
CN118605875A (en) A cross-platform data conversion method based on Lua script
CN116243940A (en) Network equipment upgrade method, device, electronic equipment and storage medium
CN114116367B (en)Method for generating log and electronic equipment
CN114385165A (en)Interface specification management and design draft verification method and device and electronic equipment
CN110795408A (en)Data processing method and device based on object storage, server and storage medium
CN112558881B (en) A method and system for migrating a storage system

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination

[8]ページ先頭

©2009-2025 Movatter.jp