<div dir="ltr">I use libavformat to mux H.264 frames and send them out using RTSPS ANNOUNCE over TLS.  When the output is not encrypted and the server becomes unavailable, av_interleaved_write_frame returns an error which allows me to retry the connection (av_interleaved_write_frame failed result=-32 - Broken pipe).<div><br></div><div>When the output is TLS, av_interleaved_write_frame continues to return success even when the server is unavailable so the application doesn't know to retry (av_interleaved_write_frame st.tb=90000, result=0).<div><br></div><div>Is there another way I can determine with libavformat that the TLS connection is no longer valid?</div><div><br></div><div>FFmpeg version 3.2 + RTSPS patch</div><div><br></div><div>This behaviour can also be reproduced with the command line tools (older version that has RTSPS support).</div><div><div><br></div><div>Unencrypted:</div><div><br></div><div>$ ffmpeg -rtsp_transport tcp -i rtsp://<rtsp_source>:554... -vcodec copy -an -f rtsp "rtsp://<rtsp_dest>:1935..."</div><div>ffmpeg version N-68044-g9f9440b Copyright (c) 2000-2014 the FFmpeg developers</div><div>  built on Nov 27 2014 03:13:44 with gcc 4.9.2 (GCC)</div><div>  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib</div><div>  libavutil      54. 15.100 / 54. 15.100</div><div>  libavcodec     56. 13.100 / 56. 13.100</div><div>  libavformat    56. 15.100 / 56. 15.100</div><div>  libavdevice    56.  3.100 / 56.  3.100</div><div>  libavfilter     5.  2.103 /  5.  2.103</div><div>  libswscale      3.  1.101 /  3.  1.101</div><div>  libswresample   1.  1.100 /  1.  1.100</div><div>  libpostproc    53.  3.100 / 53.  3.100</div><div>Input #0, rtsp, from 'rtsp://<rtsp_source>:554...':</div><div>  Metadata:</div><div>    title           : Media Presentation</div><div>    comment         : <comment></div><div>  Duration: N/A, start: 0.011000, bitrate: N/A</div><div>    Stream #0:0: Video: h264 (High), yuv420p, 1920x1080, 30 tbr, 90k tbn, 180k tbc</div><div>    Stream #0:1: Data: none</div><div>Output #0, rtsp, to 'rtsp://<rtsp_dest>:1935...':</div><div>  Metadata:</div><div>    title           : Media Presentation</div><div>    comment         : <comment></div><div>    encoder         : Lavf56.15.100</div><div>    Stream #0:0: Video: h264, yuv420p, 1920x1080, q=2-31, 90k tbn, 90k tbc</div><div>Stream mapping:</div><div>  Stream #0:0 -> #0:0 (copy)</div><div>Press [q] to stop, [?] for help</div><div>[rtsp @ 0000000004d4e940] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.</div><div>av_interleaved_write_frame(): Broken pipe00:00:15.71 bitrate=N/A</div><div>frame=  476 fps= 33 q=-1.0 Lsize=N/A time=00:00:15.77 bitrate=N/A</div><div>video:2178kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown</div><div>Conversion failed!</div><div>$</div><div><br></div></div><div>Encrypted:</div><div><br></div><div><div>$ ffmpeg -rtsp_transport tcp -i rtsp://<rtsp_source>:554... -vcodec copy -an -f rtsp "rtsps://<rtsps_dest>:443..."</div><div>ffmpeg version N-68044-g9f9440b Copyright (c) 2000-2014 the FFmpeg developers</div><div>  built on Nov 27 2014 03:13:44 with gcc 4.9.2 (GCC)</div><div>  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib</div><div>  libavutil      54. 15.100 / 54. 15.100</div><div>  libavcodec     56. 13.100 / 56. 13.100</div><div>  libavformat    56. 15.100 / 56. 15.100</div><div>  libavdevice    56.  3.100 / 56.  3.100</div><div>  libavfilter     5.  2.103 /  5.  2.103</div><div>  libswscale      3.  1.101 /  3.  1.101</div><div>  libswresample   1.  1.100 /  1.  1.100</div><div>  libpostproc    53.  3.100 / 53.  3.100</div><div>Input #0, rtsp, from 'rtsp://<rtsp_source>:554...':</div><div>  Metadata:</div><div>    title           : Media Presentation</div><div>    comment         : <comment></div><div>  Duration: N/A, start: 0.025000, bitrate: N/A</div><div>    Stream #0:0: Video: h264 (High), yuv420p, 1920x1080, 30 tbr, 90k tbn, 180k tbc</div><div>    Stream #0:1: Data: none</div><div>Output #0, rtsp, to 'rtsps://<rtsps_dest>:443...':</div><div>  Metadata:</div><div>    title           : Media Presentation</div><div>    comment         : <comment></div><div>    encoder         : Lavf56.15.100</div><div>    Stream #0:0: Video: h264, yuv420p, 1920x1080, q=2-31, 90k tbn, 90k tbc</div><div>Stream mapping:</div><div>  Stream #0:0 -> #0:0 (copy)</div><div>Press [q] to stop, [?] for help</div><div>[rtsp @ 0000000002d5aa20] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.</div><div>[tls @ 00000000056adc00] Error in the push function. bitrate=N/A</div><div>[tls @ 00000000056adc00] The specified session has been invalidated for some reason.</div><div>    Last message repeated 2 times</div><div>[tls @ 00000000056adc00] The specified session has been invalidated for some reason.</div><div>    Last message repeated 31 times</div><div>[tls @ 00000000056adc00] The specified session has been invalidated for some reason.</div><div>    Last message repeated 89 times</div><div>[tls @ 00000000056adc00] The specified session has been invalidated for some reason.</div><div>    Last message repeated 30 times</div><div>[tls @ 00000000056adc00] The specified session has been invalidated for some reason.</div><div>    Last message repeated 92 times</div><div>[tls @ 00000000056adc00] The specified session has been invalidated for some reason.</div><div>    Last message repeated 29 times</div><div>[tls @ 00000000056adc00] The specified session has been invalidated for some reason.</div><div>    Last message repeated 90 times</div><div>[tls @ 00000000056adc00] The specified session has been invalidated for some reason.</div><div>    Last message repeated 29 times</div><div>[tls @ 00000000056adc00] The specified session has been invalidated for some reason.</div><div>    Last message repeated 92 times</div><div>...</div></div><div><br></div><div><br></div></div></div>