[FFmpeg-devel] Patch for timestamp pattern in filename

Stefano Sabatini stefasab at gmail.com
Fri Jan 30 12:59:41 CET 2015

On date Friday 2015-01-30 11:01:16 +0100, Matthijs Tempels encoded:
> Hi Stefano,
> I did look at the strftime function, but strftime does not provide milliseconds..

Yeah, we need gettimeofday for that.

> What i need is the exact time (to the millisecond) of the first frame of the file.. (so the date from the strftime might even be a few ms of, but we could compensate for that)
> a seconds-resolution is just not acurate enough..

> So the best thing for me would be that ffmpeg puts the system time to the ms in the frame metadata somewhere, but i'm not sure if that is possible..

You could add an option to set that in the format metadata, by hacking
the segment.c file.

My problem with such approach is that it is not generic
enough. Ideally we should be able to setup this in a generic
way. Extending the strftime() template system would be a
probably the best option.

The simpler approach I can image is to add another option like
-epoch_micros which replaces a %Nd pattern with a number of
microseconds since epoch (you can extract and parse them later).
At some point we would need something more generic, supporting things


similar to what is done in drawtext (see text expansion).
FFmpeg = Free and Faithful Mournful Problematic Exuberant Governor

More information about the ffmpeg-devel mailing list