[FFmpeg-user] Publish a HLS stream via a HTTPS server with ffmpeg and nginx.

Hongyi Zhao hongyi.zhao at gmail.com
Wed Feb 3 16:53:39 EET 2021


Hi,

On Ubuntu 20.04, I've built the docker image based my project located at
<https://github.com/hongyi-zhao/docker-nginx-rtmp>. The SSL relative
configuration has been enabled in the nginx.conf file used by the
above docker image,
see <https://github.com/hongyi-zhao/docker-nginx-rtmp/blob/master/nginx.conf>
for the detailed info. I then tried to
stream the camera using HLS, as described below.

Publish the stream:
$ docker run -it -p 1935:1935 -p 8000:80 --rm nginx-rtmp
$ ffmpeg -f pulse -i default -f v4l2 -r 30 -s 1920x1080 -i /dev/video0
-c:v libx264 -preset veryfast -b:v 3000k -maxrate 3000k -bufsize 3000k
-vf "scale=1280:-1,format=yuv420p" -g 60 -c:a aac -b:a 128k -ar 44100
-force_key_frames "expr:gte(t,n_forced*4)"  -f flv
"rtmp://localhost:1935/stream/surveillance"

As for watching the stream, I tried to use ffplay with http and https
protocal respectively, but the former can
successfully play the stream, the latter failed. The used commands
are shown below:

$ ffplay http://localhost:8000/live/surveillance.m3u8
$ ffplay https://localhost:8000/live/surveillance.m3u8
ffplay version N-100814-g911ba8417e Copyright (c) 2003-2021 the FFmpeg
developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --enable-gpl --enable-nonfree --enable-version3
--enable-debug --enable-ffplay --enable-indev=sndio
--enable-outdev=sndio --enable-fontconfig --enable-frei0r
--enable-openssl --enable-gmp --enable-libgme --enable-gray
--enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf
--enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband
--enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis
--enable-libopus --enable-libtheora --enable-libvidstab
--enable-libvo-amrwbenc --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d
--enable-libxvid --enable-libzvbi --enable-libzimg --enable-rpath
--enable-shared --enable-avisynth --enable-chromaprint --enable-gcrypt
--enable-ladspa --enable-libaribb24 --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libcelt --enable-libcdio
--enable-libcodec2 --enable-libdc1394 --enable-libfdk-aac
--enable-libflite --enable-libfontconfig --enable-libgsm
--enable-libiec61883 --enable-libjack --enable-libklvanc
--enable-liblensfun --enable-libmodplug --enable-libopenh264
--enable-libopenmpt --enable-libpulse --enable-librabbitmq
--enable-librsvg --enable-librtmp --enable-libshine --enable-libsnappy
--enable-libssh --enable-libtesseract --enable-libtwolame
--enable-libv4l2 --enable-libxavs2 --enable-libdavs2 --enable-libxcb
--enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape
--enable-libzmq --enable-lv2 --enable-libmysofa --enable-openal
--enable-opencl --enable-opengl --enable-pocketsphinx --enable-vulkan
--enable-libdrm --enable-libmfx --enable-pic --enable-lto
--enable-hardcoded-tables --enable-memory-poisoning --enable-ftrapv
--enable-linux-perf --enable-libsvtav1
  libavutil      56. 63.101 / 56. 63.101
  libavcodec     58.119.100 / 58.119.100
  libavformat    58. 65.101 / 58. 65.101
  libavdevice    58. 11.103 / 58. 11.103
  libavfilter     7. 97.100 /  7. 97.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
[tls @ 0x7f04f0004680] error:1408F10B:SSL
routines:ssl3_get_record:wrong version number
https://localhost:8000/live/surveillance.m3u8: Input/output error

Any hints/notes/comments for solving this problem are highly appreciated.

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao at gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic University of Science and Technology engineering
NO. 552 North Gangtie Road, Xingtai, China


More information about the ffmpeg-user mailing list