Python 为什么我的nginx endpoint通过ffmpeg流式传输音频失败,并出现“错误”;收到意外的TLS数据包“;
我正在使用nginx将请求代理到flask/gunicornapi。对于我的大多数端点,它工作得非常完美——然而,我有一个端点提供音频响应(通过ffmpeg),无论我尝试什么,它似乎都不工作。通过docker处理一切 这是我的nginx配置:Python 为什么我的nginx endpoint通过ffmpeg流式传输音频失败,并出现“错误”;收到意外的TLS数据包“;,python,docker,nginx,ssl,ffmpeg,Python,Docker,Nginx,Ssl,Ffmpeg,我正在使用nginx将请求代理到flask/gunicornapi。对于我的大多数端点,它工作得非常完美——然而,我有一个端点提供音频响应(通过ffmpeg),无论我尝试什么,它似乎都不工作。通过docker处理一切 这是我的nginx配置: server { listen $PORT; root /usr/share/nginx/html; index index.html index.html; access_log /var/log/nginx/reverse-acces
server {
listen $PORT;
root /usr/share/nginx/html;
index index.html index.html;
access_log /var/log/nginx/reverse-access.log;
error_log /var/log/nginx/reverse-error.log;
location / {
try_files $uri /index.html =404;
}
location /api/stream_audio_file {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Connection "keep-alive";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
下面是python的核心代码http://backend/api/stream_audio_file (通过烧瓶,gunicorn)
当我测试这个端点时,我将完整的ffmpeg日志粘贴到这里:
对于导入,它似乎可以正确获取mp3 url,但失败并出现错误:
[tls @ 0x555bf3011a80] An unexpected TLS packet was received.
https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3: I/O error
[out_0_0 @ 0x555bf302ab00] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
我试过很多东西:
Response(flask中带有上下文(..)的流)
也不起作用ffmpeg-I时https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3 -f mp3-to 00:00:02.000-vn-ab 256k-strict-2-loglevel跟踪
在请求上下文之外,它可以工作!tls@error:1408F1BB:SSL例程:ssl3\u get\u记录:错误记录类型
[tls @ 0x555bf3011a80] An unexpected TLS packet was received.
https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3: I/O error
[out_0_0 @ 0x555bf302ab00] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.