简体   繁体   English

ffmpeg hls stream 到 nginx webdav。 删除旧段

[英]ffmpeg hls stream to nginx webdav. Remove old segments

I'm trying to stream mp4 file in loop to my nginx server.我正在尝试将 stream mp4 文件循环到我的 nginx 服务器。 And i need to remove old segments:我需要删除旧段:

ffmpeg -re -stream-loop -1 -i /data/samples/BigBuckBunny.mp4 -c copy -f hls -hls_time 5 -hls_flags delete_segments -hls_list_size 5 http://127.0.0.1:8080/upload/stream.m3u8 ffmpeg -re -stream-loop -1 -i /data/samples/BigBuckBunny.mp4 -c copy -f hls -hls_time 5 -hls_flags delete_segments -hls_list_size 5 http0.0/127/1.0.0/上传

Everythink is ok, but when ffmpeg tries to remove old segment I've got this error in nginx: Everythink 没问题,但是当 ffmpeg 尝试删除旧段时,我在 nginx 中遇到此错误:

[error] 22#22: *73174 DELETE with body is unsupported, client: 127.0.0.1, server: _, request: "DELETE /upload/stream16.ts HTTP/1.1", host: "127.0.0.1:8080" [错误] 22#22: *73174 DELETE with body 不受支持,客户端:127.0.0.1,服务器:_,请求:“DELETE /upload/stream16.ts HTTP/1.1”,主机:“127.0.0.1:8080”

My nginx config:我的 nginx 配置:

location /upload {
        root /data/live;
        dav_access user:rw group:rw all:rw;
        dav_methods PUT DELETE MKCOL COPY MOVE;
        create_full_put_path on;
        charset utf-8;
        autoindex on;   }

ffmpeg 4.4.1 ffmpeg 4.4.1

nginx 1.21.4 nginx 1.21.4

What I'm doing wrong?我做错了什么?

It seems that the ffmpeg http muxer that underlies the hls muxer defaults to chunked transfer encoding.似乎作为 hls 多路复用器基础的 ffmpeg http 多路复用器默认为分块传输编码。 When the DELETE request is made there is no body, but ffmpeg still makes the request with a single zero-length chunk.当发出 DELETE 请求时,没有正文,但 ffmpeg 仍然使用单个零长度块发出请求。

The error message in nginx could be slightly more helpful. nginx 中的错误消息可能会更有帮助。 Indeed, it does not support webdav DELETE requests with a body, but it also does not support DELETE requests which are marked as chunked transfer encoded, regardless of whether there is a body (see: https://github.com/nginx/nginx/blob/master/src/http/modules/ngx_http_dav_module.c#L315 ), hence the error.实际上,它不支持带有正文的 webdav DELETE 请求,但它也不支持标记为分块传输编码的 DELETE 请求,无论是否有正文(参见: https://github.com/nginx/nginx /blob/master/src/http/modules/ngx_http_dav_module.c#L315 ),因此出现错误。

It looks like it should be possible to disabled this using the chunked_post option, but it doesn't appear to be working.看起来应该可以使用chunked_post选项禁用它,但它似乎不起作用。 Not sure if this is a bug or not.不确定这是否是错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM