[FFmpeg-trac] #7975(avformat:closed): HLS HTTP PUT fails with http_persistent and connection closed

FFmpeg trac at avcodec.org
Sat Sep 4 08:27:04 EEST 2021


#7975: HLS HTTP PUT fails with http_persistent and connection closed
------------------------------------+------------------------------------
             Reporter:  ianklassen  |                    Owner:  (none)
                 Type:  defect      |                   Status:  closed
             Priority:  normal      |                Component:  avformat
              Version:  git-master  |               Resolution:  fixed
             Keywords:  hls http    |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------
Comment (by ushadow):

 When I tested HLS HTTP PUT with HTTPS, http_persistent and schannel
 enabled on Windows, it doesn't work. It worked before and someone bisected
 the problem to commit f267a2ac9c740c77cee2f2c5fd2bd9bc048768b1 related to
 this ticket. Please see #9010. Could you please double check if this
 change works for HTTPS with schannel and http_persistent on Windows?

 ffmpeg output:
 {{{
 $ ffmpeg -report -re -i "bbb_sunflower_1080p_30fps_normal.ts" -acodec copy
 -vcodec copy -g 60 -hls_flags +append_list -hls_list_size 0
 -hls_playlist_type event -hls_time 6 -keyint_min 60 -method PUT
 -http_persistent 1 -sc_threshold 0 https://127.0.0.1/stream.m3u8
 ffmpeg started on 2021-09-04 at 06:13:50
 Report written to "ffmpeg-20210904-061350.log"
 Log level: 48
 ffmpeg version N-103483-gf3f9041302 Copyright (c) 2000-2021 the FFmpeg
 developers
   built with gcc 11 (GCC)
   configuration: --arch=x86_64 --target-os=mingw32 --cross-
 prefix=x86_64-w64-mingw32- --prefix=/usr/local --pkg-config=pkg-config
 --pkg-config-flags=--static --extra-cflags=-static --extra-ldflags=
 -static --extra-libs='-lm -lz -fopenmp' --enable-static --disable-shared
 --enable-nonfree --enable-gpl --enable-libfdk-aac --enable-libfribidi
 --enable-libx264 --enable-schannel
   libavutil      57.  4.101 / 57.  4.101
   libavcodec     59.  7.100 / 59.  7.100
   libavformat    59.  5.100 / 59.  5.100
   libavdevice    59.  0.101 / 59.  0.101
   libavfilter     8.  7.100 /  8.  7.100
   libswscale      6.  0.100 /  6.  0.100
   libswresample   4.  0.100 /  4.  0.100
   libpostproc    56.  0.100 / 56.  0.100
 Guessed Channel Layout for Input Stream #0.1 : 5.1
 Input #0, mpegts, from 'bbb_sunflower_1080p_30fps_normal.ts':
   Duration: 00:10:34.62, start: 1.400000, bitrate: 3600 kb/s
   Program 1
     Metadata:
       service_name    : Big Buck Bunny, Sunflower version
       service_provider: FFmpeg
   Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B),
 yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k
 tbn
   Stream #0:1[0x101](und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000
 Hz, 5.1, fltp, 394 kb/s
 [https @ 000001f637220a80] HTTP error 404 Not Found
 Output #0, hls, to 'https://127.0.0.1/stream.m3u8':
   Metadata:
     encoder         : Lavf59.5.100
   Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B),
 yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 30
 tbr, 90k tbn
   Stream #0:1(und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz,
 5.1, fltp, 394 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #0:1 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 [hls @ 000001f637409040] Opening 'https://127.0.0.1/stream0.ts' for
 writingx

 (No more output for a long time.)
 }}}

 ffmpeg log:
 {{{
 fmpeg started on 2021-09-04 at 06:13:50
 Report written to "ffmpeg-20210904-061350.log"
 Log level: 48
 Command line:
 "C:\\cygwin64\\usr\\local\\bin\\ffmpeg.exe" -report -re -i
 bbb_sunflower_1080p_30fps_normal.ts -acodec copy -vcodec copy -g 60
 -hls_flags +append_list -hls_list_size 0 -hls_playlist_type event
 -hls_time 6 -keyint_min 60 -method PUT -http_persistent 1 -sc_threshold 0
 https://127.0.0.1/stream.m3u8
 ffmpeg version N-103483-gf3f9041302 Copyright (c) 2000-2021 the FFmpeg
 developers
   built with gcc 11 (GCC)
   configuration: --arch=x86_64 --target-os=mingw32 --cross-
 prefix=x86_64-w64-mingw32- --prefix=/usr/local --pkg-config=pkg-config
 --pkg-config-flags=--static --extra-cflags=-static --extra-ldflags=-static
 --extra-libs='-lm -lz -fopenmp' --enable-static --disable-shared --enable-
 nonfree --enable-gpl --enable-libfdk-aac --enable-libfribidi --enable-
 libx264 --enable-schannel
   libavutil      57.  4.101 / 57.  4.101
   libavcodec     59.  7.100 / 59.  7.100
   libavformat    59.  5.100 / 59.  5.100
   libavdevice    59.  0.101 / 59.  0.101
   libavfilter     8.  7.100 /  8.  7.100
   libswscale      6.  0.100 /  6.  0.100
   libswresample   4.  0.100 /  4.  0.100
   libpostproc    56.  0.100 / 56.  0.100
 Splitting the commandline.
 Reading option '-report' ... matched as option 'report' (generate a
 report) with argument '1'.
 Reading option '-re' ... matched as option 're' (read input at native
 frame rate; equivalent to -readrate 1) with argument '1'.
 Reading option '-i' ... matched as input url with argument
 'bbb_sunflower_1080p_30fps_normal.ts'.
 Reading option '-acodec' ... matched as option 'acodec' (force audio codec
 ('copy' to copy stream)) with argument 'copy'.
 Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
 ('copy' to copy stream)) with argument 'copy'.
 Reading option '-g' ... matched as AVOption 'g' with argument '60'.
 Reading option '-hls_flags' ... matched as AVOption 'hls_flags' with
 argument '+append_list'.
 Reading option '-hls_list_size' ... matched as AVOption 'hls_list_size'
 with argument '0'.
 Reading option '-hls_playlist_type' ... matched as AVOption
 'hls_playlist_type' with argument 'event'.
 Reading option '-hls_time' ... matched as AVOption 'hls_time' with
 argument '6'.
 Reading option '-keyint_min' ... matched as AVOption 'keyint_min' with
 argument '60'.
 Reading option '-method' ... matched as AVOption 'method' with argument
 'PUT'.
 Reading option '-http_persistent' ... matched as AVOption
 'http_persistent' with argument '1'.
 Reading option '-sc_threshold' ... matched as AVOption 'sc_threshold' with
 argument '0'.
 Reading option 'https://127.0.0.1/stream.m3u8' ... matched as output url.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option report (generate a report) with argument 1.
 Successfully parsed a group of options.
 Parsing a group of options: input url bbb_sunflower_1080p_30fps_normal.ts.
 Applying option re (read input at native frame rate; equivalent to
 -readrate 1) with argument 1.
 Successfully parsed a group of options.
 Opening an input file: bbb_sunflower_1080p_30fps_normal.ts.
 [NULL @ 000001f635479300] Opening 'bbb_sunflower_1080p_30fps_normal.ts'
 for reading
 [file @ 000001f63547a440] Setting default whitelist 'file,crypto,data'
 [mpegts @ 000001f635479300] Format mpegts probed with size=2048 and
 score=50
 [mpegts @ 000001f635479300] stream=0 stream_type=1b pid=100 prog_reg_desc=
 [mpegts @ 000001f635479300] stream=1 stream_type=f pid=101 prog_reg_desc=
 [mpegts @ 000001f635479300] Before avformat_find_stream_info() pos: 0
 bytes read:32768 seeks:0 nb_streams:2
 [mpegts @ 000001f635479300] probing stream 1 pp:2500
 [mpegts @ 000001f635479300] Probe with size=2758, packets=1 detected aac
 with score=51
 [mpegts @ 000001f635479300] probed stream 1
 [extract_extradata @ 000001f636e75900] nal_unit_type: 9(AUD), nal_ref_idc:
 0
 [extract_extradata @ 000001f636e75900] nal_unit_type: 7(SPS), nal_ref_idc:
 3
 [extract_extradata @ 000001f636e75900] nal_unit_type: 8(PPS), nal_ref_idc:
 3
 [extract_extradata @ 000001f636e75900] nal_unit_type: 6(SEI), nal_ref_idc:
 0
 [extract_extradata @ 000001f636e75900] nal_unit_type: 5(IDR), nal_ref_idc:
 3
 [h264 @ 000001f63547c040] nal_unit_type: 9(AUD), nal_ref_idc: 0
 [h264 @ 000001f63547c040] nal_unit_type: 7(SPS), nal_ref_idc: 3
 [h264 @ 000001f63547c040] nal_unit_type: 8(PPS), nal_ref_idc: 3
 [h264 @ 000001f63547c040] nal_unit_type: 6(SEI), nal_ref_idc: 0
 [h264 @ 000001f63547c040] nal_unit_type: 5(IDR), nal_ref_idc: 3
 [h264 @ 000001f63547c040] Format yuv420p chosen by get_format().
 [h264 @ 000001f63547c040] Reinit context to 1920x1088, pix_fmt: yuv420p
 [h264 @ 000001f63547c040] no picture
 [mpegts @ 000001f635479300] max_analyze_duration 5000000 reached at
 5013333 microseconds st:1
 [mpegts @ 000001f635479300] Packet had TEI flag set; marking as corrupt
 [mpegts @ 000001f635479300] After avformat_find_stream_info() pos: 0 bytes
 read:938128 seeks:2 frames:389
 Guessed Channel Layout for Input Stream #0.1 : 5.1
 Input #0, mpegts, from 'bbb_sunflower_1080p_30fps_normal.ts':
   Duration: 00:10:34.62, start: 1.400000, bitrate: 3600 kb/s
   Program 1
     Metadata:
       service_name    : Big Buck Bunny, Sunflower version
       service_provider: FFmpeg
   Stream #0:0[0x100], 151, 1/90000: Video: h264 (High) ([27][0][0][0] /
 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30
 tbr, 90k tbn
   Stream #0:1[0x101](und), 238, 1/90000: Audio: aac (LC) ([15][0][0][0] /
 0x000F), 48000 Hz, 5.1, fltp, 394 kb/s
 Successfully opened the file.
 Parsing a group of options: output url https://127.0.0.1/stream.m3u8.
 Applying option acodec (force audio codec ('copy' to copy stream)) with
 argument copy.
 Applying option vcodec (force video codec ('copy' to copy stream)) with
 argument copy.
 Successfully parsed a group of options.
 Opening an output file: https://127.0.0.1/stream.m3u8.
 Successfully opened the file.
 [mpegts @ 000001f6376b7d00] service 1 using PCR in pid=256, pcr_period=0ms
 [mpegts @ 000001f6376b7d00] muxrate VBR, sdt every 1073741822000 ms,
 pat/pmt every 1073741822000 ms
 [https @ 000001f637220a80] Setting default whitelist
 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
 [tcp @ 000001f637010c80] Original list of addresses:
 [tcp @ 000001f637010c80] Address 127.0.0.1 port 443
 [tcp @ 000001f637010c80] Interleaved list of addresses:
 [tcp @ 000001f637010c80] Address 127.0.0.1 port 443
 [tcp @ 000001f637010c80] Starting connection attempt to 127.0.0.1 port 443
 [tcp @ 000001f637010c80] Successfully connected to 127.0.0.1 port 443
 [https @ 000001f637220a80] request: GET /stream.m3u8 HTTP/1.1
 User-Agent: Lavf/59.5.100
 Accept: */*
 Range: bytes=0-
 Connection: close
 Host: 127.0.0.1
 Icy-MetaData: 1


 [https @ 000001f637220a80] HTTP error 404 Not Found
 Output #0, hls, to 'https://127.0.0.1/stream.m3u8':
   Metadata:
     encoder         : Lavf59.5.100
   Stream #0:0, 0, 1/90000: Video: h264 (High) ([27][0][0][0] / 0x001B),
 yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 30
 tbr, 90k tbn
   Stream #0:1(und), 0, 1/90000: Audio: aac (LC) ([15][0][0][0] / 0x000F),
 48000 Hz, 5.1, fltp, 394 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #0:1 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless
 if it occurs once at the start per stream)
 cur_dts is invalid st:1 (0) [init:1 i_done:0 finish:0] (this is harmless
 if it occurs once at the start per stream)
 [NULL @ 000001f63547c040] nal_unit_type: 7(SPS), nal_ref_idc: 3
 [NULL @ 000001f63547c040] nal_unit_type: 8(PPS), nal_ref_idc: 3
 cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless
 if it occurs once at the start per stream)
 cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless
 if it occurs once at the start per stream)
 cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless
 if it occurs once at the start per stream)
 cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless
 if it occurs once at the start per stream)
 cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless
 if it occurs once at the start per stream)
 [hls @ 000001f637409040] Opening 'https://127.0.0.1/stream0.ts' for
 writingx
 [https @ 000001f6376fa7c0] Setting default whitelist
 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
 [tcp @ 000001f6376fa940] Original list of addresses:
 [tcp @ 000001f6376fa940] Address 127.0.0.1 port 443
 [tcp @ 000001f6376fa940] Interleaved list of addresses:
 [tcp @ 000001f6376fa940] Address 127.0.0.1 port 443
 [tcp @ 000001f6376fa940] Starting connection attempt to 127.0.0.1 port 443
 [tcp @ 000001f6376fa940] Successfully connected to 127.0.0.1 port 443
 [https @ 000001f6376fa7c0] request: PUT /stream0.ts HTTP/1.1
 Transfer-Encoding: chunked
 User-Agent: Lavf/59.5.100
 Accept: */*
 Connection: keep-alive
 Host: 127.0.0.1
 Icy-MetaData: 1



 Received windows signal 0

 Received windows signal 0
 [tls @ 000001f6376fa880] Unable to read from socket
 [hls @ 000001f637409040] upload segment failed, will retry with a new http
 session.
 [AVIOContext @ 000001f637222600] Statistics: 0 seeks, 157 writeouts
 [tls @ 000001f6376fa880] Failed to send close message
 [hls @ 000001f637409040] Opening 'https://127.0.0.1/stream0.ts' for
 writing
 [https @ 000001f6376fa7c0] Setting default whitelist
 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
 [tcp @ 000001f6376fa940] Original list of addresses:
 [tcp @ 000001f6376fa940] Address 127.0.0.1 port 443
 [tcp @ 000001f6376fa940] Interleaved list of addresses:
 [tcp @ 000001f6376fa940] Address 127.0.0.1 port 443
 [tcp @ 000001f6376fa940] Starting connection attempt to 127.0.0.1 port 443
 }}}

 nginx config:
 {{{
 #user  nobody;
 worker_processes  1;

 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
 #error_log  logs/error.log  info;

 #pid        logs/nginx.pid;


 events {
     worker_connections  1024;
 }


 http {
     include       mime.types;
     default_type  application/octet-stream;
     client_max_body_size 20M;

     sendfile        on;

     keepalive_timeout  65;

     server {
         listen       80;
         server_name  localhost;

         location / {
             root   html;
             index  index.html index.htm;
             dav_methods PUT DELETE MKCOL;
             create_full_put_path on;
             dav_access           all:rw;
         }

         #error_page  404              /404.html;

         # redirect server error pages to the static page /50x.html
         #
         error_page   500 502 503 504  /50x.html;
         location = /50x.html {
             root   html;
         }
     }


     # HTTPS server
     #
     server {
         listen       443 ssl;
         server_name  localhost;

         ssl_certificate      certificate.crt;
         ssl_certificate_key  privateKey.key;

         ssl_session_cache    shared:SSL:1m;
         ssl_session_timeout  5m;

         ssl_ciphers  HIGH:!aNULL:!MD5;
         ssl_prefer_server_ciphers  on;

         location / {
             root   html;
             index  index.html index.htm;
             dav_methods PUT DELETE MKCOL;
             create_full_put_path on;
             dav_access           all:rw;
         }
     }
 }
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/7975#comment:21>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list