[FFmpeg-devel] Patch for timestamp pattern in filename

Matthijs Tempels matthijs at townsville.nl
Fri Jan 30 11:01:16 CET 2015


Hi Stefano,

I did look at the strftime function, but strftime does not provide milliseconds..

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

The fix I made now, works for me.. i just use the segment filter and provide a %t in my filename and ik end up with files like:

test_20150129_201638983.mp4 : streams.stream.0.nb_frames="1800"
test_20150129_201738981.mp4 : streams.stream.0.nb_frames="1800"
test_20150129_201838984.mp4 : streams.stream.0.nb_frames="1800"
test_20150129_201938982.mp4 : streams.stream.0.nb_frames="1800"
test_20150129_202039004.mp4 : streams.stream.0.nb_frames="1800"
test_20150129_202138986.mp4 : streams.stream.0.nb_frames="1800"
test_20150129_202238981.mp4 : streams.stream.0.nb_frames="1800"

which are 60 second segments, 30 fps mp4 files , so 1800 is absolutely perfect.

what would be the best way to get the exact timecode per frame? (system time that is, since all processes are running on the same system so the systemtime is the same for all)

Cheers

Matthijs

> Op 29 jan. 2015, om 11:26 heeft Stefano Sabatini <stefasab at gmail.com> het volgende geschreven:
> 
> On date Wednesday 2015-01-28 14:03:06 +0100, Matthijs Tempels encoded:
>> From 15952b6cb38ac2f532a2f35d50e9dc4f8320c1c5 Mon Sep 17 00:00:00 2001
>> From: Matthijs Tempels <matthijs at townsville.nl>
>> Date: Wed, 28 Jan 2015 13:59:54 +0100
>> Subject: [PATCH] Added the %t option to the filename pattern to add a
>> yyyyMMdd_HHmmssfff pattern to the filename
>> 
>> ---
>> libavformat/utils.c | 18 +++++++++++++++++-
>> 1 file changed, 17 insertions(+), 1 deletion(-)
> 
> This is not documented anywhere.
> 
> Also what's your use case?
> 
> Did you have a look at:
> 
> commit 202947a0665ea523022afb0a6c50eed96bcd6b69
> Author: Pedro E. M. Brito <pedroembrito at gmail.com>
> Date:   Sun Dec 28 05:35:34 2014 -0200
> 
>    libavformat/segment.c: Add strftime expansion for segment filename templates
> 
>    Allows expansion of the filename template with strftime() with the option
>    -strftime 1 (disabled by default). This allows segments to be named by time of
>    creation, adding some flexibility.
> 
>    Fixes Ticket 4104 (add strftime to segment muxer)
> 
> ?
> 
> In case it fixes the problem for you, you could consider documenting
> the option in doc/formats.texi.
> -- 
> FFmpeg = Free & Fabulous Merciful Portable Elitarian Gargoyle
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



More information about the ffmpeg-devel mailing list