Opened 11 years ago

Last modified 11 years ago

#2702 new defect

Faulty handling of file: protocol on Windows

Reported by: Hendrik Schreiber Owned by:
Priority: normal Component: avformat
Version: unspecified Keywords: url win
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:

In the dev documentation it is mentioned that one can open resources either via a filename, a URL or some other form of custom AVIOContext.

But in its current form FFmpeg does not seem to support well formed Windows file URLs.

On Windows, the scheme part (file:) is always followed by a bunch of slashes, usually three (file:///), before the drive designator.
A correct local file URL is e.g.:


A more complete explanation can be found at

Contrary to this, in libavformat/file.c (static int file_open(URLContext *h, const char *filename, int flags), line 112) FFmpeg simply cuts off "file:" in line 119 and thinks it is done.


open("///C:/somePath/someFile.mp3", access, 0666); // line 135 

leads to EINVAL/Invalid Argument. This function is called via avio_open2, which is called by avformat_open_input.

This bug was already discussed on libav-user:

Change History (3)

comment:1 by Carl Eugen Hoyos, 11 years ago

Please either provide a failing command line (if the ticket is reproducible with the ffmpeg executable) together with the complete, uncut console output or add sample code that allows to reproduce the problem.

comment:2 by Hendrik Schreiber, 11 years ago

int res = 0;
AVFormatContext **format_context;
res = avformat_open_input(format_context, "file:///C:/somePath/someFile.mp3", NULL, NULL);
// res must *not* be EINVAL, if the file is valid and exists.

comment:3 by Carl Eugen Hoyos, 11 years ago

Keywords: win added; windows removed
Note: See TracTickets for help on using tickets.