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

What is nature of time stamp for a .ts segment? #56

Open scottveirs opened 1 year ago

scottveirs commented 1 year ago

Is the creation time for an HLS segment shown in the S3 streaming bucket the time the object was written to S3 or is it the time the segment was initiated by ffmpeg on the node computer?

The answer would be important for anyone trying to use the lossy data for localization (which is a worse choice than the FLAC), or for an accurate assessment of audio data gaps.

scottveirs commented 4 months ago

This question is answered as I investigate a related issue this morning: does the created datetime stamp of the first .ts segment on the Raspberry Pi within the Docker container match the epoch datetime stamp of the S3 object where the latest.txt file and each HLS data set is stored, or not?

Examining the livestream from Sunset Bay via my browser, that the latest.txt file contains the value 1717743618 which I can convert using https://www.epochconverter.com/ to find this equivalent:

Your time zone: Friday, 
June 7, 2024 12:00:18 AM [GMT-07:00]

Logging into the AWS console, I observe in Sunset Bay's S3 location that the current latest.txt file (at s3://streaming-orcasound-net/rpi_sunset_bay/hls/1717743618/live000.ts has this datetime information:

Last modified
June 7, 2024, 00:00:30 (UTC-07:00)

This suggest that the first .ts segment may be created by ffmpeg 12 seconds after the latest.txt file is created on the Raspberry Pi, or that the datetime stamp of the .ts segment shown in the S3 console is actually the time the file was uploaded to S3 (12 seconds could be equal to the 10 seconds taken to create the first .ts file and 2 seconds to upload it to from the /tmp directory in the Rpi's container to the S3 bucket.

Using Dataplicity to login remotely to the node, and this command to ssh into the running streaming container --

root@4860bba5bb76:~# ls -lt --full-time --time=ctime /tmp/rpi_sunset_bay/hls/1717743618/

I get this precise time stamp for a .ts segment as it is being created and before it is uploaded and then removed from the /tmp directory:

-rw-r--r-- 1 root root 0 2024-06-07 17:48:39.497196487 +0000 live3890.ts

Searching for that segment back on the S3 console, I find this:

Last modified
June 7, 2024, 10:48:51 (UTC-07:00)

Which is again about ~12 seconds after the creation So, we can conclude that the Last modified datetime stamp on the .ts segments in S3 are the time of upload to S3, NOT the time of creation on the Orcasound node.