[FFmpeg-devel] [PATCH 0/3] Authentication callbacks

Lukasz Marek lukasz.m.luki2 at gmail.com
Wed Apr 8 01:04:55 CEST 2015

One of the most annoying things with ffmpeg is that password must be provided as a program param.
It is visible while typing and on process list. (I'm talking about ffplay/ffmpeg/ffprobe here.)

This patchset provides API that protocols may use to ask user for password interactively.
I added implementation in ffplay, but I see it potentially useful for any user application.

The question is: is this really required, application may just ask for password when connection fails.
Assuming application knows it is matter of credentials (not wrong hostname, file permissions etc),
it may be ineffective. It is almost sure connection has to be established at each try.
API also allows to distinguish password for reqular user/pass authentication and password 
for private key (not included in this patchset, but libssh may benefit from this probably).

I added callback as global variable with settter and as part of URLContext. Global variable is not nice,
but it allows to avoid massive attack on avio API :) I don't see any reason it cannot be done this way.
I also added it to URLContext to allow muxers, demuxers (like HLS, DASH, SmoothStreaming, image2) to add a
wrapper and cache these credentials as they open many urls to store sequential data (images/chunks).

Patchset available at 
branch: auth

Lukasz Marek (3):
  [RFC]lavf/avio: add custom authentication API
  ffplay: add basic credentials handler
  lavf/ftp: support credentials callback

 ffplay.c           | 63 ++++++++++++++++++++++++++++++++++-
 libavformat/avio.c | 46 ++++++++++++++++++++++++++
 libavformat/avio.h | 28 ++++++++++++++++
 libavformat/ftp.c  | 96 ++++++++++++++++++++++++++++++++++++++++++++++--------
 libavformat/url.h  | 12 +++++++
 5 files changed, 231 insertions(+), 14 deletions(-)


More information about the ffmpeg-devel mailing list