Opened 4 years ago

Last modified 4 years ago

#8693 new defect

DASH HTTP PUT fails with http_persistent and connection closed

Reported by: Chris Ribble Owned by:
Priority: normal Component: avformat
Version: unspecified Keywords: dash
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

When live streaming (HLS) with a persistent HTTP connection, if the web server closes the connection ffmpeg shuts down.

How to reproduce:

Streaming to an Apache web server with "KeepAlive On" and "MaxKeepAliveRequests 10", ffmpeg will fail on the 11th PUT request when Apache closes the TCP connection. Streaming to Tomcat service with default configuration, ffmpeg will fail on the 101st PUT request when Tomcat closes the connection.

ffmpeg -report -i /home/chris/Desktop/B3__1080p29_x264_3_1080-full.mp4 -c copy -f dash -seg_duration 2 -http_persistent 1 http://localhost:8080/Manifest.mpd

Output:

[http @ 0x55e4fe65d780] Opening 'http://localhost:8080/chunk-stream1-00100.m4s' for writing
[http @ 0x55e4fe639780] URL read error: End of file
[http @ 0x55e4fe748a40] Opening 'http://localhost:8080/Manifest.mpd' for writing
[http @ 0x55e4fe66e780] Opening 'http://localhost:8080/chunk-stream0-00101.m4s' for writing
[dash @ 0x55e4fe658500] Unable to open http://localhost:8080/chunk-stream0-00101.m4s for writing: Broken pipe
av_interleaved_write_frame(): Broken pipe
[http @ 0x55e4fe65d780] Opening 'http://localhost:8080/chunk-stream1-00101.m4s' for writing
[dash @ 0x55e4fe658500] Unable to open http://localhost:8080/chunk-stream1-00101.m4s for writing: Connection reset by peer
[http @ 0x55e4fe748a40] Opening 'http://localhost:8080/Manifest.mpd' for writing
Error writing trailer of http://localhost:8080/Manifest.mpd: Connection reset by peer
frame= 6031 fps=0.0 q=-1.0 Lsize=N/A time=00:03:21.20 bitrate=N/A speed= 965x    
video:84499kB audio:3186kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

This was fixed for HLS by https://trac.ffmpeg.org/ticket/7975 and I have attempted to create a similar patch for libavformat/dashenc.c (attached).

I tested the patch against master and also against the 4.2 branch (with f267a2ac9c740c77cee2f2c5fd2bd9bc048768b1 also applied) and it seems to fix the problem, although I am no C expert and I'm sure there are flaws in my patch.

Attachments (2)

ffmpeg-20200529-091625.log (663.2 KB ) - added by Chris Ribble 4 years ago.
0001-avformat-dashenc-reopen-new-http-session-for-http_pe.patch (5.8 KB ) - added by Chris Ribble 4 years ago.

Download all attachments as: .zip

Change History (3)

by Chris Ribble, 4 years ago

Attachment: ffmpeg-20200529-091625.log added

comment:1 by Carl Eugen Hoyos, 4 years ago

Keywords: dash added
Version: 4.2unspecified

Please send your patch to the FFmpeg development mailing list, patches are ignored on this bug tracker.

Note: See TracTickets for help on using tickets.