lay295 / TwitchDownloader

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

Downloads will never finish/pass the "encoding metadata" stage #914

Closed RubenRME closed 7 months ago

RubenRME commented 7 months ago

Checklist

Edition

Windows GUI Application

Describe your issue here

Cancelling the download will throw an error saying the output file "is being used by another process". Only after quitting the entire program the file is accessible by the video player.

Steps to reproduce:

  1. Start downloading any clip
  2. watch it progress past download
  3. Observe it hang at encoding metadata

Add any related files or extra information here

No response

HayleTechnica commented 7 months ago

I am having the same issue, thought I only use the mass downloader. The download reaches 100% but seems to be unable to begin the transcode with FFMPEG because of the file access issue. Attempting to delete a file before closing twitch downloader gives the message that it is being used by FFMPEG but task manager shows no CPU or GPU utilization for the FFMPEG process running under twitch downloader.

image

ScrubN commented 7 months ago

Attempting to delete a file before closing twitch downloader gives the message that it is being used by FFMPEG

This is very good information. I will capture the log output from FFmpeg and write it to a file, and I will need you to test it via a workflow build since I cannot reproduce the issue. Does this sound alright?

2904nando commented 7 months ago

Same problem here. I updated from another version and it just hangs on "Encoding Clip Metadata 0%". Cancelling and trying to delete the file throws an error that the file is being used. Forcing the ffmpeg process to end allows me to delete the file, but couldn't make it work.

HayleTechnica commented 7 months ago

Attempting to delete a file before closing twitch downloader gives the message that it is being used by FFMPEG

This is very good information. I will capture the log output from FFmpeg and write it to a file, and I will need you to test it via a workflow build since I cannot reproduce the issue. Does this sound alright?

I can do that no problem

TheInevitableBug commented 7 months ago

Turning off 'Encode Metadata' in the clip download menu allows clips to download in the task queue

ScrubN commented 7 months ago

I might have discovered the problem... The generated path for the metadata file was accidentally relative instead of absolute, which could be causing issues regarding file permissions image

ScrubN commented 7 months ago

Sadly #922 did not fix the problem, as I just experienced it while debugging a different feature. I was able to output a verbose log from FFmpeg, however I was unable to come to any useful conclusions. If any FFmpeg wizards are in this thread, you are welcomed to help interpret the log file: ffmpeg-20240104-210417.log

In the meantime, I will be adding a 30 second timeout on the encoding metadata stage.

ScrubN commented 7 months ago

To make matters stranger, the mp4 file of the last clip was written entirely and FFmpeg seemed to just lock up? I just experienced the issue again with a different clip, and this one only wrote 75 bytes before stopping: ffmpeg-20240104-215045 - Copy.log image

ScrubN commented 7 months ago

I have solved the issue. We were redirecting stderr, but we did not call BeginErrorReadLine(), which caused FFmpeg to lock up until TwitchDownloaderWPF was closed, but only sometimes?