HLS點播--FFmpeg接收udp視頻流

看到有網友問到,FFmpeg接收udp視頻流實現HLS直播的方法,我這裏由於沒有UDP的直播源就用VLC將一個MP4文件生成UDP視頻流來代替直播流。

1、確認Nginx安裝配置成功支持HLS,具體過程可參考我以前博客。

2、使用VLC生成UDP視頻流

3、FFmpeg接收udp流轉換成RTMP視頻流推送到Nginx上

ffmpeg -i udp://192.168.1.110:1234 -vcodec copy -acodec aac -ar 44100 -strict -2 -ac 1 -f flv -s 1280x720 -q 10 rtmp://192.168.1.110:1935/hls/test2

效果如下:

Input #0, mpegts, from 'udp://192.168.1.110:1234':
  Duration: N/A, start: 1904.952289, bitrate: N/A
  Program 1 
    Stream #0:0[0x45]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1280x554 [SAR 1:1 DAR 640:277], 23.98 fps, 25 tbr, 90k tbn, 47.96 tbc
Output #0, flv, to 'rtmp://192.168.1.110:1935/hls/test2':
  Metadata:
    encoder         : Lavf56.15.102
    Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 1280x554 [SAR 1:1 DAR 640:277], q=2-31, 23.98 fps, 1k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 3695 fps= 15 q=-1.0 size=   32812kB time=00:02:36.16 bitrate=1721.3kbits/s    

4、在手機瀏覽器中輸入地址

http://192.168.1.110/hls/test2.m3u8


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章