orcasound / orcanode

Software for live-streaming and recording lossy (AAC) or lossless compressed audio (HLS, DASH, FLAC) via AWS S3 buckets. :star:
GNU Affero General Public License v3.0
34 stars 12 forks source link

FLAC filenames or metadata should provide start time precision greater than seconds #12

Open scottveirs opened 5 years ago

scottveirs commented 5 years ago

For both localization of underwater sound and accurate annotation of the audio data, it would be ideal to have more than 1-second precision when indicating the start time of a FLAC file. Can ffmpeg add precision (say up to milliseconds, or ideally microseconds) when generating the filename?

mcshicks commented 3 years ago

Left a comment in slack on this. But basically NTP means the inherent accuracy of the node is in 10's of milliseconds. It might be possible to add GPS to get that accuracy down to microseconds. But then you have to figure out what the error put in my ffmpeg. I have some ideas on how to measure that if you have a GPS time (since you have PPS to syncronize off of).

mcshicks commented 3 years ago

A bit more of investigation. We use strftime to format our timestamps, that doesn't support milliseconds. But someone has patched it. https://github.com/InSoundz/ffmpeg-strftime-milliseconds. So we would be back build to building our own ffmpeg to get this.

mcshicks commented 3 years ago

So I looked at it some more. That patch no longer builds, there is a C struct called AVFormatContext defined in libavformat/avformat.h that's definition has changed. There is a single file libavformat/segment.c which is building these filenames. There is appears to be a single call to strftime in that file which is replaced by a new strftime_millis so probably simpler to try and write a new patch on top of the current baseline.

scottveirs commented 1 year ago

Possibly helpful:

https://github.com/InSoundz/ffmpeg-strftime-milliseconds