title: FFmpeg RTSP Authentication
body: <p>I've been currently trying to set up an encoding process from RTSP to HLS using FFmpeg, with success for most streams.</p>
  
  <p>However, for streams/cameras with digest authentication, FFmpeg seems to fail with a classic 401 Unauthorized, as such:</p>
  
  <pre><code>ffmpeg -loglevel debug -i "rtsp://user:password@192.168.0.1/stream" /folder/output.m3u8
  </code></pre>
  
  <p>Giving:</p>
  
  <pre><code>ffmpeg version N-85750-ga75ef15 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
    configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --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-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
    libavutil      55. 61.100 / 55. 61.100
    libavcodec     57. 93.100 / 57. 93.100
    libavformat    57. 72.101 / 57. 72.101
    libavdevice    57.  7.100 / 57.  7.100
    libavfilter     6. 88.100 /  6. 88.100
    libswscale      4.  7.101 /  4.  7.101
    libswresample   2.  8.100 /  2.  8.100
    libpostproc    54.  6.100 / 54.  6.100
  Splitting the commandline.
  Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
  Reading option '-i' ... matched as input url with argument 'rtsp://username:password@192.168.0.1/stream'.
  Reading option '/folder/output.m3u8' ... matched as output url.
  Finished splitting the commandline.
  Parsing a group of options: global .
  Applying option loglevel (set logging level) with argument debug.
  Successfully parsed a group of options.
  Parsing a group of options: input url rtsp://username:password@192.168.0.1/stream2.
  Successfully parsed a group of options.
  Opening an input file: rtsp://username:password@192.168.0.1/stream.
  [tcp @ 00000000025c3900] No default whitelist set
  [rtsp @ 00000000025c2560] method OPTIONS failed: 401 Unauthorized
  [rtsp @ 00000000025c2560] CSeq: 2
  WWW-Authenticate: Digest realm="Use 'live' as User Name", nonce="2ae726f5557769220b780deb4f562226", algorithm=MD5, qop="auth"
  rtsp://user:password@192.168.0.1/stream: Server returned 401 Unauthorized (authorization failed)
  </code></pre>
  
  <p>I've checked that the camera is accessible and the input URI works in VLC. The camera I'm trying to obtain the stream from is a Bosch one.</p>
  
  <p>I've searched and searched over the Internet but I didn't find any concrete solution to this.</p>
  
  <p>Any ideas?</p>