EnterGin / Auto-Stream-Recording-Twitch

Python script for auto recording live streams without any delay
96 stars 14 forks source link

Difference between processed and recorded files? #31

Open TBloop opened 1 year ago

TBloop commented 1 year ago

Hi, I'm glad I found your script! I often use Twitchlink (unrelated to streamlink) to record streams but sometimes I fall asleep and miss it, so this is great. After a bunch of tinkering it seems to be working, but I had a few questions.

After recording my own stream for 1-2 minutes it seems the mp4 files in the processed and recorded folders are the same. What is the difference? I'm guessing I should keep the "processed" one and delete "recorded" one?

Second question: What is the point of having the option to download VOD when stream ends if this script is recording the stream to begin with? If you can download the VOD then there is no need to record stream. Am I missing something?

I appreciate your help!

EnterGin commented 1 year ago

Hello!

Actually, this script is a bit outdated (I don't have time to refactor and maintain it now). But it's good to see that it's still working :smile:

  1. Recorded files in fact are .ts files. It's almost the same with .mp4 but fast forward works worse on .ts. Yes, you can keep processed files and delete recorded. There is auto delete option on script startup:
    # 0 - always ask to delete previous processed streams from recorded folder, 1 - don't ask, don't delete, 2 - don't ask, delete
    self.dont_ask_to_delete = 0
  2. Since this script has been developed gradually over time, some features were added in the early stages of development. Optional VOD download was implemented to download whole stream in case of missing beginning. In latest versions, this issue is quite rare.
TBloop commented 1 year ago

Hello, thanks for your response.

Im confused because the files in both the processed and recorded folders have the .mp4 extension. The files in the processed folder are a little bit smaller, and also have proper thumbnails and metadata to show their bitrate, etc, while the "recorded" files do not have any of this. (Screenshot here)

One last question - even when I have VOD download and chat download disabled, an error often comes up when its done downloading that says something like "An error has occurred. VOD and chat will not be downloaded. Please check them manually.". I installed twitch chat downloader and confirmed it works by itself, then enabled it in the settings, but it still gives that error and I dont see the recorded chat file anywhere (where would it be saved to anyway?)

It's not a huge deal since the stream recording is most important, but any clue why it might be giving that error even when VOD and chat downloading is disabled?

EnterGin commented 1 year ago
  1. They have same extension because that's how it happened historically :smiley: In recorded folder extension is not right. It has to be .ts, but from first version it was .mp4. As you can see, after processing broken .mp4 become valid .mp4.
  2. This error can occur even if VOD and chat download is disabled. It's just a warning (maybe a bit silly). Chat files will be saved in the processed stream folder.

To be honest, whole code is a mess :smile: I wanted to refactor it but now I don't have time or desire to do this. Someday, someday...

TBloop commented 1 year ago

I see, thanks for the answers.

Unfortunately the chat download is broken for me. It seems if there is existing files in the recorded folder, it gives a file already exists error (screenshot) (even though it does create the video files) but it wont create the chat files. If I delete all files in both folders and try it, it does create the 3 chat files, but they dont contain the chat messages, only some metadata about the stream.

On another note, could you maybe help me create a very simple batch file script? Instead of always editing the .py script to put the streamer I want to record, I want to open a .bat file, then have it prompt me for the streamer username, and then it will simply run the recorder script with the entered username as the argument in command line using the -u option.

It's ok if you cant, I know you dont have much time but I appreciate it anyway, at least the core function still works!

EnterGin commented 1 year ago
  1. That's pretty strange error btw. Seems like stream ended but immediately started again, so VOD is not splitted (or it can happen when channel turned off VOD saving but still has VODs, script looking for latest VOD and it's the same for every record). You can try it on real stream. I can't try it now because I don't have windows machine available.
  2. Maybe something like this (cannot try because no windows available :( ):
    @echo off
    setlocal enabledelayedexpansion 
    set /p username="Enter username"
    start /min cmd.exe /k python record.py -u %username%

    You can use batch/powershell scripts for multiple usernames I mentioned in another issue (https://github.com/EnterGin/Auto-Stream-Recording-Twitch/issues/6)

TBloop commented 1 year ago

Awesome, thanks, it works perfectly. Now I can start the program a lot faster and more conveniently.

I have VODs completely disabled on my stream while testing. Maybe it wouldn't have an error if VODs enabled?

EnterGin commented 1 year ago

It wouldn't. Algorithm is simple: after recording script looking for latest VOD on channel and getting it's info such as date and time, VOD ID, VOD title, VOD game. This error can occur when there are no VODs at all (VODs disabled) or there are some old VODs, not related to recording. In second case script get same VOD over and over but it cannot save it because it already exists.

This problem is not critical since recorded stream will be saved and processed just fine.

Hope that helps.