roju / tiktok-live-recorder

A Python script for recording TikTok live streams
MIT License
16 stars 2 forks source link

Video shows changing colors (picture below) #34

Open Liam942 opened 3 months ago

Liam942 commented 3 months ago

Some files have the past few days been having moments where the video shows changing colors like the picture below. The audio is still playing but no video other than the colors. I have seen it happen at least 5 times with diferent users. 2c8d3817ba15e98a1dfd9c2fe5cc83b5

Marksmanship256 commented 3 months ago

I've run into this before. It usually happens when ffmpeg concatenating files and the video resolutions don't match. It's an ffmpeg thing. Can you check if the video got concatenated?

Sometimes this happens because of a drop in write speed too. Do you keep logs? Can you send me the log file for this recording?

Liam942 commented 3 months ago

This is from another recording that had the same issue. The recording is 9 minutes long, the bug appears after around 5:40 which is around 21:10-21:11 in time, Lasted around 10 seconds and then returned around a minute later for around 10 seconds. 7c98d603486020bc1ff63c3cf4e66f50

Marksmanship256 commented 2 months ago

Instead of permanently deleting parts of a video, you can move them to the trash.

Make sure to back up your tiktok_bot.py file before making these changes.

  1. In the tiktok-live-recorder folder, run pip install send2trash

  2. Import the library at the beginning of the tiktok_bot.py file:

    from send2trash import send2trash

    2024-08-07

  3. In the tiktok_bot.py file, find the code:

if self.delete_segments:
    for v in self.video_list:
        os.remove(v)
    logging.info(f'Deleted {len(self.video_list)} video files')

and replace it with:

if self.delete_segments:
    for v in self.video_list:
        v_normalized = os.path.normpath(v)
        logging.info(f'Sending {v_normalized} to recycle bin')
        send2trash(v_normalized)
    logging.info(f'Sent {len(self.video_list)} video files to recycle bin')
        # os.remove(v)
    # logging.info(f'Deleted {len(self.video_list)} video files')

Then, the next time you encounter this, restore the video parts from the trash and check if there is this video corruption or not. If there is, check the video stats and compare with other parts.

Liam942 commented 2 months ago

I removed the setting that deletes the small files after concat and could not seeing any diference between the smaller files and the larger combined files. Both included the same error so I don't think it has anything to do with the combining of the files.

Marksmanship256 commented 2 months ago

Ran into this issue again today. Parts of the video are fine, but I noticed that the distortion pops up right at the junctions where one clip is merged with another. Definitely an FFmpeg issue with concatenation in my case.

vlcsnap-2024-08-09-13h40m47s090 vlcsnap-2024-08-09-13h40m52s711

Sullyscharger commented 3 days ago

Anyone ever found a solution to this?