minimal setup for HTTPS streaming of FLV: HTTPS streaming 傳輸 flv 檔案的最小實現

这篇博客介绍了如何基于Simple TLS Server创建一个HTTPS传输FLV文件的最小实现,作为公司的proof of concept。内容包括源代码分享、使用方法以及HTTPS传输的基本概念。作者强调HTTPS streaming是在HTTP-FLV基础上增加SSL/TLS加密握手过程,要注意VLC播放器需验证安全证书,而Web浏览器需使用支持HTTPS的播放器,并可能需要忽略证书错误选项。
摘要由CSDN通过智能技术生成

近來公司有 HTTPS 傳輸影音的需求,於是就基於Simple TLS Server寫了一個用 https 傳輸FLV檔案的最小實現當作proof of concept 這樣。

Source code 源碼

github download
Makefile need openssl ,要是buildroot 沒有就只能自備了

-lev -lssl -lz -lcrypto
Usage
[root@:]# ./https_flv_file_test -h
Usage
-p port number
-s flv format src file
-c cert.pem file
-k private key file
-h help
Concepts description

概念上一個 HTTPS in c需要的步驟
HTTPs in C needs the fallowing steps

  • create ssl
    SSL_CTX *ctx;
    init_openssl();
    ctx = create_context();

As normal tcpsocket link

  • SSL_write(…) == send(…)
  • SSL_read(…) == recv(…)
  • end ssl
        SSL_shutdown(ssl);
        SSL_free(ssl);
        close(client);
  • close tcp socket
  • release ssl
    SSL_CTX_free(ctx);
    cleanup_openssl();

In fact, HTTPS streaming is essentially HTTP-FLV with an additional layer of SSL/TLS encryption for the handshake process. The HTTP messages and FLV format inside are exactly the same as in HTTP-FLV.

Points to note:

  1. VLC requires a valid security certificate to play HTTPS streams.
  2. A media player that supports HTTPS must be used in the web browser to receive HTTPS streaming.
  3. When running the browser, it is necessary to add the flag --ignore-certificate-errors.

其實https streaming 就是在 http-flv 的基礎加一層 SSL/TLS 加密的握手過程,裡面的http報文與flv 格式與http-flv 完全一樣。
需要特別注意的是:

  1. vlc 必須通過安全憑證才能撥放 https
  2. 在 web browser 需要使用 https 的播放器才能收https streamming
  3. 並且運行瀏覽器的時候需要加上 --ignore-certificate-errors
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --ignore-certificate-errors
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值