Opened 4 years ago

Last modified 4 years ago

#8566 new defect

HTTP method ignored on retry

Reported by: vschweitzer Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: http
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

When FFmpeg fails to upload a file to a server using the
specified method (in this example PUT) it retries using a different method.

This behavior was tested on NGINX with the same config as in
#8561. The configuration is also listed in the comments.

For a server running on port 45000 the following command is used:

ffmpeg -y -hide_banner -f lavfi -i color=c=black:s=1920x1080:r=25 -vcodec libx264 -f hls -method PUT -http_persistent 1 http://127.0.0.1:45000/streams/index.m3u8

Note that the method is set to PUT.
If one segment fails to upload, FFmpeg will retry:

[hls @ 00000272de1b4f00] Opening 'http://127.0.0.1:45000/streams/index0.ts' for writing
[hls @ 00000272de1b4f00] upload segment failed, will retry with a new http session.
[hls @ 00000272de1b4f00] Opening 'http://127.0.0.1:45000/streams/index0.ts' for writing

(Full uncut output attached)

This retry will be made via POST request as opposed to the
specified PUT.

Attachments (3)

put_post.log (3.8 KB ) - added by vschweitzer 4 years ago.
Console output of FFmpeg
put_post_wireshark.png (3.4 KB ) - added by vschweitzer 4 years ago.
Change of request method as seen in Wireshark
1584089190256.jpg (602.4 KB ) - added by Steven Liu 4 years ago.
wiresharkbysteven

Download all attachments as: .zip

Change History (5)

by vschweitzer, 4 years ago

Attachment: put_post.log added

Console output of FFmpeg

by vschweitzer, 4 years ago

Attachment: put_post_wireshark.png added

Change of request method as seen in Wireshark

comment:1 by vschweitzer, 4 years ago

NGINX Configuration

In front of "server {...}":

map $request_method $my_proxy_method {
  default $request_method;
  POST PUT;
}

In "server {...}":

location /streams/ {
    proxy_pass http://127.0.0.1:45000/test/;
    proxy_method $my_proxy_method;
    proxy_ignore_client_abort on;
}

location /test/ {
    root   html;
    index  index.html index.htm;
    dav_methods PUT DELETE MKCOL COPY MOVE;
    dav_access all:rw;
    create_full_put_path on;
    client_max_body_size 10000m;
}

This will redirect all requests to /streams/ to /test/ with
each POST request replaced by a PUT.

by Steven Liu, 4 years ago

Attachment: 1584089190256.jpg added

wiresharkbysteven

comment:2 by Steven Liu, 4 years ago

I cannot reproduce it

this is my nginx config

    map $request_method $my_proxy_method {
        default $request_method;
        POST PUT;
    }
    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        location / {
            root   html;
            create_full_put_path  on;
            keepalive_requests 11;
            dav_access            group:rw  all:r;
            dav_methods PUT DELETE MKCOL COPY MOVE;
            index  index.html index.htm;
            client_max_body_size 10000m;
        }

output message:

liuqi05:dash liuqi$ ./ffmpeg -y -hide_banner -f lavfi -i color=c=black:s=1920x1080:r=25 -vcodec libx264 -f hls -method PUT -http_persistent 1 -g 25 -hls_time 1 http://127.0.0.1/streams/index.m3u8
Input #0, lavfi, from 'color=c=black:s=1920x1080:r=25':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x7fdb75804600] using SAR=1/1
[libx264 @ 0x7fdb75804600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7fdb75804600] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x7fdb75804600] 264 - core 159 r2991 1771b55 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=25 keyint_min=2 scenecut=40 intra_refresh=0 rc_lookahead=25 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, hls, to 'http://127.0.0.1/streams/index.m3u8':
  Metadata:
    encoder         : Lavf58.41.100
    Stream #0:0: Video: h264 (libx264), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.75.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
