WO2019134248A1 - Video file processing method, application server, and computer readable storage medium - Google Patents
Video file processing method, application server, and computer readable storage medium Download PDFInfo
- Publication number
- WO2019134248A1 WO2019134248A1 PCT/CN2018/077676 CN2018077676W WO2019134248A1 WO 2019134248 A1 WO2019134248 A1 WO 2019134248A1 CN 2018077676 W CN2018077676 W CN 2018077676W WO 2019134248 A1 WO2019134248 A1 WO 2019134248A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- server
- video file
- hls
- http
- nginx
- 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.)
- Ceased
Links
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/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/234—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
- H04N21/2343—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
-
- 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/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/231—Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion
-
- 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/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/234—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
- H04N21/2347—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving video stream encryption
-
- 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/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/25—Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
- H04N21/254—Management at additional data server, e.g. shopping server, rights management server
- H04N21/2541—Rights Management
-
- 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/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/83—Generation or processing of protective or descriptive data associated with content; Content structuring
- H04N21/845—Structuring of content, e.g. decomposing content into time segments
- H04N21/8455—Structuring of content, e.g. decomposing content into time segments involving pointers to the content, e.g. pointers to the I-frames of the video stream
-
- 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/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/83—Generation or processing of protective or descriptive data associated with content; Content structuring
- H04N21/845—Structuring of content, e.g. decomposing content into time segments
- H04N21/8456—Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments
Definitions
- the present application relates to the field of communications technologies, and in particular, to a video file processing method, an application server, and a computer readable storage medium.
- the video storage and transport architecture includes the client, nginx (a high-performance HTTP and reverse proxy server, also an IMAP/POP3/SMTP server, which can be called the front-end server in this article), local disk, where local A disk refers to an application server that connects to an nginx server.
- nginx a high-performance HTTP and reverse proxy server, also an IMAP/POP3/SMTP server, which can be called the front-end server in this article
- local disk where local A disk refers to an application server that connects to an nginx server.
- fs file system
- nginx rtmp Real Time Messaging Protocol
- the module processes the received video file and transmits the video file to the client in the form of a live stream according to the rtmp protocol.
- the storage capacity of the video file is limited due to the limitation of the hardware capacity of the local disk.
- the nginx passes the rtmp.
- the module transmits the video file to the client as a live stream of rtmp, the client cannot download the locally stored video file.
- the present application provides a video file processing method, an application server, and a computer readable storage medium, which can utilize the characteristics of the S3 server to realize unlimited expansion of video file storage, and ensure stability of video file storage and convenience of reading.
- the existing nginx server and client rtmp protocol is converted into HLS, which realizes the downloadability of video data.
- the security of video files can be increased, and CDN can also be realized. Diversion.
- the present application provides an application server, where the application server includes a memory, a processor, and a video file processing program executable on the processor, where the video file processing is stored.
- the program implements the following steps when executed by the processor:
- the command to convert to the HLS by the HTTP causes the nginx server to convert the HTTP data stream of the video file into an HLS data stream;
- the client is instructed to download the HLS data stream.
- the present invention further provides a video file processing method, which is applied to an application server, and the method includes:
- the command to convert to the HLS by the HTTP causes the nginx server to convert the HTTP data stream of the video file into an HLS data stream;
- the client is instructed to download the HLS data stream.
- the present application further provides a computer readable storage medium storing a video file processing program, the video file processing program being executable by at least one processor, so that The at least one processor performs the steps of the video file processing method as described above.
- the application server, the video file processing method and the computer readable storage medium proposed by the present application firstly define a calling interface between the S3 server and the nginx server based on the CEPH specification; secondly, upload the video file to the S3.
- the server 4 is stored to the storage segment; again, a command for converting HTTP to HLS is defined in the configuration file of the nginx server; then, the video file in the storage segment is pushed as an HTTP data stream through the calling interface. Going to the nginx server; then, the command of converting to HTTP by the HTTP causes the nginx server to convert the HTTP data stream of the video file into an HLS data stream; finally, instructing the client to download the HLS data stream .
- the nginx can transmit the video file to the client in the form of a live stream of rtmp through the rtmp module, and the client cannot download the video file for the local storage.
- the video data is realized by converting the existing nginx server and client rtmp protocol into HLS. Downloadability, and also due to the distribution and encryption features of HLS, can increase the security of video files, and can also achieve CDN offload.
- FIG. 1 is a schematic diagram of an optional application environment of each embodiment of the present application.
- FIG. 2 is a schematic diagram of an optional hardware architecture of the application server of FIG. 1;
- FIG. 3 is a block diagram showing the program of the first embodiment of the video file processing program of the present application.
- FIG. 4 is a flowchart of a first embodiment of a video file processing method according to the present application.
- FIG. 5 is a flowchart of a second embodiment of a video file processing method according to the present application.
- FIG. 6 is a flowchart of a third embodiment of a video file processing method according to the present application.
- application server 2 The internet 3 S3 server 4 Nginx server 5 Memory 11 processor 12 Network Interface 13 Video file handler 200 Interface definition module 201 Upload module 202 Command definition module 203 Push module 204 Sending module 205 Playback module 206
- FIG. 1 it is a schematic diagram of an optional application environment of each embodiment of the present application.
- the present application is applicable to an application environment including, but not limited to, a client 1, an application server 2, a network 3, a S3 (Simple Storage Service) server 4, and an nginx server 5.
- the application server 2 connects and manages the S3 server 4 and the nginx server 5, and the client 1 directly connects to the nginx server 5, and initiates a corresponding request to the application server 2 through the nginx server 5, and the application server 2 controls the retrieval or processing of the storage.
- the client 1 may be a mobile phone, a smart phone, a notebook computer, a digital broadcast receiver, a PDA (Personal Digital Assistant), a PAD (Tablet PC), a PMP (Portable Multimedia Player), a navigation device, an in-vehicle device, etc.
- Mobile devices such as, and fixed terminals such as digital TVs, desktop computers, notebooks, servers, and the like.
- the application server 2 may be a computing device such as a rack server, a blade server, a tower server, or a rack server.
- the application server 2 may be a stand-alone server or a server cluster composed of multiple servers.
- the network 3 may be an intranet, an Internet, a Global System of Mobile communication (GSM), a Wideband Code Division Multiple Access (WCDMA), a 4G network, Wireless or wired networks such as 5G networks, Bluetooth, Wi-Fi, and call networks.
- GSM Global System of Mobile communication
- WCDMA Wideband Code Division Multiple Access
- 4G network Wireless or
- the assets stored and retrieved by the S3 server 4 are referred to as objects, and the objects are stored in a bucket, and different objects are stored in different storage segments according to different objects, such as file files stored in file storage. Segment, the video file is stored in the movie storage segment.
- the S3 server has the characteristics that other servers do not have, that is, the file storage capacity is large, and there is no need to worry about the limitation of the storage space; in addition, the reading speed of the files on the S3 server is much faster than the data reading speed of other storage media.
- the application server 2 is respectively connected to one or more of the client 1, the S3 server 4 and the nginx server 5 through the network 3 for data transmission and interaction.
- the application server 2 connects and manages the S3 server 4 and the nginx server 5, defines a corresponding calling interface, and the client 1 directly connects to the nginx server 5, and initiates a corresponding request to the application server through the nginx server 5. 2.
- the object stored in the S3 server 4 is retrieved or processed by the application server 2.
- a video file processing program 200 is installed and run in the application server 2, and when the video file processing program 200 is running, the application server 2 defines the S3 server 4 and the nginx server 5 based on the CEPH specification.
- a calling interface uploading a video file to the S3 server 4 and storing it to the storage segment; defining a command for converting the HTTP to the HLS in the configuration file of the nginx server 5; and using the calling interface to record the video file in the storage segment Pushing to the nginx server 5 in the form of an HTTP data stream; the command to convert to the HLS by the HTTP causes the nginx server 5 to convert the HTTP data stream of the video file into an HLS data stream; commanding the client 1 Download the HLS data stream.
- the disadvantages of the nginx in the prior art that the video file is transmitted to the client 1 in the form of a live stream of rtmp through the rtmp module, and the client 1 cannot download the video file stored locally can be avoided.
- the downloadability of video data, as well as the distribution and encryption features of HLS, can increase the security of video files, and can also realize the content distribution network (CDN) offloading.
- CDN content distribution network
- the application server 2 may include, but is not limited to, the memory 11, the processor 12, and the network interface 13 being communicably connected to each other through a system bus. It is to be noted that Figure 2 shows only the application server 2 with components 11-13, but it should be understood that not all illustrated components may be implemented and that more or fewer components may be implemented instead.
- the memory 11 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (eg, SD or DX memory, etc.), and a random access memory (RAM). , static random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk, and the like.
- the memory 11 may be an internal storage unit of the application server 2, such as a hard disk or memory of the application server 2.
- the memory 11 may also be an external storage device of the application server 2, such as a plug-in hard disk equipped on the application server 2, a smart memory card (SMC), and a secure digital number. (Secure Digital, SD) card, flash card, etc.
- the memory 11 can also include both the internal storage unit of the application server 2 and its external storage device.
- the memory 11 is generally used to store an operating system installed in the application server 2 and various types of application software, such as program code of the video file processing program 200. Further, the memory 11 can also be used to temporarily store various types of data that have been output or are to be output.
- the processor 12 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments.
- the processor 12 is typically used to control the overall operation of the application server 2, such as performing control and processing related to data interaction or communication with the client 1.
- the processor 12 is configured to run program code or process data stored in the memory 11, such as running the video file processing program 200 and the like.
- the network interface 13 may comprise a wireless network interface or a wired network interface, which is typically used to establish a communication connection between the application server 2 and other electronic devices.
- the network interface 13 is mainly used to connect the application server 2 to one or more of the client 1, the S3 server 4 and the nginx server 5 through the network 3, in the application server 2 Establishing a data transmission channel and a communication connection with the one or more clients 1, the S3 server 4, and the nginx server 5.
- the present application proposes a video file processing program 200.
- FIG. 3 it is a program module diagram of the first embodiment of the video file processing program 200 of the present application.
- the video file processing program 200 includes a series of computer program instructions stored in the memory 11, and when the computer program instructions are executed by the processor 12, the video files of the embodiments of the present application may be implemented. Processing operations.
- the video file processing program 200 can be divided into one or more modules based on the particular operations implemented by the various portions of the computer program instructions. For example, in FIG. 3, the video file processing program 200 can be divided into an interface definition module 201, an upload module 202, a command definition module 203, a push module 204, a sending module 205, and a play module 206. among them:
- the interface definition module 201 is configured to define a calling interface between the S3 server 4 and the nginx server 5 based on the CEPH specification.
- CEPH is a distributed file system, which can be divided into four levels: (1) basic storage system, (2) basic library librados, (3) high-level application interface: this layer consists of three parts: RADOS GW ( RADOS Gateway), RBD (Reliable Block Device) and Ceph FS (Ceph File System), which provide an upper level interface with higher level of abstraction, easier application or client 1 based on the librados library, where RADOS GW is A gateway that provides RESTful APIs compatible with Amazon S3 Server 4 and Swift for use by the corresponding object storage application development.
- RADOS GW is A gateway that provides RESTful APIs compatible with Amazon S3 Server 4 and Swift for use by the corresponding object storage application development.
- Application layer The above CEPH has a CEPH specification, which can be called by an interface between various levels in the CEPH system through the CEPH specification.
- one of the layers - the high-level application interface can provide an upper-layer interface for the externally connected server or client 1, that is, CEPH can regulate its own calling interface with the S3 server 4 and the nginx server 5, and at the same time, due to the S3 server 4 is a simple storage service device, there is a specific access interface, CEPH can define the calling interface of the S3 server 4 and the nginx server 5 in the storage object calling process through the specification.
- the uploading module 202 is configured to upload a video file to the S3 server 4 and store the file to a storage segment. Specifically, the uploading module 202 implements the step of uploading the video file to the S3 server 4 and storing it to a storage segment in the following manner:
- the uploading module 202 defines an uploaded video file name, and sets an access right to access the video file according to the S3 server 4 specification.
- the mp4 or flv file can be uploaded to the ticket (storage segment) of the movie of the S3 server 4, and the uploaded file name is named "video.mp4", and the access permission is set to "public-read”.
- the corresponding content-type taking s3cmd as an example, the setting instruction is: s3cmd put video.mp4s3://movie--acl-public.
- the command definition module 203 defines a command for converting HTTP to HLS in a configuration file of the nginx server 5.
- the nginx server 5 includes an rtmp module, and the command definition module 203 defines a command for converting HTTP to HLS in a configuration file of the nginx server 5rtmp module; and the code ⁇ nginx_server ⁇ in the replacement configuration file is nginx Server 5's IP or domain name.
- rtmp Real Time Messaging Protocol
- HLS HTTP Live Streaming
- video file fragmentation can be sent, and the transmitted video file can be encrypted.
- the configuration code for specifically converting the HTTP to HLS by the rtmp module is:
- the specific code that uses the ffmpeg to push the video file in the storage segment to the nginx server 5 in the form of an HTTP data stream is: ffmpeg-re-i http://s3.ceph.work /movie/video.mp4-c:v copy-c:a aac-ar 44100-ab 128k-ac 2-strict-2-f flv rtmp:// ⁇ nginx_server ⁇ /myapp/movie.
- the pushing module 204 is configured to push, by using the calling interface, the video file in the storage segment to the nginx server 5 in the form of an HTTP data stream. Specifically, the pushing module 204 uses ffmpeg to implement the step of pushing the video file in the storage segment to the nginx server 5 in the form of an HTTP data stream through the calling interface.
- FFmpeg is an open source computer program that can be used to record, convert, and convert digital audio and video into streams. With FFmpeg, video files in the storage segment can be transmitted in the form of HTTP data streams.
- the sending module 205 is configured to enable the nginx server 5 to convert the HTTP data stream of the video file into an HLS data stream by using the HTTP to HLS command.
- the HLS data stream is characterized in that it can support the download of data by the client.
- the sending module 205 is further configured to connect the Client 1 to the nginx server 5. Specifically, the sending module 205 opens a preset address by using a preset player to implement the step of connecting the client 1 to the nginx server 5.
- the manner of connecting the client 1 to the nginx server 5 can be implemented by using a VLC player or other HLS-enabled player to open a preset address, for example: http:// ⁇ nginx_server ⁇ /myapp/movie.m3u8.
- the playing module 206 is configured to instruct the client 1 to download the HLS data stream.
- the video data viewed by the user at the client 1 is downloadable.
- the video file processing program 200 proposed by the present application firstly defines a calling interface between the S3 server 4 and the nginx server 5 based on the CEPH specification; secondly, uploads a video file to the S3 server 4 and stores it to a storage segment; again, a command for converting HTTP to HLS is defined in a configuration file of the nginx server 5; then, the video file in the storage segment is pushed to the nginx as an HTTP data stream through the calling interface Server 5; Next, the command to convert to HLS by the HTTP causes the nginx server 5 to convert the HTTP data stream of the video file into an HLS data stream; finally, the client 1 is instructed to download the HLS data stream.
- the disadvantages of the nginx in the prior art that the video file is transmitted to the client 1 in the form of a live stream of rtmp through the rtmp module, and the client 1 cannot download the video file stored locally can be avoided.
- the downloadability of video data, as well as the distribution and encryption features of HLS, can increase the security of video files, and can also achieve CDN offloading.
- the present application also proposes a video file processing method.
- FIG. 4 it is a schematic flowchart of the implementation of the first embodiment of the video file processing method of the present application.
- the order of execution of the steps in the flowchart shown in FIG. 4 may be changed according to different requirements, and some steps may be omitted.
- Step S401 defining a calling interface between the S3 server 4 and the nginx server 5 based on the CEPH specification.
- CEPH is a distributed file system, which can be divided into four levels: (1) basic storage system, (2) basic library librados, (3) high-level application interface: this layer consists of three parts: RADOS GW ( RADOS Gateway), RBD (Reliable Block Device) and Ceph FS (Ceph File System), which provide an upper level interface with higher level of abstraction, easier application or client 1 based on the librados library, where RADOS GW is A gateway that provides RESTful APIs compatible with Amazon S3 Server 4 and Swift for use by the corresponding object storage application development.
- RADOS GW is A gateway that provides RESTful APIs compatible with Amazon S3 Server 4 and Swift for use by the corresponding object storage application development.
- Application layer The above CEPH has a CEPH specification, which can be called by an interface between various levels in the CEPH system through the CEPH specification.
- one of the layers - the high-level application interface can provide an upper-layer interface for the externally connected server or client 1, that is, CEPH can regulate its own calling interface with the S3 server 4 and the nginx server 5, and at the same time, due to the S3 server 4 is a simple storage service device, there is a specific access interface, CEPH can define the calling interface of the S3 server 4 and the nginx server 5 in the storage object calling process through the specification.
- Step S402 uploading the video file to the S3 server 4 and storing it to a storage segment; specifically, the specific step of uploading the video file to the S3 server 4 and storing to a storage segment will be the second embodiment of the video file processing method of the present application. (Fig. 5) is described in detail.
- Step S403 a command for converting HTTP to HLS is defined in a configuration file of the nginx server 5.
- Step S404 the video file in the storage segment is pushed to the nginx server 5 in the form of an HTTP data stream through the calling interface.
- the application server 2 uses ffmpeg to implement the step of pushing the video file in the storage segment to the nginx server 5 in the form of an HTTP data stream through the calling interface.
- FFmpeg is an open source computer program that can be used to record, convert, and convert digital audio and video into streams. With FFmpeg, video files in the storage segment can be transmitted in the form of HTTP data streams.
- Step S405 the command for converting to HTTP by the HTTP causes the nginx server 5 to convert the HTTP data stream of the video file into an HLS data stream.
- the application server 2 before the step of converting the HTTP data into HLS by the HTTP to the nginx server 5 to convert the HTTP data stream of the video file into the HLS data stream and transmitting to the client 1, the application server 2 further Connecting the client 1 to the nginx server 5. Specifically, the application server 2 opens a preset address by a preset player to implement the step of connecting the client 1 to the nginx server 5.
- the manner of connecting the client 1 to the nginx server 5 can be implemented by using a VLC player or other HLS-enabled player to open a preset address, for example: http:// ⁇ nginx_server ⁇ /myapp/movie.m3u8.
- Step S406 instructing the client 1 to download the HLS data stream.
- the video data viewed by the user at the client 1 is downloadable.
- the video file processing method proposed by the present application firstly defines a calling interface between the S3 server 4 and the nginx server 5 based on the CEPH specification; secondly, uploads the video file to the S3 server 4 and stores it to the storage segment.
- a command to convert HTTP to HLS is defined in the configuration file of the nginx server 5; then, the video file in the storage segment is pushed to the nginx server 5 as an HTTP data stream through the calling interface.
- the command to convert to the HLS by the HTTP causes the nginx server 5 to convert the HTTP data stream of the video file into an HLS data stream; finally, the client 1 is instructed to download the HLS data stream.
- the S3 server 4 can be used to realize the unlimited expansion of the video file storage, ensuring the stability of the video file storage and the convenience of reading, and converting the rtmp protocol of the existing nginx server 5 and client 1 into HLS.
- the downloadability of the video data is realized, and the security of the video file can be increased due to the distribution and encryption features of the HLS, and the CDN offload can also be realized.
- FIG. 5 it is a schematic flowchart of the implementation of the second embodiment of the video file processing method of the present application.
- the order of execution of the steps in the flowchart shown in FIG. 5 may be changed according to different requirements, and some steps may be omitted.
- the process of uploading a video file to the S3 server 4 and storing the data to a storage segment includes the following steps:
- Step S501 defining an uploaded video file name.
- the specific name is set according to the user's needs.
- Step S502 setting access rights for accessing the video file according to the S3 server 4 specification.
- the mp4 or flv file can be uploaded to the ticket (storage segment) of the movie of the S3 server 4, and the uploaded file name is named "video.mp4", and the access permission is set to "public-read”.
- the corresponding content-type taking s3cmd as an example, the setting instruction is: s3cmd put video.mp4s3://movie--acl-public.
- the video file processing method proposed by the present application can upload the video file to the S3 server 4 by defining the uploaded video file name and setting the access right of accessing the video file according to the S3 specification. In this way, the unlimited expansion of the video file storage is realized, and the stability of the video file storage and the convenience of reading are ensured.
- FIG. 6 is a schematic flowchart of an implementation process of a third embodiment of a video file processing method of the present application.
- the order of execution of the steps in the flowchart shown in FIG. 6 may be changed according to different requirements, and some steps may be omitted.
- the nginx server 5 includes an rtmp module, and the process of the step of defining a command for converting HTTP to HLS in the configuration file of the nginx server 5 includes the following steps:
- Step S601 a command for converting HTTP to HLS is defined in a configuration file of the nginx server 5rtmp module.
- step S602 the code ⁇ nginx_server ⁇ in the replacement configuration file is the IP or domain name of the nginx server 5.
- the rtmp (Real Time Messaging Protocol) real-time messaging protocol is an open protocol developed by Adobe Systems for audio, video, and data transmission between a Flash player and a server.
- HLS HTTP Live Streaming
- m3u (8) index file, TS media slice file and key encryption string file is Apple's dynamic rate adaptation technology, mainly used for audio and video services of PCs and Apple terminals.
- the configuration code for specifically converting the HTTP to HLS by the rtmp module is:
- the specific code that uses the ffmpeg to push the video file in the storage segment to the nginx server 5 in the form of an HTTP data stream is: ffmpeg-re-i http://s3.ceph.work /movie/video.mp4-c:v copy-c:a aac-ar 44100-ab 128k-ac 2-strict-2-f flv rtmp:// ⁇ nginx_server ⁇ /myapp/movie.
- the video file processing method proposed by the present application can define a command of HTTP conversion to HLS in the configuration file of the nginx server 5. In this way, due to the distribution and encryption features of the HLS, the security of the video file can be increased, and the CDN offload can also be implemented.
- the present application further provides a computer readable storage medium storing a video file processing program, the video file processing program being executable by at least one processor, so that The at least one processor performs the steps of the video file processing method as described above.
- the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better.
- Implementation Based on such understanding, 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 mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present application.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Databases & Information Systems (AREA)
- Information Transfer Between Computers (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
- Storage Device Security (AREA)
Abstract
Description
本申请要求于2017年01月03日提交中国专利局、申请号为201810003951.2、发明名称为“视频文件处理方法、应用服务器及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application claims priority to Chinese Patent Application No. 201810003951.2, entitled "Video File Processing Method, Application Server and Computer Readable Storage Media", filed on January 3, 2017, the entire contents of which are hereby incorporated by reference. The citation is incorporated in the application.
本申请涉及通信技术领域,尤其涉及一种视频文件处理方法、应用服务器及计算机可读存储介质。The present application relates to the field of communications technologies, and in particular, to a video file processing method, an application server, and a computer readable storage medium.
目前,视频的存储及传输架构包括客户端、nginx(一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器,在本文中可以称之为前段服务器)、本地磁盘,其中本地磁盘指的是连接nginx服务器的应用服务器。而对于视频文件而言,所有视频文件均存储于本地磁盘上,通过文件系统(file system,fs)的I/O接口传送至nginx,并由nginx的rtmp(Real Time Messaging Protocol,实时消息传输协议)模块对接收的视频文件进行处理,并依据rtmp协议将视频文件以直播流的形式传送至客户端。在上述的视频存储及传输的结构中,由于本地磁盘的硬件容量限制,使得视频文件的存储大小受到限制,另外,由于rtmp的数据传输格式不支持端对端的数据下载服务,故在nginx通过rtmp模块将视频文件以rtmp的直播流的形式传送至客户端时,客户端无法针对本地存储的视频文件进行下载。Currently, the video storage and transport architecture includes the client, nginx (a high-performance HTTP and reverse proxy server, also an IMAP/POP3/SMTP server, which can be called the front-end server in this article), local disk, where local A disk refers to an application server that connects to an nginx server. For the video file, all the video files are stored on the local disk, and are transmitted to the nginx through the I/O interface of the file system (fs), and the real time messaging protocol of the nginx rtmp (Real Time Messaging Protocol) The module processes the received video file and transmits the video file to the client in the form of a live stream according to the rtmp protocol. In the above structure of video storage and transmission, the storage capacity of the video file is limited due to the limitation of the hardware capacity of the local disk. In addition, since the data transmission format of the rtmp does not support the end-to-end data download service, the nginx passes the rtmp. When the module transmits the video file to the client as a live stream of rtmp, the client cannot download the locally stored video file.
发明内容Summary of the invention
有鉴于此,本申请提出一种视频文件处理方法、应用服务器及计算机可读存储介质,可以利用S3服务器的特性实现视频文件存储的无限扩容,保证 视频文件存储的稳定性以及读取的便捷性,同时由于将现有的nginx服务器和客户端的rtmp协议转变成HLS,实现了视频数据的可下载性,同时也由于HLS的分发、加密特性,可以增加视频文件的安全性,同时还可以实现CDN分流。In view of this, the present application provides a video file processing method, an application server, and a computer readable storage medium, which can utilize the characteristics of the S3 server to realize unlimited expansion of video file storage, and ensure stability of video file storage and convenience of reading. At the same time, the existing nginx server and client rtmp protocol is converted into HLS, which realizes the downloadability of video data. At the same time, due to the distribution and encryption features of HLS, the security of video files can be increased, and CDN can also be realized. Diversion.
首先,为实现上述目的,本申请提出一种应用服务器,所述应用服务器包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的视频文件处理程序,所述视频文件处理程序被所述处理器执行时实现如下步骤:First, in order to achieve the above object, the present application provides an application server, where the application server includes a memory, a processor, and a video file processing program executable on the processor, where the video file processing is stored. The program implements the following steps when executed by the processor:
基于CEPH规范定义S3服务器与nginx服务器之间的调用接口;Defining a calling interface between the S3 server and the nginx server based on the CEPH specification;
上传视频文件至S3服务器并存储至一存储段;Upload a video file to the S3 server and store it to a storage segment;
在所述nginx服务器的配置文件中定义HTTP转换为HLS的命令;Defining an HTTP conversion to HLS command in the configuration file of the nginx server;
通过所述调用接口将所述存储段中的视频文件以HTTP数据流的形式推送至所述nginx服务器;Transmitting, by the calling interface, the video file in the storage segment to the nginx server in the form of an HTTP data stream;
通过所述HTTP转换为HLS的命令使得所述nginx服务器将所述视频文件的HTTP数据流转换为HLS数据流;及The command to convert to the HLS by the HTTP causes the nginx server to convert the HTTP data stream of the video file into an HLS data stream;
命令所述客户端下载所述HLS数据流。The client is instructed to download the HLS data stream.
此外,为实现上述目的,本发明还提供一种视频文件处理方法,该方法应用于应用服务器,所述方法包括:In addition, to achieve the above object, the present invention further provides a video file processing method, which is applied to an application server, and the method includes:
基于CEPH规范定义S3服务器与nginx服务器之间的调用接口;Defining a calling interface between the S3 server and the nginx server based on the CEPH specification;
上传视频文件至S3服务器并存储至存储段;Upload the video file to the S3 server and store it to the storage segment;
在所述nginx服务器的配置文件中定义HTTP转换为HLS的命令;Defining an HTTP conversion to HLS command in the configuration file of the nginx server;
通过所述调用接口将所述存储段中的视频文件以HTTP数据流的形式推送至所述nginx服务器;Transmitting, by the calling interface, the video file in the storage segment to the nginx server in the form of an HTTP data stream;
通过所述HTTP转换为HLS的命令使得所述nginx服务器将所述视频文件的HTTP数据流转换为HLS数据流;及The command to convert to the HLS by the HTTP causes the nginx server to convert the HTTP data stream of the video file into an HLS data stream;
命令所述客户端下载所述HLS数据流。The client is instructed to download the HLS data stream.
进一步地,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质存储有视频文件处理程序,所述视频文件处理程序 可被至少一个处理器执行,以使所述至少一个处理器执行如上述的视频文件处理方法的步骤。Further, in order to achieve the above object, the present application further provides a computer readable storage medium storing a video file processing program, the video file processing program being executable by at least one processor, so that The at least one processor performs the steps of the video file processing method as described above.
相较于现有技术,本申请所提出的应用服务器、视频文件处理方法及计算机可读存储介质,首先,基于CEPH规范定义S3服务器与nginx服务器之间的调用接口;其次,上传视频文件至S3服务器4并存储至存储段;再次,在所述nginx服务器的配置文件中定义HTTP转换为HLS的命令;然后,通过所述调用接口将所述存储段中的视频文件以HTTP数据流的形式推送至所述nginx服务器;接着,通过所述HTTP转换为HLS的命令使得所述nginx服务器将所述视频文件的HTTP数据流转换为HLS数据流;最后,命令所述客户端下载所述HLS数据流。这样,既可以避免现有技术中nginx通过rtmp模块将视频文件以rtmp的直播流的形式传送至客户端,客户端无法针对本地存储的视频文件进行下载的弊端。又可以利用S3服务器的特性实现视频文件的任意存储,保证视频文件存储的稳定性以及读取的便捷性,同时由于将现有的nginx服务器和客户端的rtmp协议转变成HLS,实现了视频数据的可下载性,同时也由于HLS的分发、加密特性,可以增加视频文件的安全性,同时还可以实现CDN分流。Compared with the prior art, the application server, the video file processing method and the computer readable storage medium proposed by the present application firstly define a calling interface between the S3 server and the nginx server based on the CEPH specification; secondly, upload the video file to the S3. The
图1是本申请各个实施例一可选的应用环境示意图;1 is a schematic diagram of an optional application environment of each embodiment of the present application;
图2是图1中应用服务器一可选的硬件架构的示意图;2 is a schematic diagram of an optional hardware architecture of the application server of FIG. 1;
图3是本申请视频文件处理程序第一实施例的程序模块图;Figure 3 is a block diagram showing the program of the first embodiment of the video file processing program of the present application;
图4为本申请视频文件处理方法第一实施例的流程图;4 is a flowchart of a first embodiment of a video file processing method according to the present application;
图5为本申请视频文件处理方法第二实施例的流程图;FIG. 5 is a flowchart of a second embodiment of a video file processing method according to the present application;
图6为本申请视频文件处理方法第三实施例的流程图。FIG. 6 is a flowchart of a third embodiment of a video file processing method according to the present application.
附图标记:Reference mark:
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The implementation, functional features and advantages of the present application will be further described with reference to the accompanying drawings.
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the objects, technical solutions, and advantages of the present application more comprehensible, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope are the scope of the present application.
需要说明的是,在本申请中涉及“第一”、“第二”等的描述仅用于描述目的, 而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。It should be noted that the descriptions of "first", "second" and the like in the present application are for the purpose of description only, and are not to be understood as indicating or implying their relative importance or implicitly indicating the number of indicated technical features. . Thus, features defining "first" or "second" may include at least one of the features, either explicitly or implicitly. In addition, the technical solutions between the various embodiments may be combined with each other, but must be based on the realization of those skilled in the art, and when the combination of the technical solutions is contradictory or impossible to implement, it should be considered that the combination of the technical solutions does not exist. Nor is it within the scope of protection required by this application.
参阅图1所示,是本申请各个实施例一可选的应用环境示意图。Referring to FIG. 1 , it is a schematic diagram of an optional application environment of each embodiment of the present application.
在本实施例中,本申请可应用于包括,但不仅限于,客户端1、应用服务器2、网络3、S3(Simple Storage Service,简单存储服务)服务器4和nginx服务器5的应用环境中。,其中应用服务器2连接并管理S3服务器4和nginx服务器5,客户端1则直接连接nginx服务器5,并通过nginx服务器5发起相应请求至应用服务器2,并由应用服务器2控制调取或处理存储于S3服务器4中的对象。另外,所述客户端1可以是移动电话、智能电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、导航装置、车载装置等等的可移动设备,以及诸如数字TV、台式计算机、笔记本、服务器等等的固定终端。所述应用服务器2可以是机架式服务器、刀片式服务器、塔式服务器或机柜式服务器等计算设备,该应用服务器2可以是独立的服务器,也可以是多个服务器所组成的服务器集群。所述网络3可以是企业内部网(Intranet)、互联网(Internet)、全球移动通讯系统(Global System of Mobile communication,GSM)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、4G网络、5G网络、蓝牙(Bluetooth)、Wi-Fi、通话网络等无线或有线网络。In this embodiment, the present application is applicable to an application environment including, but not limited to, a
所述S3服务器4存储和检索的资产被称为对象,而对象存储在存储段(bucket)中,并根据对象的不同,将不同的对象存储在不同的存储段,比如file文件存储在file存储段,视频文件存储在movie存储段。其中S3服务器具有其他服务器所不具有的特点,即文件存储量大,不用担心存储空间的限制; 另外,对S3服务器上文件的读取速度要远远快于其他存储媒介的数据读取速度。The assets stored and retrieved by the
其中,所述应用服务器2中通过所述网络3分别与一个或多个所述客户端1、S3服务器4和nginx服务器5通信连接,以进行数据传输和交互。The
基于上述应用环境各个组件的介绍,应用服务器2连接并管理S3服务器4和nginx服务器5,定义相应调用接口,而客户端1则直接连接nginx服务器5,并通过nginx服务器5发起相应请求至应用服务器2,并由应用服务器2控制调取或处理存储于S3服务器4中的对象。Based on the introduction of each component of the application environment, the
本实施例中,所述应用服务器2内安装并运行有视频文件处理程序200,当所述视频文件处理程序200运行时,所述应用服务器2基于CEPH规范定义上述S3服务器4与nginx服务器5之间的调用接口;上传视频文件至S3服务器4并存储至存储段;在所述nginx服务器5的配置文件中定义HTTP转换为HLS的命令;通过所述调用接口将所述存储段中的视频文件以HTTP数据流的形式推送至所述nginx服务器5;通过所述HTTP转换为HLS的命令使得所述nginx服务器5将所述视频文件的HTTP数据流转换为HLS数据流发送;命令所述客户端1下载所述HLS数据流。这样,既可以避免现有技术中nginx通过rtmp模块将视频文件以rtmp的直播流的形式传送至客户端1,客户端1无法针对本地存储的视频文件进行下载的弊端。又可以利用S3服务器4的特性实现视频文件的任意存储,保证视频文件存储的稳定性以及读取的便捷性,同时由于将现有的nginx服务器5和客户端1的rtmp协议转变成HLS,实现了视频数据的可下载性,同时也由于HLS的分发、加密特性,可以增加视频文件的安全性,同时还可以实现内容分发网络(Content Delivery Network,CDN)分流。In this embodiment, a video file processing program 200 is installed and run in the
参阅图2所示,是图1中应用服务器2一可选的硬件架构的示意图。本实施例中,所述应用服务器2可包括,但不仅限于,可通过系统总线相互通信连接存储器11、处理器12、网络接口13。需要指出的是,图2仅示出了具有组件11-13的应用服务器2,但是应理解的是,并不要求实施所有示出的组件,可以替代 的实施更多或者更少的组件。Referring to FIG. 2, it is a schematic diagram of an optional hardware architecture of the
其中,所述存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,所述存储器11可以是所述应用服务器2的内部存储单元,例如该应用服务器2的硬盘或内存。在另一些实施例中,所述存储器11也可以是所述应用服务器2的外部存储设备,例如该应用服务器2上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,所述存储器11还可以既包括所述应用服务器2的内部存储单元也包括其外部存储设备。本实施例中,所述存储器11通常用于存储安装于所述应用服务器2的操作系统和各类应用软件,例如视频文件处理程序200的程序代码等。此外,所述存储器11还可以用于暂时地存储已经输出或者将要输出的各类数据。The memory 11 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (eg, SD or DX memory, etc.), and a random access memory (RAM). , static random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk, and the like. In some embodiments, the memory 11 may be an internal storage unit of the
所述处理器12在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器12通常用于控制所述应用服务器2的总体操作,例如执行与所述客户端1进行数据交互或者通信相关的控制和处理等。本实施例中,所述处理器12用于运行所述存储器11中存储的程序代码或者处理数据,例如运行所述的视频文件处理程序200等。The processor 12 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 12 is typically used to control the overall operation of the
所述网络接口13可包括无线网络接口或有线网络接口,该网络接口13通常用于在所述应用服务器2与其他电子设备之间建立通信连接。本实施例中,所述网络接口13主要用于通过所述网络3将所述应用服务器2与一个或多个所述客户端1、S3服务器4和nginx服务器5相连,在所述应用服务器2与所述一个或多个客户端1、S3服务器4和nginx服务器5之间的建立数据传输通道和通信连接。The network interface 13 may comprise a wireless network interface or a wired network interface, which is typically used to establish a communication connection between the
至此,己经详细介绍了本申请各个实施例的应用环境和相关设备的硬件结构和功能。下面,将基于上述应用环境和相关设备,提出本申请的各个实施例。So far, the application environment of the various embodiments of the present application and the hardware structure and functions of related devices have been described in detail. Hereinafter, various embodiments of the present application will be proposed based on the above-described application environment and related devices.
首先,本申请提出一种视频文件处理程序200。First, the present application proposes a video file processing program 200.
参阅图3所示,是本申请视频文件处理程序200第一实施例的程序模块图。Referring to FIG. 3, it is a program module diagram of the first embodiment of the video file processing program 200 of the present application.
本实施例中,所述的视频文件处理程序200包括一系列的存储于存储器11上的计算机程序指令,当该计算机程序指令被处理器12执行时,可以实现本申请各实施例的视频文件的处理操作。在一些实施例中,基于该计算机程序指令各部分所实现的特定的操作,所述视频文件处理程序200可以被划分为一个或多个模块。例如,在图3中,所述的视频文件处理程序200可以被分割成接口定义模块201、上传模块202、命令定义模块203、推送模块204、发送模块205及播放模块206。其中:In this embodiment, the video file processing program 200 includes a series of computer program instructions stored in the memory 11, and when the computer program instructions are executed by the processor 12, the video files of the embodiments of the present application may be implemented. Processing operations. In some embodiments, the video file processing program 200 can be divided into one or more modules based on the particular operations implemented by the various portions of the computer program instructions. For example, in FIG. 3, the video file processing program 200 can be divided into an interface definition module 201, an upload module 202, a command definition module 203, a push module 204, a sending module 205, and a play module 206. among them:
所述接口定义模块201,用于基于CEPH规范定义S3服务器4与nginx服务器5之间的调用接口。The interface definition module 201 is configured to define a calling interface between the
CEPH是一种分布式文件系统,其可以分为四个层次:(1)基础存储系统、(2)基础库librados、(3)高层应用接口:这一层包括了三个部分:RADOS GW(RADOS Gateway)、RBD(Reliable Block Device)和Ceph FS(Ceph File System),其作用是在librados库的基础上提供抽象层次更高、更便于应用或客户端1使用的上层接口,其中RADOS GW是一个提供与Amazon S3服务器4和Swift兼容的RESTful API的gateway,以供相应的对象存储应用开发使用。(4)应用层。上述CEPH具有CEPH规范,通过CEPH规范可以CEPH系统中各个层次之间的接口调用。CEPH is a distributed file system, which can be divided into four levels: (1) basic storage system, (2) basic library librados, (3) high-level application interface: this layer consists of three parts: RADOS GW ( RADOS Gateway), RBD (Reliable Block Device) and Ceph FS (Ceph File System), which provide an upper level interface with higher level of abstraction, easier application or
在上述CEPH系统中,其中一个层次——高层应用接口可以为外部相连的服务器或者客户端1提供上层接口,即CEPH可以规范自身同S3服务器4和nginx服务器5的调用接口,同时,由于S3服务器4是一种简单存储服务装置,存在特定的访问接口,CEPH可以通过规范定义S3服务器4和nginx 服务器5在存储对象调用过程中的调用接口。In the above CEPH system, one of the layers - the high-level application interface can provide an upper-layer interface for the externally connected server or
所述上传模块202,用于上传视频文件至S3服务器4并存储至一存储段。具体地,所述上传模块202通过以下方式实现所述上传视频文件至S3服务器4并存储至一存储段的步骤:The uploading module 202 is configured to upload a video file to the
所述上传模块202定义上传的视频文件名称,并根据S3服务器4规范设定访问所述视频文件的访问权限。The uploading module 202 defines an uploaded video file name, and sets an access right to access the video file according to the
在本实施方式中,可以将mp4或者flv文件上传到S3服务器4的movie这个bucket(存储段),并将上传的文件名称命名为"video.mp4",同时设置访问权限为"public-read"以及对应的content-type,以s3cmd为例,其设置指令为:s3cmd put video.mp4s3://movie--acl-public。In this embodiment, the mp4 or flv file can be uploaded to the ticket (storage segment) of the movie of the
所述命令定义模块203,在所述nginx服务器5的配置文件中定义HTTP转换为HLS的命令。The command definition module 203 defines a command for converting HTTP to HLS in a configuration file of the
具体地,所述nginx服务器5包括rtmp模块,所述命令定义模块203,在所述nginx服务器5rtmp模块的配置文件中定义HTTP转换为HLS的命令;及替换配置文件中的代码{nginx_server}为nginx服务器5的IP或者域名。Specifically, the
其中,rtmp(Real Time Messaging Protocol)实时消息传送协议是Adobe Systems公司为Flash播放器和服务器之间音频、视频和数据传输开发的开放协议。HLS(HTTP Live Streaming)是Apple的动态码率自适应技术。主要用于PC和Apple终端的音视频服务。包括一个m3u(8)的索引文件,TS媒体分片文件和key加密串文件。通过HLS,可以实现视频文件分片发送,还可以对发送的视频文件进行加密处理。Among them, rtmp (Real Time Messaging Protocol) real-time messaging protocol is an open protocol developed by Adobe Systems for audio, video and data transmission between Flash player and server. HLS (HTTP Live Streaming) is Apple's dynamic rate adaptation technology. Mainly used for audio and video services of PC and Apple terminals. Includes an m3u (8) index file, TS media slice file and key encryption string file. Through HLS, video file fragmentation can be sent, and the transmitted video file can be encrypted.
在本实施方式中,具体使rtmp模块将HTTP转换为HLS的配置代码为:In this embodiment, the configuration code for specifically converting the HTTP to HLS by the rtmp module is:
在本实施方式中,使用ffmpeg将所述存储段中的视频文件以HTTP数据流的形式推送至所述nginx服务器5的具体代码体现为:ffmpeg-re-i http://s3.ceph.work/movie/video.mp4-c:v copy-c:a aac-ar 44100-ab 128k-ac 2-strict-2-f flv rtmp://{nginx_server}/myapp/movie。In this embodiment, the specific code that uses the ffmpeg to push the video file in the storage segment to the
所述推送模块204,用于通过所述调用接口将所述存储段中的视频文件以HTTP数据流的形式推送至所述nginx服务器5。具体地,所述推送模块204,使用ffmpeg来实现通过所述调用接口将所述存储段中的视频文件以HTTP数据流的形式推送至所述nginx服务器5的步骤。FFmpeg是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序。通过FFmpeg,可以使得存储段内的视频文件可以HTTP数据流的形式进行传输。The pushing module 204 is configured to push, by using the calling interface, the video file in the storage segment to the
所述发送模块205,用于通过所述HTTP转换为HLS的命令使得所述 nginx服务器5将所述视频文件的HTTP数据流转换为HLS数据流。在本实施方式中,HLS数据流的特性在于可以支持客户端对数据的下载。The sending module 205 is configured to enable the
具体地,在所述通过所述HTTP转换为HLS的命令使得所述nginx服务器5将所述视频文件的HTTP数据流转换为HLS数据流的步骤之前,所述发送模块205还用于连接所述客户端1至所述nginx服务器5。具体地,所述发送模块205通过预设播放器打开预设地址以实现将所述客户端1连接至所述nginx服务器5的步骤。Specifically, before the step of converting the HTTP data stream into the HLS by the HTTP to the
在本实施方式中,连接所述客户端1至所述nginx服务器5的方式可以通过如下手段实现:使用VLC播放器或者其他支持HLS的播放器打开预设地址,例如:http://{nginx_server}/myapp/movie.m3u8。In this embodiment, the manner of connecting the
所述播放模块206,用于命令所述客户端1下载所述HLS数据流。这样,用户在客户端1观看的视频数据具有可下载性。The playing module 206 is configured to instruct the
通过上述程序模块201-206,本申请所提出的视频文件处理程序200,首先,基于CEPH规范定义S3服务器4与nginx服务器5之间的调用接口;其次,上传视频文件至S3服务器4并存储至存储段;再次,在所述nginx服务器5的配置文件中定义HTTP转换为HLS的命令;然后,通过所述调用接口将所述存储段中的视频文件以HTTP数据流的形式推送至所述nginx服务器5;接着,通过所述HTTP转换为HLS的命令使得所述nginx服务器5将所述视频文件的HTTP数据流转换为HLS数据流;最后,命令所述客户端1下载所述HLS数据流。这样,既可以避免现有技术中nginx通过rtmp模块将视频文件以rtmp的直播流的形式传送至客户端1,客户端1无法针对本地存储的视频文件进行下载的弊端。又可以利用S3服务器4的特性实现视频文件的任意存储,保证视频文件存储的稳定性以及读取的便捷性,同时由于将现有的nginx服务器5和客户端1的rtmp协议转变成HLS,实现了视频数据的可下载性,同时也由于HLS的分发、加密特性,可以增加视频文件的安全性,同时还可以实现CDN分流。Through the above-mentioned program modules 201-206, the video file processing program 200 proposed by the present application firstly defines a calling interface between the
此外,本申请还提出一种视频文件处理方法。In addition, the present application also proposes a video file processing method.
参阅图4所示,是本申请视频文件处理方法第一实施例的实施流程示意图。在本实施例中,根据不同的需求,图4所示的流程图中的步骤的执行顺序可以改变,某些步骤可以省略。Referring to FIG. 4, it is a schematic flowchart of the implementation of the first embodiment of the video file processing method of the present application. In this embodiment, the order of execution of the steps in the flowchart shown in FIG. 4 may be changed according to different requirements, and some steps may be omitted.
步骤S401,基于CEPH规范定义S3服务器4与nginx服务器5之间的调用接口。Step S401, defining a calling interface between the
CEPH是一种分布式文件系统,其可以分为四个层次:(1)基础存储系统、(2)基础库librados、(3)高层应用接口:这一层包括了三个部分:RADOS GW(RADOS Gateway)、RBD(Reliable Block Device)和Ceph FS(Ceph File System),其作用是在librados库的基础上提供抽象层次更高、更便于应用或客户端1使用的上层接口,其中RADOS GW是一个提供与Amazon S3服务器4和Swift兼容的RESTful API的gateway,以供相应的对象存储应用开发使用。(4)应用层。上述CEPH具有CEPH规范,通过CEPH规范可以CEPH系统中各个层次之间的接口调用。CEPH is a distributed file system, which can be divided into four levels: (1) basic storage system, (2) basic library librados, (3) high-level application interface: this layer consists of three parts: RADOS GW ( RADOS Gateway), RBD (Reliable Block Device) and Ceph FS (Ceph File System), which provide an upper level interface with higher level of abstraction, easier application or
在上述CEPH系统中,其中一个层次——高层应用接口可以为外部相连的服务器或者客户端1提供上层接口,即CEPH可以规范自身同S3服务器4和nginx服务器5的调用接口,同时,由于S3服务器4是一种简单存储服务装置,存在特定的访问接口,CEPH可以通过规范定义S3服务器4和nginx服务器5在存储对象调用过程中的调用接口。In the above CEPH system, one of the layers - the high-level application interface can provide an upper-layer interface for the externally connected server or
步骤S402,上传视频文件至S3服务器4并存储至一存储段;具体地,所述上传视频文件至S3服务器4并存储至一存储段的具体步骤将在本申请视频文件处理方法第二实施例(图5)进行详述。Step S402, uploading the video file to the
步骤S403,在所述nginx服务器5的配置文件中定义HTTP转换为HLS的命令。Step S403, a command for converting HTTP to HLS is defined in a configuration file of the
步骤S404,通过所述调用接口将所述存储段中的视频文件以HTTP数据流的形式推送至所述nginx服务器5。具体地,所述应用服务器2,使用ffmpeg 来实现通过所述调用接口将所述存储段中的视频文件以HTTP数据流的形式推送至所述nginx服务器5的步骤。FFmpeg是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序。通过FFmpeg,可以使得存储段内的视频文件可以HTTP数据流的形式进行传输。Step S404, the video file in the storage segment is pushed to the
步骤S405,通过所述HTTP转换为HLS的命令使得所述nginx服务器5将所述视频文件的HTTP数据流转换为HLS数据流。Step S405, the command for converting to HTTP by the HTTP causes the
具体地,在所述通过所述HTTP转换为HLS的命令使得所述nginx服务器5将所述视频文件的HTTP数据流转换为HLS数据流发送至客户端1的步骤之前,所述应用服务器2还连接所述客户端1至所述nginx服务器5。具体地,所述应用服务器2通过预设播放器打开预设地址以实现将所述客户端1连接至所述nginx服务器5的步骤。Specifically, before the step of converting the HTTP data into HLS by the HTTP to the
在本实施方式中,连接所述客户端1至所述nginx服务器5的方式可以通过如下手段实现:使用VLC播放器或者其他支持HLS的播放器打开预设地址,例如:http://{nginx_server}/myapp/movie.m3u8。In this embodiment, the manner of connecting the
步骤S406,命令所述客户端1下载所述HLS数据流。这样,用户在客户端1观看的视频数据具有可下载性。Step S406, instructing the
通过上述步骤S401-406,本申请所提出的视频文件处理方法,首先,基于CEPH规范定义S3服务器4与nginx服务器5之间的调用接口;其次,上传视频文件至S3服务器4并存储至存储段;再次,在所述nginx服务器5的配置文件中定义HTTP转换为HLS的命令;然后,通过所述调用接口将所述存储段中的视频文件以HTTP数据流的形式推送至所述nginx服务器5;接着,通过所述HTTP转换为HLS的命令使得所述nginx服务器5将所述视频文件的HTTP数据流转换为HLS数据流;最后,命令所述客户端1下载所述HLS数据流。这样,既可以避免现有技术中nginx通过rtmp模块将视频文件以rtmp的直播流的形式传送至客户端1,客户端1无法针对本地存储的视频文件进行下载的弊端。又可以利用S3服务器4的特性实现视频文件存储的无限扩容, 保证视频文件存储的稳定性以及读取的便捷性,同时由于将现有的nginx服务器5和客户端1的rtmp协议转变成HLS,实现了视频数据的可下载性,同时也由于HLS的分发、加密特性,可以增加视频文件的安全性,同时还可以实现CDN分流。Through the above steps S401-406, the video file processing method proposed by the present application firstly defines a calling interface between the
参阅图5所示,是本申请视频文件处理方法第二实施例的实施流程示意图。在本实施例中,根据不同的需求,图5所示的流程图中的步骤的执行顺序可以改变,某些步骤可以省略。Referring to FIG. 5, it is a schematic flowchart of the implementation of the second embodiment of the video file processing method of the present application. In this embodiment, the order of execution of the steps in the flowchart shown in FIG. 5 may be changed according to different requirements, and some steps may be omitted.
在本实施例中,所述上传视频文件至S3服务器4并存储至一存储段的流程,具体包括如下步骤:In this embodiment, the process of uploading a video file to the
步骤S501,定义上传的视频文件名称。具体的名称根据用户需要自行设定。Step S501, defining an uploaded video file name. The specific name is set according to the user's needs.
步骤S502,根据S3服务器4规范设定访问所述视频文件的访问权限。Step S502, setting access rights for accessing the video file according to the
在本实施方式中,可以将mp4或者flv文件上传到S3服务器4的movie这个bucket(存储段),并将上传的文件名称命名为"video.mp4",同时设置访问权限为"public-read"以及对应的content-type,以s3cmd为例,其设置指令为:s3cmd put video.mp4s3://movie--acl-public。In this embodiment, the mp4 or flv file can be uploaded to the ticket (storage segment) of the movie of the
通过上述步骤S501-502,本申请所提出的视频文件处理方法,可以通过定义上传的视频文件名称以及根据S3规范设定访问所述视频文件的访问权限来上传视频文件至S3服务器4。这样,实现视频文件存储的无限扩容,保证视频文件存储的稳定性以及读取的便捷性。Through the above steps S501-502, the video file processing method proposed by the present application can upload the video file to the
参阅图6所示,是本申请视频文件处理方法第三实施例的实施流程示意图。在本实施例中,根据不同的需求,图6所示的流程图中的步骤的执行顺序可以改变,某些步骤可以省略。FIG. 6 is a schematic flowchart of an implementation process of a third embodiment of a video file processing method of the present application. In this embodiment, the order of execution of the steps in the flowchart shown in FIG. 6 may be changed according to different requirements, and some steps may be omitted.
在本实施例中,所述nginx服务器5包括rtmp模块,所述在nginx服务器5的配置文件中定义HTTP转换为HLS的命令的步骤的流程,具体包括如下步骤:In this embodiment, the
步骤S601,在所述nginx服务器5rtmp模块的配置文件中定义HTTP转换为HLS的命令。Step S601, a command for converting HTTP to HLS is defined in a configuration file of the nginx server 5rtmp module.
步骤S602,替换配置文件中的代码{nginx_server}为nginx服务器5的IP或者域名。In step S602, the code {nginx_server} in the replacement configuration file is the IP or domain name of the
本实施例中,rtmp(Real Time Messaging Protocol)实时消息传送协议是Adobe Systems公司为Flash播放器和服务器之间音频、视频和数据传输开发的开放协议。HLS(HTTP Live Streaming)是Apple的动态码率自适应技术,主要用于PC和Apple终端的音视频服务。包括一个m3u(8)的索引文件,TS媒体分片文件和key加密串文件。通过HLS,可以实现视频文件分片发送下载,还可以对发送的视频文件进行加密处理。In this embodiment, the rtmp (Real Time Messaging Protocol) real-time messaging protocol is an open protocol developed by Adobe Systems for audio, video, and data transmission between a Flash player and a server. HLS (HTTP Live Streaming) is Apple's dynamic rate adaptation technology, mainly used for audio and video services of PCs and Apple terminals. Includes an m3u (8) index file, TS media slice file and key encryption string file. Through HLS, video file fragmentation can be downloaded and downloaded, and the transmitted video file can be encrypted.
在本实施方式中,具体使rtmp模块将HTTP转换为HLS的配置代码为:In this embodiment, the configuration code for specifically converting the HTTP to HLS by the rtmp module is:
在本实施方式中,使用ffmpeg将所述存储段中的视频文件以HTTP数据流的形式推送至所述nginx服务器5的具体代码体现为:ffmpeg-re-i http://s3.ceph.work/movie/video.mp4-c:v copy-c:a aac-ar 44100-ab 128k-ac 2-strict-2-f flv rtmp://{nginx_server}/myapp/movie。In this embodiment, the specific code that uses the ffmpeg to push the video file in the storage segment to the
通过上述步骤S601-602,本申请所提出的视频文件处理方法,可以在nginx服务器5的配置文件中定义HTTP转换为HLS的命令。这样,由于HLS的分发、加密特性,可以增加视频文件的安全性,同时还可以实现CDN分流。Through the above steps S601-602, the video file processing method proposed by the present application can define a command of HTTP conversion to HLS in the configuration file of the
进一步地,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质存储有视频文件处理程序,所述视频文件处理程序可被至少一个处理器执行,以使所述至少一个处理器执行如上述的视频文件处理方法的步骤。Further, in order to achieve the above object, the present application further provides a computer readable storage medium storing a video file processing program, the video file processing program being executable by at least one processor, so that The at least one processor performs the steps of the video file processing method as described above.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the embodiments of the present application are merely for the description, and do not represent the advantages and disadvantages of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better. Implementation. Based on such understanding, 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 mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present application.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above is only a preferred embodiment of the present application, and is not intended to limit the scope of the patent application, and the equivalent structure or equivalent process transformations made by the specification and the drawings of the present application, or directly or indirectly applied to other related technical fields. The same is included in the scope of patent protection of this application.
Claims (20)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810003951.2A CN108429922B (en) | 2018-01-03 | 2018-01-03 | Video file processing method, application server and computer readable storage medium |
| CN201810003951.2 | 2018-01-03 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2019134248A1 true WO2019134248A1 (en) | 2019-07-11 |
Family
ID=63155823
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2018/077676 Ceased WO2019134248A1 (en) | 2018-01-03 | 2018-02-28 | Video file processing method, application server, and computer readable storage medium |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN108429922B (en) |
| WO (1) | WO2019134248A1 (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114827670A (en) * | 2022-06-30 | 2022-07-29 | 椭圆方程(深圳)信息技术有限公司 | Video playing method and device and electronic equipment |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109286820B (en) * | 2018-11-29 | 2019-08-06 | 无锡华云数据技术服务有限公司 | Stream media ordering method and system based on distributed memory system |
| CN111565168B (en) * | 2020-03-02 | 2023-05-23 | 杭州云毅网络科技有限公司 | Object storage method, system, storage medium and electronic equipment |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103986976A (en) * | 2014-06-05 | 2014-08-13 | 北京赛维安讯科技发展有限公司 | Content delivery network (CDN)-based transmission system and method |
| CN106791931A (en) * | 2017-01-05 | 2017-05-31 | 上海浦东软件园汇智软件发展有限公司 | A kind of method and apparatus of data flow transcoding |
| CN106803974A (en) * | 2017-03-01 | 2017-06-06 | 北京牡丹电子集团有限责任公司数字电视技术中心 | The real-time retransmission method of live video stream |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105681838A (en) * | 2015-12-30 | 2016-06-15 | 深圳市云宙多媒体技术有限公司 | Method and system for counting HLS live broadcast online users |
| CN105657440B (en) * | 2016-01-05 | 2018-11-13 | 福建星网智慧科技股份有限公司 | A kind of method and system of net cast |
| CN106791722A (en) * | 2017-03-07 | 2017-05-31 | 河海大学常州校区 | Sport Operations monitoring system based on mobile communication technology |
-
2018
- 2018-01-03 CN CN201810003951.2A patent/CN108429922B/en active Active
- 2018-02-28 WO PCT/CN2018/077676 patent/WO2019134248A1/en not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103986976A (en) * | 2014-06-05 | 2014-08-13 | 北京赛维安讯科技发展有限公司 | Content delivery network (CDN)-based transmission system and method |
| CN106791931A (en) * | 2017-01-05 | 2017-05-31 | 上海浦东软件园汇智软件发展有限公司 | A kind of method and apparatus of data flow transcoding |
| CN106803974A (en) * | 2017-03-01 | 2017-06-06 | 北京牡丹电子集团有限责任公司数字电视技术中心 | The real-time retransmission method of live video stream |
Non-Patent Citations (1)
| Title |
|---|
| GANG MIAO ET AL: "Design of Sports Competition Video Release System Based on Streaming Media Technology", MICROPROCESSORS, vol. 2016, no. 5, 31 October 2016 (2016-10-31), pages 84 - 88, XP055619368, ISSN: 1002-2279 * |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114827670A (en) * | 2022-06-30 | 2022-07-29 | 椭圆方程(深圳)信息技术有限公司 | Video playing method and device and electronic equipment |
Also Published As
| Publication number | Publication date |
|---|---|
| CN108429922B (en) | 2021-09-03 |
| CN108429922A (en) | 2018-08-21 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US12153873B2 (en) | Reducing time to first encrypted frame in a content stream | |
| US11178225B2 (en) | Data files synchronization with cloud storage service | |
| EP2588977B1 (en) | Systems and methods for storing digital content | |
| WO2021003750A1 (en) | File preview method, apparatus, and storage medium | |
| US20150019701A1 (en) | Systems and methods for providing notifications of changes in a cloud-based file system | |
| WO2015165395A1 (en) | Video playback method and apparatus | |
| US20140115029A1 (en) | Selective data transfer between a server and client | |
| RU2009135239A (en) | WAYS OF ACCESS TO REMOTE DATA FOR PORTABLE DEVICES | |
| CN102195790A (en) | Resource control method, device and system for peer-to-peer network | |
| US9292538B2 (en) | System and method for improved data accessibility | |
| US20100088394A1 (en) | Multipoint publishing | |
| US11716369B2 (en) | System and method of web streaming media content | |
| JP2017041232A (en) | Character transmission method, computer program, and character transmission system | |
| US20160308941A1 (en) | Instant File Upload To A Collaboration Service By Querying File Storage Systems That Are Both Internal And External To The Collaboration Service | |
| CN105025102A (en) | A network storage calling method and storage system for 3D printing model files | |
| CN111984615B (en) | A method, device and system for sharing files | |
| WO2019134248A1 (en) | Video file processing method, application server, and computer readable storage medium | |
| CN101150593A (en) | A method and system for uploading data | |
| US11647237B1 (en) | Method and apparatus for secure video manifest/playlist generation and playback | |
| US20140115091A1 (en) | Machine-implemented file sharing method for network storage system | |
| US20130275561A1 (en) | Adaptive and configurable content delivery and routing | |
| US20130024543A1 (en) | Methods for generating multiple responses to a single request message and devices thereof | |
| CN110636374A (en) | Method and apparatus for finding information | |
| WO2019134338A1 (en) | Video file processing method and program, application server, and storage medium | |
| CN105915570A (en) | Information sharing method and device |
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: 18898380 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 13/10/2020) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 18898380 Country of ref document: EP Kind code of ref document: A1 |