[FFmpeg-devel] [PATCH] libavutil/timestamp.h: Fix loss of precision in silencedetect timestamps for long files
Michael Niedermayer
michael at niedermayer.cc
Sun Jun 7 23:03:19 EEST 2020
On Sat, Jun 06, 2020 at 09:32:18PM +0000, Allan Cady wrote:
> [Repeat submission. I really don't know my way around git tools... this time I'm using "git imap-send" in hopes this will better please the ffmpeg submission gods. Thank you for your patience.]
>
> When the silencedetect filter is run against long files, the output
> timestamps gradually lose precision as the scan proceeds further into
> the file. This is because the output is formatted (in
> libavutil/timestamp.h) as "%.6g", which limits the total field
> length. Eventually, for offsets greater than 100000 seconds (about 28
> hours), fractions of a second disappear altogether, and the
> timestamps are logged as whole seconds.
>
> I propose changing the format to "%.6f",
> which will give microsecond precision for all timestamps, regardless of offset.
>
> The timestamp string length is limited to 32 characters
> (AV_TS_MAX_STRING_SIZE), so this should still be plenty long enough
> with the increased length (up to 10^25 seconds).
>
> My interest is in fixing this problem for silencedetect, which
> formats the timestamps by calling the macro av_ts2timestr, defined in
> timestamp.h. Since av_ts2timestr is also used in many other places (I
> count 21 c files), I have created a new macro, av_ts2timestr_format,
> with a format string added as a parameter, and left the original
> macro interface as is for other usages, to limit the scope of this
> change. The same or similar change could be made for other cases
> where better precision is desired.
> ---
> libavfilter/af_silencedetect.c | 14 +++++-----
> libavutil/timestamp.h | 27 +++++++++++++++++---
> tests/ref/fate/filter-metadata-silencedetect | 2 +-
> 3 files changed, 32 insertions(+), 11 deletions(-)
doesnt apply, this patch seems messed up in transit
Applying: libavutil/timestamp.h: Fix loss of precision in silencedetect timestamps for long files
error: corrupt patch at line 12
error: could not build fake ancestor
Patch failed at 0001 libavutil/timestamp.h: Fix loss of precision in silencedetect timestamps for long files
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200607/c38f87ea/attachment.sig>
More information about the ffmpeg-devel
mailing list