[hls @ 0x7fdb75801200] Opening 'http://127.0.0.1/streams/index0.ts' for writing
[http @ 0x7fdb76141a00] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb76141a00] Opening 'http://127.0.0.1/streams/index1.ts' for writing
[http @ 0x7fdb76141a00] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb76141a00] Opening 'http://127.0.0.1/streams/index2.ts' for writing
[http @ 0x7fdb76141a00] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb76141a00] Opening 'http://127.0.0.1/streams/index3.ts' for writing
[http @ 0x7fdb76141a00] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb76141a00] Opening 'http://127.0.0.1/streams/index4.ts' for writing
[http @ 0x7fdb76141a00] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb76141a00] Opening 'http://127.0.0.1/streams/index5.ts' for writing
[http @ 0x7fdb76141a00] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb747037c0] URL read error: End of file
[hls @ 0x7fdb75801200] upload playlist failed, will retry with a new http session.
[http @ 0x7fdb78008000] Opening 'http://127.0.0.1/streams/index6.ts' for writing
[http @ 0x7fdb78008000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb78008000] Opening 'http://127.0.0.1/streams/index7.ts' for writing
[http @ 0x7fdb78008000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb78008000] Opening 'http://127.0.0.1/streams/index8.ts' for writing
[http @ 0x7fdb78008000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb78008000] Opening 'http://127.0.0.1/streams/index9.ts' for writing
[http @ 0x7fdb78008000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb78008000] Opening 'http://127.0.0.1/streams/index10.ts' for writing
[http @ 0x7fdb78008000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb78008000] Opening 'http://127.0.0.1/streams/index11.ts' for writing
[http @ 0x7fdb76900080] URL read error: End of file
[hls @ 0x7fdb75801200] upload segment failed, will retry with a new http session.
[hls @ 0x7fdb75801200] Opening 'http://127.0.0.1/streams/index11.ts' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index12.ts' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index13.ts' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index14.ts' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index15.ts' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index16.ts' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb7440c4c0] URL read error: End of file
[hls @ 0x7fdb75801200] upload playlist failed, will retry with a new http session.
[http @ 0x7fdb77810000] Opening 'http://127.0.0.1/streams/index17.ts' for writing
[http @ 0x7fdb77810000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb77810000] Opening 'http://127.0.0.1/streams/index18.ts' for writing
[http @ 0x7fdb77810000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb77810000] Opening 'http://127.0.0.1/streams/index19.ts' for writing
[http @ 0x7fdb77810000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb77810000] Opening 'http://127.0.0.1/streams/index20.ts' for writing
[http @ 0x7fdb77810000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb77810000] Opening 'http://127.0.0.1/streams/index21.ts' for writing
[http @ 0x7fdb77810000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb77810000] Opening 'http://127.0.0.1/streams/index22.ts' for writing
[http @ 0x7fdb76a000c0] URL read error: End of file
[hls @ 0x7fdb75801200] upload segment failed, will retry with a new http session.
[hls @ 0x7fdb75801200] Opening 'http://127.0.0.1/streams/index22.ts' for writing
[http @ 0x7fdb79003800] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb79003800] Opening 'http://127.0.0.1/streams/index23.ts' for writing
[http @ 0x7fdb79003800] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb79003800] Opening 'http://127.0.0.1/streams/index24.ts' for writing
[http @ 0x7fdb79003800] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb79003800] Opening 'http://127.0.0.1/streams/index25.ts' for writing
[http @ 0x7fdb79003800] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb79003800] Opening 'http://127.0.0.1/streams/index26.ts' for writing
[http @ 0x7fdb79003800] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb79003800] Opening 'http://127.0.0.1/streams/index27.ts' for writing
[http @ 0x7fdb79003800] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb76e004c0] URL read error: End of file
[hls @ 0x7fdb75801200] upload playlist failed, will retry with a new http session.
[http @ 0x7fdb76016c00] Opening 'http://127.0.0.1/streams/index28.ts' for writing
[http @ 0x7fdb76016c00] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb76016c00] Opening 'http://127.0.0.1/streams/index29.ts' for writing
[http @ 0x7fdb76016c00] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb76016c00] Opening 'http://127.0.0.1/streams/index30.ts' for writing
[http @ 0x7fdb76016c00] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb76016c00] Opening 'http://127.0.0.1/streams/index31.ts' for writing
[http @ 0x7fdb76016c00] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb76016c00] Opening 'http://127.0.0.1/streams/index32.ts' for writing
[http @ 0x7fdb76016c00] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb76016c00] Opening 'http://127.0.0.1/streams/index33.ts' for writing
[http @ 0x7fdb74701140] URL read error: End of file
[hls @ 0x7fdb75801200] upload segment failed, will retry with a new http session.
[hls @ 0x7fdb75801200] Opening 'http://127.0.0.1/streams/index33.ts' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index34.ts' for writing
[http @ 0x7fdb74835000] Opening 'http://127.0.0.1/streams/index.m3u8' for writing
[http @ 0x7fdb7440c440] URL read error: End of file
[hls @ 0x7fdb75801200] upload playlist failed, will retry with a new http session.
frame=  857 fps=315 q=-1.0 Lsize=N/A time=00:00:34.20 bitrate=N/A speed=12.6x
video:72kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x7fdb75804600] frame I:35    Avg QP: 6.11  size:   423
[libx264 @ 0x7fdb75804600] frame P:206   Avg QP: 9.03  size:    76
[libx264 @ 0x7fdb75804600] frame B:616   Avg QP:12.72  size:    69
[libx264 @ 0x7fdb75804600] consecutive B-frames:  4.1%  0.2%  0.0% 95.7%
[libx264 @ 0x7fdb75804600] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0x7fdb75804600] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.0%  0.0%  0.0%  0.0%  0.0%    skip:100.0%
[libx264 @ 0x7fdb75804600] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.0%  0.0%  0.0%  direct: 0.0%  skip:100.0%
[libx264 @ 0x7fdb75804600] 8x8 transform intra:0.0%
[libx264 @ 0x7fdb75804600] coded y,uvDC,uvAC intra: 0.0% 0.0% 0.0% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x7fdb75804600] i16 v,h,dc,p: 99%  0%  1%  0%
[libx264 @ 0x7fdb75804600] i8c dc,h,v,p: 100%  0%  0%  0%
[libx264 @ 0x7fdb75804600] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fdb75804600] kb/s:16.96

and attechment file is wireshark.
wiresharkbysteven

Note: See TracTickets for help on using tickets.