Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the video storage schemes based on s3cmd?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "what are the video storage solutions based on s3cmd". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Transformation target

1. Need to support rtmp playback and make as few changes to the existing architecture as possible

two。 Replace the existing local storage with S3 to minimize dependence on local storage.

3. Videos need to support hotlink protection and download protection.

Option 1 (back-end VOD mode)

Solution Overview: upload the video file (only mp4 and flv are supported) to S3, set its access permission to public, and play it using the play instruction of the rtmp module.

Operation flow 1. Upload video to S3

Upload the mp4 or flv file to the movie bucket of S3. For example, the name of the uploaded file is "video.mp4", and the access permission is set to "public-read". Pay attention to setting the corresponding content-type. Take s3cmd as an example.

S3cmd put video.mp4 s3://movie-- acl-public2. Configure the rtmp module of nginx

Configure the rtmp module of nginx and add the following to nginx.conf

Rtmp {server {listen 1935; application vod_http {play http://s3.ceph.wor/movie;} 3. Test access scenario 2 (backend push mode)

Solution Overview: upload the video file (only supports mp4 and flv) to S3 and set its access permission to public. The backend needs to push the HTTP data stream of S3 to nginx with the help of ffmpeg, and then convert it to HLS through the rtmp module.

Operation flow 1. Upload video to S3

Upload the mp4 or flv file to the movie bucket of S3. For example, the name of the uploaded file is "video.mp4", and the access permission is set to "public-read". Pay attention to setting the corresponding content-type. Take s3cmd as an example.

S3cmd put video.mp4 s3://movie-- acl-public2. Configure the rtmp module of nginx

/ etc/nginx/nginx.conf # nginx configuration file, please replace {nginx_server} with nginx server IP or domain name

Rtmp {server {listen 1935; application myapp {live on; hls on; hls_path / var/tmp/myapp; # hls files temporary storage directory hls_keys on; hls_key_path / var/tmp/keys # hls's encrypted key storage directory hls_key_url http://{nginx_server}/keys/; # key's external access path hls_fragments_per_key 10; # update key every 10 frames}}

/ etc/nginx/conf.d/hls.conf # site profile

Server {listen 80; location / keys {root / var/tmp;} location / myapp {# Serve HLS fragments types {application/vnd.apple.mpegurl m3u8; video/mp2t ts;} root / var/tmp; add_header Cache-Control no-cache }} Scheme comparison function solution 1 solution 2 frontend rtmp playback support frontend hls playback does not support S3 alternative local storage support hotlink protection download support (client receives rtmp) support (encrypted HLS shards, dynamic key) this is the end of the content of "what are the s3cmd-based video storage solutions". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report