nschlia / ffmpegfs

FUSE-based transcoding filesystem with video support from many formats to FLAC, MP4, TS, WebM, OGG, MP3, HLS, and others.
https://nschlia.github.io/ffmpegfs/
GNU General Public License v3.0
199 stars 14 forks source link

Size of returned file after first call is wrong #4

Closed nschlia closed 6 years ago

nschlia commented 6 years ago

When a file is opened for the first time, the resulting file has the wrong size:

When the file is accessed once more (read from cache), the size is correct.

nschlia commented 6 years ago

The direct_io option is required if the file size is not known in advance.

direct_io
              This option disables the use of page cache (file content  cache)
              in the kernel for this filesystem. This has several affects:
       1.     Each  read(2)  or write(2) system call will initiate one or more
              read or write operations, data will not be cached in the kernel.
       2.     The return value of the read() and  write()  system  calls  will
              correspond   to   the  return  values  of  the  read  and  write
              operations. This is useful for example if the file size  is  not
              known in advance (before reading it)
nschlia commented 6 years ago

Fixed.

nschlia commented 6 years ago

Note: For older versions (1.1 or older) this can be fixed by specifying the direct_io option on the command line.