Method for realizing H265 video stream based on nginx, electronic equipment, server and storage medium
By installing nginx and FFmpeg on the server and configuring transcoding that supports H265 video streams, the problem of low video stream conversion efficiency in front-end page development and testing is solved, and efficient video streaming and flexible parameter settings are achieved.
Patent Information
- Application Number
- CN202411532126.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-03-21
AI Technical Summary
The prior art cannot provide convenient and efficient video stream conversion solutions in front-end page development and testing, especially when using the H265 video encoding format.
By installing nginx and third-party transcoding software FFmpeg on the server, nginx is configured to support the transcoding of H265 video streams, and the function of converting local videos into H265 video streams is realized.
While ensuring video quality, significantly reduce the volume of the video stream, improve the transmission efficiency of the video stream, provide flexible parameter options and support for multiple video formats, and is suitable for different test scenarios.
Smart Images

Figure CN119676483A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the general technical field of front-end, and in particular relates to a method, electronic equipment, server and storage medium for implementing H265 video stream based on nginx. Background Art
[0002] With the rapid development of the Internet, video playback has become more and more common in our lives. Many websites need to use video streaming for content display, which has also led to the continuous development of video transcoding and compression technology. In video transcoding and compression technology, H265 is widely regarded as an efficient video encoding format with higher compression ratio and lower bit rate, so it can provide better video quality and faster transmission speed. As a widely used web server software, nginx can achieve high concurrency and high-performance web services. The defects in the existing technology are: it is impossible to provide a convenient and efficient video stream conversion solution in front-end page development and testing. Summary of the invention
[0003] In view of this, the present invention aims to propose a method, electronic device, server and storage medium for implementing H265 video streaming based on nginx, so as to provide a convenient and efficient video stream conversion solution in front-end page development and testing.
[0004] To achieve the above object, the technical solution of the present invention is achieved as follows:
[0005] A method for implementing H265 video streaming based on nginx, comprising the following steps:
[0006] S1. Install nginx: First, you need to install nginx on the server and install and configure it according to the official documentation;
[0007] S2. Install third-party transcoding software: Install the third-party transcoding software on the nginx server. After the third-party transcoding software is installed, you need to add the third-party transcoding software to the environment variables.
[0008] S3. Configure nginx: In the nginx configuration file, add transcoding configuration, including transcoding input, output, and transcoding format information.
[0009] Further, in step S1, install nginx: First, you need to install nginx on the server and install and configure it according to the official documentation, including:
[0010] S11. Install Nginx on Ubuntu.
[0011] S12. Install Nginx on CentOS.
[0012] S13. Configure Nginx. The configuration file of Nginx is located at / etc / nginx / nginx.conf.
[0013] Virtual host configuration files are located in / etc / nginx / sites-available / and / etc / nginx / sites-enabled / .
[0014] Furthermore, in step S11, Nginx is installed on Ubuntu, including:
[0015] S111, update package index;
[0016] S112. Install Nginx;
[0017] S113. Start Nginx;
[0018] S114. Set Nginx to start automatically at boot;
[0019] S115. Check the Nginx status;
[0020] S116. Access Nginx in a browser.
[0021] Furthermore, in step S12, Nginx is installed on CentOS, including:
[0022] S121. Install the EPEL repository;
[0023] S122, update package index;
[0024] S123. Install Nginx;
[0025] S124. Start Nginx.
[0026] S125. Set Nginx to start automatically at boot;
[0027] S126. Check the Nginx status;
[0028] S127. Access Nginx in the browser.
[0029] Further, in step S2, the third-party transcoding software is FFmpeg, and installing FFmpeg on the Nginx server includes:
[0030] S21. Install FFmpeg on Ubuntu 1. Update package index;
[0031] S22. Install FFmpeg on CentOS1. Install EPEL and Nux Dextop repositories;
[0032] S23. Perform a final check on all systems Finally, run the command to confirm that FFmpeg has been correctly installed and can be used normally.
[0033] Further, in step S21, FFmpeg1 is installed on Ubuntu. The update package index includes:
[0034] S211. Install FFmpeg;
[0035] S212, check FFmpeg installation;
[0036] S213. Add FFmpeg to the environment variables.
[0037] Furthermore, in step S3, the configuration is as follows:
[0038] Start nginx: Start the nginx server and access related video resources. Use nginx to convert local videos into H265 video streams.
[0039] An electronic device comprises a processor and a memory which is communicatively connected with the processor and is used to store instructions executable by the processor, wherein the processor is used to execute the method for realizing H265 video stream based on nginx.
[0040] A server includes at least one processor and a memory connected to the processor in communication, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the processor so that the at least one processor executes the method for implementing H265 video streaming based on nginx.
[0041] A computer-readable storage medium stores a computer program, characterized in that when the computer program is executed by a processor, the method for implementing H265 video streaming based on nginx is implemented.
[0042] Compared with the prior art, the method, electronic device, server and storage medium for implementing H265 video streaming based on nginx described in the present invention have the following advantages:
[0043] (1) The method, electronic device, server and storage medium for implementing H265 video stream based on nginx described in the present invention adopts H265 encoding technology, which can significantly reduce the volume of video stream while ensuring video quality, thereby improving the transmission efficiency of video stream. This is very important for front-end page development and testing, because it can greatly shorten the transmission time of video stream and improve testing efficiency.
[0044] (2) The method, electronic device, server and storage medium for implementing H265 video stream based on nginx described in the present invention have flexible parameter options, and the video stream can be customized according to the needs of the user. For example, the user can set the resolution, frame rate, bit rate and other parameters of the video stream to meet different test requirements. This makes the method more suitable for different test scenarios and can provide a more personalized solution.
[0045] (3) The method, electronic device, server and storage medium for implementing H265 video streaming based on nginx described in the present invention can also support the conversion of multiple video formats, including but not limited to common video formats such as MP4, AVI, MOV, etc. This provides users with a wider range of choices, allowing users to choose according to different test requirements.
[0046] (4) The method, electronic device, server and storage medium for implementing H265 video stream based on nginx described in the present invention can provide a more convenient and efficient solution for front-end page development and testing. It adopts H265 encoding technology, has flexible parameter options and supports multiple video formats, can be applied to different test scenarios, and can provide a more personalized solution. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:
[0048] Figure 1 The present invention is a flowchart of the method described in the embodiment of the present invention. DETAILED DESCRIPTION
[0049] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0050] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and the like are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", and the like may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.
[0051] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood by specific circumstances.
[0052] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0053] like Figure 1 As shown, a method for implementing H265 video streaming based on nginx includes the following steps:
[0054] S1. Install nginx: First, you need to install nginx on the server. You can install and configure it according to the official documentation.
[0055] S2. Install third-party transcoding software: Install third-party transcoding software on the nginx server. The present invention takes FFmpeg as an example. When installing FFmpeg, it should be noted that a version that supports H265 encoding needs to be installed. After FFmpeg is installed, FFmpeg needs to be added to the environment variables.
[0056] S3. Configure nginx: In the nginx configuration file, add transcoding configuration, including transcoding input, output, transcoding format and other information. The specific configuration is as follows:
[0057] Start nginx: Start the nginx server and access related video resources. You can use nginx to convert local videos into H265 video streams.
[0058] In step S1, install nginx: First, you need to install nginx on the server. You can install and configure it according to the official documentation, including:
[0059] The specific steps for installing Nginx depend on the operating system you are using. Here are the installation steps for common Linux distributions such as Ubuntu and CentOS:
[0060] S11. Install Nginx on Ubuntu:
[0061] S111, Update package index:
[0062] bash sudo apt update;
[0063] S112. Install Nginx:
[0064] bash sudo apt install nginx;
[0065] S113. Start Nginx:
[0066] bash sudo systemctl start nginx;
[0067] S114. Set Nginx to start automatically at boot:
[0068] bash sudo systemctl enable nginx;
[0069] S115. Check the Nginx status:
[0070] bash sudo systemctl status nginx;
[0071] S116. Access Nginx in the browser:
[0072] Open a browser and visit http: / / your_server_ip. If you see the Nginx default welcome page, the installation is successful.
[0073] S12. Install Nginx on CentOS:
[0074] S121. Install the EPEL repository (if not installed):
[0075] bash sudo yuminstall epel-release;
[0076] S122. Update package index:
[0077] bash sudo yum update;
[0078] S123. Install Nginx:
[0079] bash sudo yuminstall nginx;
[0080] S124. Start Nginx:
[0081] bash sudo systemctl start nginx;
[0082] S125. Set Nginx to start automatically at boot:
[0083] bash sudo systemctl enable nginx;
[0084] S126. Check Nginx status:
[0085] bash sudo systemctl status nginx;
[0086] S127. Access Nginx in the browser:
[0087] Open a browser and visit http: / / your_server_ip to confirm whether the installation is successful.
[0088] S13. Configure Nginx Nginx's configuration file is generally located at / etc / nginx / nginx.conf, and the virtual host configuration files are located at / etc / nginx / sites-available / and / etc / nginx / sites-enabled / (on Debian / Ubuntu). You can edit these files as needed to modify Nginx's behavior and settings.
[0089] After completing the installation and basic configuration, you can proceed to more complex configurations according to project requirements, such as setting up reverse proxy, load balancing, SSL, etc.
[0090] Note: Make sure the firewall allows HTTP and HTTPS traffic (TCP80 and 443). In addition, if you have applied for a domain name, you can configure Nginx accordingly.
[0091] In step S2, install third-party transcoding software: Install third-party transcoding software on the nginx server. The present invention takes FFmpeg as an example. When installing FFmpeg, it should be noted that the version that supports H265 encoding needs to be installed. After FFmpeg is installed, FFmpeg needs to be added to the environment variables.
[0092] The steps to install FFmpeg on the Nginx server are as follows. Ubuntu and CentOS are used as examples to ensure that H.265 encoding is supported.
[0093] S21. Install FFmpeg on Ubuntu 1. Update package index:
[0094] bash sudo apt update;
[0095] S211. Install FFmpeg:
[0096] In Ubuntu, you can directly install FFmpeg using the following command:
[0097] bash sudo apt install ffmpeg;
[0098] S212. Check FFmpeg installation (and supported encoding formats):
[0099] bash ffmpeg-codecs|grep h265;
[0100] This will display codecs associated with H.265, confirming that FFmpeg supports H.265 encoding.
[0101] S213. Add FFmpeg to the environment variables:
[0102] FFmpeg is usually installed in / usr / bin / ffmpeg, which is already in the default environment variable PATH. If you need to add it manually, you can edit the ~ / .bashrc or ~ / .bash_profile file and add the following line:
[0103] bash export PATH=$PATH: / usr / bin
[0104] After saving the file, run the following command to make it take effect:
[0105] bash source ~ / .bashrc.
[0106] S22. Install FFmpeg on CentOS 1. Install EPEL and Nux Dextop repositories (to get FFmpeg):
[0107] bash sudo yuminstall epel-release sudo rpm --import https: / / www.johnvansickle.com / ffmpeg / ffmpeg-release-64-bit-static.tar.xz;
[0108] S221. Install FFmpeg:
[0109] In CentOS, you can use the Nux Dextop repository to install FFmpeg: bash sudo yuminstallffmpeg ffmpeg-devel;
[0110] S222. Check FFmpeg installation (and supported encoding formats):
[0111] bash ffmpeg-codecs|grep h265;
[0112] S223. Add FFmpeg to the environment variables:
[0113] FFmpeg is usually installed in / usr / bin / ffmpeg, which is also usually in the PATH by default. If you need to add it manually, you can edit the ~ / .bashrc or ~ / .bash_profile file and add the following line:
[0114] bash export PATH=$PATH: / usr / bin
[0115] After saving the file, run the following command to make it take effect:
[0116] bash source ~ / .bashrc;
[0117] S23. Perform a final check on all systems. Finally, you can run the following command to confirm that FFmpeg has been correctly installed and can be used normally:
[0118] bashffmpeg-version;
[0119] This will display version information and build configuration for FFmpeg, ensuring H.265 support is included.
[0120] Note: In some cases, you may need to compile FFmpeg from source code to ensure that you have specific codec support. Please check the official documentation of FFmpeg for the latest installation method. After the installation is complete, you can combine Nginx for video transcoding and streaming services.
[0121] Through this method, users can convert local video files into H265 video streams and test and display them on the front-end page to develop and debug the page more accurately.
[0122] Compared with the prior art, the method provided by the present invention has the following advantages:
[0123] First of all, this method uses H265 encoding technology, which can significantly reduce the size of the video stream while ensuring the video quality, thereby improving the transmission efficiency of the video stream. This is very important for front-end page development and testing, because it can greatly shorten the transmission time of the video stream and improve the testing efficiency.
[0124] Secondly, this method has flexible parameter options, and the video stream can be customized according to the user's needs. For example, the user can set the resolution, frame rate, bit rate and other parameters of the video stream to meet different test requirements. This makes this method more suitable for different test scenarios and can provide a more personalized solution.
[0125] In addition, this method can also support the conversion of multiple video formats, including but not limited to MP4, AVI, MOV and other common video formats. This provides users with a wider range of choices, allowing users to choose according to different test requirements.
[0126] In summary, the video stream conversion method provided by the present invention can provide a more convenient and efficient solution for front-end page development and testing. It adopts H265 encoding technology, has flexible parameter options and supports multiple video formats, can be applied to different test scenarios, and can provide a more personalized solution.
[0127] The present invention also proposes an electronic device, comprising a processor and a memory that is communicatively connected to the processor and is used to store executable instructions of the processor, wherein the processor is used to execute the method for implementing H265 video streaming based on nginx.
[0128] The present invention also proposes a server, comprising at least one processor and a memory communicatively connected to the processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the processor so that the at least one processor executes the method for implementing H265 video streaming based on nginx.
[0129] The present invention also proposes a computer-readable storage medium storing a computer program, characterized in that: when the computer program is executed by a processor, the method for implementing H265 video streaming based on nginx is implemented.
[0130] The present invention is based on the capability of nginx and proposes a new method for converting local videos into H265 video streams. The method utilizes the modular architecture of nginx and combines third-party transcoding software to realize the function of converting local videos into H265 video streams.
[0131] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for implementing H265 video streaming based on nginx, characterized in that: The following steps are involved: S1. Install nginx: First, you need to install nginx on the server and install and configure it according to the official documentation; S2. Install third-party transcoding software: Install the third-party transcoding software on the nginx server. After the third-party transcoding software is installed, you need to add the third-party transcoding software to the environment variables. S3. Configure nginx: In the nginx configuration file, add transcoding configuration, including transcoding input, output, and transcoding format information.
2. According to a method for implementing H265 video streaming based on nginx according to claim 1, it is characterized in that: In step S1, install nginx: First, you need to install nginx on the server and install and configure it according to the official documentation, including: S11. Install Nginx on Ubuntu. S12. Install Nginx on CentOS. S13. Configure Nginx. The configuration file of Nginx is located at / etc / nginx / nginx.conf. Virtual host configuration files are located in / etc / nginx / sites-available / and / etc / nginx / sites-enabled / .
3. According to a method for implementing H265 video streaming based on nginx according to claim 2, it is characterized in that: In step S11, Nginx is installed on Ubuntu, including: S111, update package index; S112. Install Nginx; S113. Start Nginx; S114. Set Nginx to start automatically at boot; S115. Check the Nginx status; S116. Access Nginx in a browser.
4. According to a method for implementing H265 video streaming based on nginx according to claim 2, it is characterized in that: In step S12, Nginx is installed on CentOS, including: S121. Install the EPEL repository; S122, update package index; S123. Install Nginx; S124. Start Nginx. S125. Set Nginx to start automatically at boot; S126. Check the Nginx status. S127. Access Nginx in the browser.
5. According to a method for implementing H265 video streaming based on nginx according to claim 1, it is characterized in that: In step S2, the third-party transcoding software is FFmpeg, and installing FFmpeg on the Nginx server includes: S21. Install FFmpeg on Ubuntu 1. Update package index; S22. Install FFmpeg on CentOS1. Install EPEL and Nux Dextop repositories; S23. Perform a final check on all systems Finally, run the command to confirm that FFmpeg has been correctly installed and can be used normally.
6. According to a method for implementing H265 video streaming based on nginx according to claim 5, it is characterized in that: In step S21, install FFmpeg on Ubuntu 1. Update the package index, including: S211. Install FFmpeg; S212, check FFmpeg installation; S213. Add FFmpeg to the environment variables.
7. The method for implementing H265 video streaming based on nginx according to claim 1, characterized in that: In step S3, the configuration is as follows: Start nginx: Start the nginx server and access related video resources. Use nginx to convert local videos into H265 video streams.
8. An electronic device, comprising a processor and a memory connected to the processor for storing instructions executable by the processor, characterized in that: The processor is used to execute the method for implementing H265 video streaming based on nginx as described in any one of claims 1-7 above.
9. A server, characterized in that: It includes at least one processor and a memory communicatively connected to the processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the processor so that the at least one processor executes the method for implementing H265 video streaming based on nginx as described in any one of claims 1-7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for implementing H265 video streaming based on nginx as described in any one of claims 1 to 7 is implemented.
