ancalentari / twitch-stream-recorder

Record twitch streams live!
MIT License
261 stars 72 forks source link

Sound Shutter/lag in recorded File #8

Open DerSani1988 opened 4 years ago

DerSani1988 commented 4 years ago

I just tried to record a livestream what worked very well. The file was written with "Written 232.2 MB (5m10s @ 739.7 KB/s)".

i noticed followin by playing the file with VLC:

My Setup:

[cli][info] Found matching plugin twitch for URL twitch.tv/gronkh
[cli][info] Available streams: audio_only, 160p (worst), 360p, 480p, 720p, 720p60, 1080p60 (best)
[cli][info] Opening stream: 1080p60 (hls)
[download][..oy - FREiAB18   ff6.mp4] Written 368.1 MB (8m8s @ 738.5 KB/s)

Tried to fix with: ffmpeg -err_detect ignore_err -i video.mkv -c copy video_fixed.mkv

this only fixed the lengh of the file and not the sound problem

1) I don't know why the bitrate is so low, I have a 1Gbps Download. 2) Why do the sound shutter/lag

Do anyone have an idea? I searched for hours and found nothing helpfull

starvald commented 4 years ago

i've been having similar problems, i always have ffmpeg disabled and noticed problem since ads were embedded.

  1. sometimes the 13 second ad screen will just loop constantly and kodi/smplayer/vlc can't get passed it.
  2. as you found running it through ffmpeg will alter the voices.

i did find a program to fix individual streams but its windows based and not free but it does work with wine. TS-Doctor €34.9. though a problem afterwards is i have to turn off adjust refresh rate in kodi or my TV will keep changing modes. if someone finds a better way i would be interested in trying it.

DerSani1988 commented 4 years ago

Okay I found the solution by try and error.

Just Change this line and i don't have any problem:

["streamlink", "--twitch-oauth-token", self.access_token, "twitch.tv/" + self.username,
 self.quality, "-o", recorded_filename])

you have to add following parameter: --twitch-disable-ads

The line after adding this looks like:

["streamlink", "--twitch-disable-ads", "--twitch-oauth-token", self.access_token, "twitch.tv/" + self.username,
 self.quality, "-o", recorded_filename])

After this the file is no longer corrupted, the voice is not pitched and don't lag anymore

starvald commented 4 years ago

last time i tried that command it kept splitting the stream into separate files, have they fixed that?

DerSani1988 commented 4 years ago

last time i tried that command it kept splitting the stream into separate files, have they fixed that?

This do the trick for me, no splitted files. Maybe it will split the files, if twitch plays mid rolls.

Stefomat commented 4 years ago

I had the same issues as @DerSani1988 . His/Her solution worked for me as well (--twitch-disable-ads). Does anybody know how to fix already recorded streams? TS-Doctor didn't really work for me. Maybe User error?

PS @DerSani1988 : Kam bisschen überraschend hier plötzlich FREiAB18 zu lesen. Bin wohl nicht der Einzige. :)

mouarflenoob commented 4 years ago

I'm also looking for a software to clean up my files. I can't use TS Doctor because it gives me an error. Would the V.O.D. be fixable using ffmpeg?

DerSani1988 commented 4 years ago

I had the same issues as @DerSani1988 . His/Her solution worked for me as well (--twitch-disable-ads). Does anybody know how to fix already recorded streams? TS-Doctor didn't really work for me. Maybe User error?

Sadly I don't have "corrupted" files left to test. What I mentioned is, that a cutting tool called LosslessCut have replayed the sound correct, So maybe it is worth to give it a try and reexport the file. Another solution may be to convert the file. If you can send me a short file (5-10 Minutes) I can try some ways to restore the sound (You can cut out the segment with LosslessCut)

I'm also looking for a software to clean up my files. I can't use TS Doctor because it gives me an error. Would the V.O.D. be fixable using ffmpeg?

As I mentioned above to @Stefomat

PS @DerSani1988 : Kam bisschen überraschend hier plötzlich FREiAB18 zu lesen. Bin wohl nicht der Einzige. :)

Hey, ja genau, seit der DMCA-Geschichte bei Twitch werden leider keine VODs gespeichert und somit fehlt mir das Ritual am Wochenende den nicht gesehenen Part (gerade die Talks) nachzuschauen ^^

mouarflenoob commented 4 years ago

@DerSani1988

If you can send me a short file (5-10 Minutes) I can try some ways to restore the sound (You can cut out the segment with LosslessCut)

Here is a link to a 5 minute clip of distorded voice : https://mab.to/eOEMqODpx (230 MB) In VNC it stutters every other second. In LosslessCut it doesn't stutter, but the voice is still distorded in the preview. I have no clue as to what to do in LosslessCut to fix the voice. I will be trying things, but you may find the solution very much quickier than me ^^.

DerSani1988 commented 4 years ago

Here is a link to a 5 minute clip of distorded voice : https://mab.to/eOEMqODpx (230 MB) In VNC it stutters every other second. In LosslessCut it doesn't stutter, but the voice is still distorded in the preview. I have no clue as to what to do in LosslessCut to fix the voice. I will be trying things, but you may find the solution very much quickier than me ^^.

