Set up an hls streaming media server using Nginx

Source: Internet
Author: User
Solution 1: ffmpeg + nginx the new ffmpeg already supports HLS. (I also participated in the code supply, to do an advertisement for myself :)) on-demand: generate hls fragment: ffmpeg-I & lt; media files & gt;-c: vlibx264-c: a-fhlsusrlocalnginxhtmltestm3u8 live broadcast first solution: ffmpeg + nginx new ffmpeg has supported HLS. (I also participated in the code provisioning and made an advertisement for myself) on-demand video: generate hls fragment: ffmpeg-I <媒体文件> -C: v libx264-c: a-f hls/usr/local/nginx/html/test. m3u8 live video: ffmpeg-I udp: // @: 1234-c: v libx264-c: a-f hls/usr/local/nginx/html/test. create a web server for m3u8: the default configuration is OK. Server {listen 80; server_name localhost; # charset KOI8-R; # access_log logs/host. access. log main; location/{root html; index index.html index.htm ;}} start nginx. Client Access: http://IP/test.m3u8 Vlc can be used for playback on windows. The second article uses nginx-rtmp-module rtmp {server {listen 1935; chunk_size 4000; # HLS # For HLS to work please create a directory in tmpfs (/tmp/app here) # for the fragments. the directory contents is served via HTTP (see # http {} section in config) # Incoming stream must be in H264/AAC. for iPhones use baseline H264 # profile (see ffmpeg example ). # This example creates RTMP stream from movie ready for HLS: # ffmpeg-loglevel verbose-re-I movie. avi-vcodec libx264 #-vprofile baseline-acodec libmp 3lame-ar 44100-ac 1 #-f flv rtmp: // localhost: 1935/hls/movie # If you need to transcode live stream use 'exec 'feature. # application hls {live on; hls on; hls_path/tmp/app; hls_fragment 5S; }}http {server {listen 80; location/hls {# Serve HLS fragments types {application/vnd. apple. mpegurl m3u8; video/mp2t ts;} alias/tmp/app; expires-1 ;}}}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.