EnterGin / Auto-Stream-Recording-Twitch

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

Errno 22 and wrong name on fixed file. #18

Closed Moflows closed 3 years ago

Moflows commented 3 years ago

Hey! I'm experiencing an issue where i'm recording a streamer who turned off their vod saving so when they have completed their stream, the title of the "fixing" file gets reverted to a vod that is days old with the time/game/title in the name (from their channel?). Not sure how to fix this and i'm afraid that the files will get overwritten.

Also when a streamer has a long title the script won't start recording with a Errno 22, it also could be because of these characters ä, å ,ö but i'm not really sure. Is there anyway to disable those characters? It just cycles and can't start.

Errno 22:

[cli][info] Found matching plugin twitch for URL twitch.tv/xxxxx [cli][info] Available streams: audio_only, 160p (worst), 360p, 480p, 720p60, 1080p60 (best) [cli][info] Opening stream: 1080p60 (hls) error: Failed to open output: I:\Twitch-Recording-2020V3\recorded\xxxx\20201227_01h18m38s_Kohta lentää

_Counter-Strike Global Offensive_xxxxxx.mp4 ([Errno 22] Invalid argument: 'I:\Twitch-Recording-2020V3\recorded\xxxxxx\20201227_01h18m38s_Kohta lentää\n\n_Counter-Strike Global Offensive_xxxxxx.mp4') [cli][info] Closing currently open stream... Recording stream is done. Fixing video file. Skip fixing. File not found. Fixing is done. Going back to checking.. [cli][info] Found matching plugin twitch for URL twitch.tv/xxxxxx [cli][info] Available streams: audio_only, 160p (worst), 360p, 480p, 720p60, 1080p60 (best) [cli][info] Opening stream: 1080p60 (hls) error: Failed to open output: I:\Twitch-Recording-2020V3\recorded\xxxxxx\20201227_01h18m46s_Kohta lentää

_Counter-Strike Global Offensive_xxxxxx.mp4 ([Errno 22] Invalid argument: 'I:\Twitch-Recording-2020V3\recorded\xxxxxx\20201227_01h18m46s_Kohta lentää\n\n_Counter-Strike Global Offensive_xxxxxx.mp4') [cli][info] Closing currently open stream... Recording stream is done. Fixing video file. Skip fixing. File not found. Fixing is done. Going back to checking..

EnterGin commented 3 years ago

Hello!

  1. Streamer still has VODs but turned off stream saving recently? This is actually a problem that hard to fix. Maybe add option to turn off fetching info from VOD.
  2. This gonna be same problem with \n control character. I know about this problem, will take a look later.
Moflows commented 3 years ago

Hey! And yes that is exactly how it is! ( I suck at explaining, haha ). Thank you for the fast response, i appreciate it.

  1. Could it be changed that it probes the time+date and title when it starts and that is the absolute/fixed name instead of fetching it off a vod later?

  2. I noticed when i removed + stream_title + at line 326 it works to record which i did in a different script as well. Not sure if it harms the process at all. But atleast it starts to record. As a temp solution that is.

EnterGin commented 3 years ago

It's hard to get info about stream when it starts 'cause actually streamlink checks if stream is up. Maybe only get info after end of the stream. I don't want to delete fetching info from VOD 'cause it's useful, but I can make option to turn it off.

Moflows commented 3 years ago

I'd be fine with an option with just a date for the file name and possibly username. Title and game is not useful or its easy to get otherwise. Or maybe make it so it can't overwrite any files in fixing/any files in the processed folder.

EnterGin commented 3 years ago

As I remember it can't overwrite, but I will check it ASAP.

Moflows commented 3 years ago

So i tested it with both processing and the recording part.

  1. It will not overwrite or fix a new stream that has been recorded if there is a file named exactly the same except if you change the extension .ts for example.

  2. It will not overwrite any recordings in the recordings folder and not fail to start recording either. It will simply get the CURRENT date and time and title/game.

  3. If the streamer changes game/category it will still create new files in the processed folder and recording folder like this:

20201223_(21-55)_847771672_In weird place_Escape From Tarkovxxxxx.mp4 20201223(21-55)_847771672_In weird place_Just Chatting_xxxxx.mp4

Which is perfectly fine and works but if you clean out or move files then it will regenerate the last vod on their channel which can be days old but not an issue.

And another question, is there a possibility to add an option to the script for it to not fix the files? Because when they are raw recorded they stay a constant frame rate of 60 but when they are fixed they get a variable frame rate which Premiere pro or any other video editing software struggles to keep insync. Twitch Leecher has an option when downloading to keep it a RAW .ts file so it works.

I don't mean to give you any headaches, it's just what i noticed. A work around is to just keep both versions if you have space and then use the files in the recorded folder while you edit/make videos.

Thanks for the hard work on the script and the time it took you to make this. I really appreciate it!

Moflows commented 3 years ago

Also new bug that come up today when twitch was crashing/going down.

[cli][error] Unable to validate JSON: Unable to validate key 'data': Unable to validate key 'streamPlaybackAccessToken': Type of None should be 'dict' but is 'NoneType' or Key 'videoPlaybackAccessToken' not found in {'streamPlaybackAccessToken': None}

EnterGin commented 3 years ago

Streamlink problem