Do you have a short clip of the accurate voice so i can test the pitching of the voice.

Stefomat commented 4 years ago

@DerSani1988 Finally i had the time to upload my samples.

First file: Cut out with LosslessCut, voice distorded in VLC, MPC-HC and LosslessCut Preview https://www.dropbox.com/s/1cog9iab4sc88vf/gronkh%20-%202020-11-01%2019h18m22s%20-%20%20Heute%20ab%2019%20Uhr%20wieder%20HUNDE%20BEOBACHTEN%20%20ff6-01.41.19.888-01.51.22.057.mp4?dl=0

Second file: A complete recording, but starting in the middle of the stream (internet went down, it continued recording to a new file). You can see the 15 second ad section in the beginning. https://www.dropbox.com/s/s86g6qa3m8j5eyq/gronkh%20-%202020-11-07%2002h26m03s%20-%20Freitag%201830%20Uhr%20FREiAB18%20%20Assassins%20Creed%20Valhalla%2020%20Uhr%20%20ff6.mp4?dl=0

I guess for this streamer you don't need a known good example of his voice? ^^ Thanks.

mouarflenoob commented 4 years ago

Here is the public VOD from which it came I think : https://www.twitch.tv/videos/805889919

ancalentari commented 4 years ago

I was very busy lately and I come back to twitch ads messing up things...

Well I merged the pull request with the --twitch-disable-ads parameter.

As for the "voice is much deeper" issue, unfortunately I will not be able to look into it right now since I am very busy still but might be a matter of adjusting/adding parameters to the processing of the recorded file maybe? Or is it deeper before file is processed?

starvald commented 4 years ago

deeper after ffmpeg processing.

DerSani1988 commented 4 years ago

I was very busy lately and I come back to twitch ads messing up things...

Well I merged the pull request with the --twitch-disable-ads parameter.

As for the "voice is much deeper" issue, unfortunately I will not be able to look into it right now since I am still very busy still but might be a matter of adjusting/adding parameters to the processing of the recorded file maybe? Or is it deeper before file is processed?

I didn't check before processing. But this idea is worth to look into it.

I've tested:

All the same result:

I had no time to look into it deeper but I'll try some things.

Stefomat commented 4 years ago

For me it didn't matter if ffmpeg processing was enabled or disabled (--disable-ffmpeg), it always gave me the same distorded results. Using the option "--twitch-disable-ads" solved all related problems - stuttering, deep voice, crashing VLC.

Small detail i just remember: VLC always crashes at the exact moment the ad countdown (see my uploads) is over and the normal video starts.

DerSani1988 commented 4 years ago

For me it didn't matter if ffmpeg processing was enabled or disabled (--disable-ffmpeg), it always gave me the same distorded results.

I can confirm this

Using the option "--twitch-disable-ads" solved all related problems - stuttering, deep voice, crashing VLC.

Correct but I assume that more people are still looking for a fix for previously recorded files

Small detail i just remember: VLC always crashes at the exact moment the ad countdown (see my uploads) is over and the normal video starts.

Only sometimes for me

H-B-Schmidt commented 3 years ago

I can fix previous recorded files when reencoding with handbrake.

DerSani1988 commented 3 years ago

I can fix previous recorded files when reencoding with handbrake.

Yes partially, I tried this and this will fix the sound lags but not the deeper pitched voice

H-B-Schmidt commented 3 years ago

I can fix previous recorded files when reencoding with handbrake.

Yes partially, I tried this and this will fix the sound lags but not the deeper pitched voice

I can't detect any deeper pitched voice. Perhaps the difference is small and my ears are too old.

DerSani1988 commented 3 years ago

I can fix previous recorded files when reencoding with handbrake.

Yes partially, I tried this and this will fix the sound lags but not the deeper pitched voice

I can't detect any deeper pitched voice. Perhaps the difference is small and my ears are too old.

Maybe @Stefomat can make 2 examples so you can compare the voice. I am not on my computer today so I can't.

Stefomat commented 3 years ago

I sure can.

You can use the links i posted a couple of days ago. Both have the problem with the deep voice.

First file: Cut out with LosslessCut, voice distorded in VLC, MPC-HC and LosslessCut Preview https://www.dropbox.com/s/1cog9iab4sc88vf/gronkh%20-%202020-11-01%2019h18m22s%20-%20%20Heute%20ab%2019%20Uhr%20wieder%20HUNDE%20BEOBACHTEN%20%20ff6-01.41.19.888-01.51.22.057.mp4?dl=0

Second file: A complete recording, but starting in the middle of the stream (internet went down, it continued recording to a new file). You can see the 15 second ad section in the beginning. https://www.dropbox.com/s/s86g6qa3m8j5eyq/gronkh%20-%202020-11-07%2002h26m03s%20-%20Freitag%201830%20Uhr%20FREiAB18%20%20Assassins%20Creed%20Valhalla%2020%20Uhr%20%20ff6.mp4?dl=0

For comparison you can listen to the official VODs from Twitch: https://www.twitch.tv/gronkh/videos?filter=archives&sort=time

If you need more examples or information, just get in touch.