dvingerh / PyInstaLive

Python script to download Instagram livestreams.
MIT License
547 stars 111 forks source link

Invalid durations in log files #123

Closed Infinitay closed 3 years ago

Infinitay commented 3 years ago

I am using:

To report a bug, fill in the information below.

Pardon me not following the bug report layout, but I believe this is more of a general bug than a specific one. If need be, I will still provide files should you require them.

I was downloading the Instagram Livestream of a user earlier and later I noticed that the download duration was wrong and therefore the missing approximation was wrong too.

---------------------------------------------------------------------------
PYINSTALIVE (SCRIPT V3.2.4 - PYTHON V3.8.7) - 05-12-2021 03:41:52 AM
---------------------------------------------------------------------------
Overriding configuration file login with -u and -p arguments.
---------------------------------------------------------------------------
Successfully logged into account: None
---------------------------------------------------------------------------
Getting info for 'twicetagram' successful.
---------------------------------------------------------------------------
Livestream available, starting download.
---------------------------------------------------------------------------
Username    : twicetagram
Viewers     : 48803 watching
Airing time : 0 minutes and 40 seconds
Status      : Active
---------------------------------------------------------------------------
Downloading livestream, press [CTRL+C] to abort.
---------------------------------------------------------------------------
The livestream has been ended by the user.
---------------------------------------------------------------------------
Airtime duration  : 18 minutes and 5 seconds
Download duration : 17 minutes and 26 seconds
Missing (approx.) : 0 minutes and 39 seconds
---------------------------------------------------------------------------
Successfully saved 607 comments.
---------------------------------------------------------------------------
Merging downloaded files into video.
Successfully merged downloaded files into video.
---------------------------------------------------------------------------
There are no available replays.
---------------------------------------------------------------------------

However, the temporary video file came out to be 18:01 in length while the temporary audio was 18:00. I came to realize these lengths are false because the video cuts out earlier than the length because footage is missing. The merged video's duration is true to length at 17:50. However, the log said the download duration was 17:26, but that's not the case here with the merged segments.

Furthermore, I used the method to get the missing segments by using #121 successfully and restored 10 seconds. This brought the original result of PyInstaLive's livestream recording from 17:50 to 18:00 which was more in-line with the temporary file. Additionally, this result is much closer to the logged airtime of 18:05.

This is the case for not only this recording but plenty of others as I came to find out.

dvingerh commented 3 years ago

This happens when the stream enters the "interrupted" e.g. the livestreamer loses internet connection temporarily or minimizes Instagram app. During these moments no video is being streamed but the total airing time does not account for this and simply measures the elapsed time between the start of the stream and the current time.