[FFmpeg-devel] Allow output files as read-write

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Jan 18 20:51:03 CET 2012

On Wed, Jan 18, 2012 at 12:28:56PM +0000, Collins, Andrew wrote:
> We would like to ask if it is possible to change the parameter on line
> 4166 and 3331 from AVIO_FLAG_WRITE to AVIO_FLAG_READ_WRITE to prevent
> the file lock. Obviously a more clever suggestion would be to have this
> as one of the command options. 
> While it is not desirable to do this in all cases with your new
> excellent implementation of fragmented MP4 files it means we can now
> read a growing file at the same time it is being generated - good for
> live inputs. With the file-lock on that is not possible. We've tested
> this internally and the simple change makes all the difference.

I think we are missing some critical information here.
What do you mean by file-lock? Are you using Windows (the only
OS I know of that locks file without anyone asking for it and no
good reason at all really)?
Regardless of that, opening a file for write-only or read-write
shouldn't make a difference for file-locking, that seems like
really nonsensical behaviour.
And "lying" to the file layer about what access is needed is a rather
bad idea, since we may have or add protocols that cannot support
read-write, and FFmpeg would then not be able to use them as output.
If my assumptions about you running Windows are correct, you should
probably just add a few calls to libavformat/file.c that tells it
to not pointlessly lock the file.


More information about the ffmpeg-devel mailing list