lay295 / TwitchDownloader

Twitch VOD/Clip Downloader - Chat Download/Render/Replay
MIT License
2.68k stars 261 forks source link

- #416

Closed DieHardjagged closed 1 year ago

ScrubN commented 1 year ago

What does "marked as completed" mean?

lay295 commented 1 year ago

Does it only happen with that one VOD? Or all of them?

If it only happens with the single VOD what is the ID of it? It would also be useful if you could upload the corrupted file somewhere so I could take a look at it.

ScrubN commented 1 year ago

Had no problems with previous VOD downloads, but then again, i used Version 1.50.5 of the Downloader for those.

1.50.6 should not have had any VOD downloading changes, so your issue should technically also be a problem on 1.50.5

ScrubN commented 1 year ago

Alright, so i tried downloading the same VOD again and i got the "failure" status after it kept being stuck at 90%.

We need to add even a brief stacktrace/exception message to that. Just a status indicator is so unclear.

ScrubN commented 1 year ago

I downloaded the same VOD with version 1.50.5 now and also only got a corrupted file out of it even though it was marked as completed. As a test, i downloaded something entirely different, a short clip that someone created on my own Twitch channel, zero problems downloading and playing it.

Sounds like it could be specific to the VOD or VODs in general? Can you test with other VODs and if it turns out to be that VOD in particular then please post the ID

ScrubN commented 1 year ago

I was able to successfully download the VOD via the CLI. Testing with the GUI task queue now. Also downloading at 160p because I don't have the bandwidth to download 7gb of footage multiple times, so that may affect my ability to replicate.

ScrubN commented 1 year ago

The GUI task queue finished without fail. Either the 160p affected the results or the issue is specific to you. Could you try downloading the VOD at 160p to confirm if that has an effect?

Zibbp commented 1 year ago

I was able to download 1644280471 via the GUI and CLI at 1080 (best) resolution without corruption. Perhaps ffprobe can give some more information. If you have a succesful, but corrupt video, can you run ffprobe /path/to/video.mp4 and provide the results.

Zibbp commented 1 year ago

No worries. If you're still planning on uploading the corrupt video we can download that and use ffprobe on it.

Zibbp commented 1 year ago

FFprobe states the following for the mp4.

[mov,mp4,m4a,3gp,3g2,mj2 @ 0000021290182940] moov atom not found

Upon a quick Google search it appears this most commonly happens when the process creating the mp4 unexpectedly ends and cannot create the atom metadata which is one of the last steps.

ScrubN commented 1 year ago

For an easy solution to moov atom not found, I found a youtube tutorial that should walk you through the process: https://youtu.be/K3nWw9aX5kw

ScrubN commented 1 year ago

Now the question is why does the transcoding quit before adding the the moov atom? Perhaps it's because something screwed up on Twitch's end but the program assumes it wasn't?

ScrubN commented 1 year ago

I was able to download 1644280471 via the GUI and CLI at 1080 (best) resolution without corruption.

@Zibbp How did you download from the GUI? Did you use task enqueuing? It's possible it's linked to that

Zibbp commented 1 year ago

How did you download from the GUI? Did you use task enqueuing? It's possible it's linked to that

Downloaded without the task queue, directly from the "VOD Downloader" tab.

Zibbp commented 1 year ago

Just tried downloading 1644280471 via the task queue and I was able to re-produce the corrupted mp4. FFprobe throws the same error: [mov,mp4,m4a,3gp,3g2,mj2 @ 0000029816222680] moov atom not found Something with queueing up vods is screwing it up.

Zibbp commented 1 year ago

Until the issue is located, you should be able to download the 1080p VOD using the "VOD Downloader" tab, not the "Task Queue" tab. I did not have any issues downloading the VOD this way. image

ScrubN commented 1 year ago

and since i cant get a working file in 720p/1080p anymore

I downloaded 1644280471 at 720p60 using enqueue and enabled all logging on ffmpeg and it completed the transcode fine. There were about 510 corrupt packets but other than that nothing unusual happened. I can try again with 1080p60 but that'll take a few more hours.

ScrubN commented 1 year ago

The 1080p60 download finished identically to the 720p60 one. The transcode went fine and again had around 500 corrupt packets.

I don't know if the difference is because of my computer, or the fact I used only 2 download threads, or because I'm debugging on master, or because I setup breakpoints, but I'm unable to reproduce it in an environment where I can actually see what the program is doing.

Seeing as one of your downloads failed at 90% I'd have to assume either Twitch temporarily blocked your IP or your internet dropped out for more than 10 times.


Speaking of, it would probably be wise to change from checking total error counts to logging the dateTime of when errors occur as on a slower or unstable connection it would not be unlikely to drop more than 10 times over the course of let's say 1-4 hours of downloading the same VOD. Then you can check the total error count during for example the last 30 minutes to better estimate if the download should be canceled.

https://github.com/lay295/TwitchDownloader/blob/611ae6a7e448709df627af0ef0dad9dfadb11586/TwitchDownloaderCore/VideoDownloader.cs#L150-L168

lay295 commented 1 year ago

I've tried many times with both the queue and the main download page to try and reproduce this and I can't. Tried every resolution on the VOD in both ways and couldn't get it.

If anybody does manage to reproduce it and gets all the .ts files before the program cleans it up that would be pretty awesome.

@ScrubN yeah... the VOD/Clip downloading of this program was kind of an after thought :) I usually just point people towards TwitchLeecher but well... can't do that anymore I suppose. Ideally I would want to handle errors a bit more intelligently on the VOD side (like scaling back concurrent download connections or something).

Zibbp commented 1 year ago

Downloaded 1644280471 via the queue again at 1080p and this time the VOD had no corruption or playback issues. Must have been something on Twitch's end?

ScrubN commented 1 year ago

Yeah I'd be inclined to assume the issue was on Twitchs end, probably they were still processing it but it was very low priority because small streamer. Nonetheless I would still like to change the error counter like I mentioned.

ElBuenAnvita commented 1 year ago

Experienced same issue twice this week using v1.50.7 [first time]/v1.51.0 [second time]. I usually Download VOD + Chat JSON via Task Queue. Both times the corruped videos were the last VOD added in the queue and both videos were downloaded/rendered AFTER a VOD that was downloaded with the "Crop" option.

This is a theory but maybe the crop option may be interferring with the next video in queue. Or maybe that it's the last one in queue. Gotta check that later when I continue to downloading another VODs. Or maybe everything it's just a coincidence.

This is my current shown Task Queue in TwitchDownloader: image

Here are the files from that task queue in the file explorer; the selected one is the corrupted one: image

These are the details of the timeline of VODs downloaded + notes explaining (I always make a list of VODs I'll download): image

Command ffprobe on corruped video also throws moov atom not found. image

I hope this information may be helpful.

If anybody does manage to reproduce it and gets all the .ts files before the program cleans it up that would be pretty awesome.

And sorry, the temp folder was already cleaned and no .ts files I found there.

A sidenote: Before pushing this comment, I noticed I was running out of space in my computer [currently 4,85 GB availabe out of 476 GB], (maybe the encoding was mid-stopped because it run out of space...?)

I'm going to continue downloading and retrying download this VOD. I'll update over here if it happens again.

lay295 commented 1 year ago

@ElBuenAnvita I'm not 100% sure your issue was the same OP was having but yeah if you have simultaneous downloads of the same VOD I can see there being issues.

Can give 1.51.1 a try