[FFmpeg-devel] Patch for timestamp pattern in filename

Matthijs Tempels matthijs at townsville.nl
Fri Jan 30 14:13:53 CET 2015


Hi, Just missed you on IRC :-/

> Op 30 jan. 2015, om 12:59 heeft Stefano Sabatini <stefasab at gmail.com> het volgende geschreven:
> 
> 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.
> 

only what i read gettimeofday is deprecated.. but clock_gettime() is not (yet?) implemented in all platforms :-) the cool world of software development.. Anyway, both work for my purpose..

>> 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.

I tried looking into that too.. but my knowledge of c++ is rusty to say the least.. the filename-thing was the easiest, yet not the most univeral thing i could think of realy quick..

> 
> 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.

agreed!

> 
> 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
> like:
> 
> %{strftime:%Y-%m-%d_%H:%M:S}-%{gettimeofday:%m}
> 
> similar to what is done in drawtext (see text expansion).

Yes i found that to make time captions in a video.. it would be great to have the same mechanism work for the filenames and media titles etc etc 

> -- 
> FFmpeg = Free and Faithful Mournful Problematic Exuberant Governor
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



More information about the ffmpeg-devel mailing list