axcore / tartube

A GUI front-end for youtube-dl, partly based on youtube-dl-gui and written in Python 3 / Gtk 3
GNU Lesser General Public License v2.1
2.02k stars 109 forks source link

ERROR:[WinError 2]The system cannot find file specified #289

Closed strunberg closed 2 years ago

strunberg commented 3 years ago

dsfdsfsfd

axcore commented 3 years ago

What is the URL of the video you're trying to download?

strunberg commented 3 years ago

https://www.youtube.com/watch?v=4QdWRgNdir4

axcore commented 3 years ago

Sorry for the delay, real life keeps getting in the way.

I downloaded your video on both Linux and MS Windows without problems.

You're seeing a python error. Since both Tartube and youtube-dl are written in python, and since I can't reproduce the error, I have no idea what can be done to fix it.

If you feel like it, you could enable debug messages (Edit > System preferences >General > Debugging, then select the three checkbuttons). Then run Tartube from inside a terminal window, as described here. It will produce a lot of output, but somewhere in that output might be your error message.

You might try changing the download location to your C: drive, as it might possibly be a drive mounting problem.

Rygle commented 2 years ago

This might be similar to a problem I have when downloading videos. I am on Windows 10, using a portable installation.

I have had several videos seem to complete downloading, showing 100% in the progress tab, but never progressing beyond this. After some time I have given up and forced the process to stop in tartube, or quit tartube altogether. I then noticed that in the download directory, all the videos were there, but still named '.part' as they do when they're downloading, but they seemed to be complete. I could not rename or delete these files because windows would complain that they were still being used by another process, but I could copy the .part files and then rename them to .mp4 (etc) and they were almost always complete and absolutely OK. I then ran Task Manager (CTRL-SHIFT-ESC) and noticed that a whole lot of ffmpeg.exe processes were sitting there doing nothing - no network activity. Once I select these and hit 'end task', TarTube will finally move on and say that the download met an error in the progress tab. I can then also manage to either rename or delete the .part files. So it seems that ffmpeg processes are not getting terminated on completion of downloads and these processes are left not doing anything, but they still have a lock on the .part files and they prevent TarTube from moving on. Once I terminate these processes, TarTube will often move on to the next file and run a new ffmpeg thread to replace the old.

I believe that TarTube is recognising that the downloads are finished, and trying to rename the file from '.mp4.part' -> '.mp4' (or whatever suffix/format it was downloading), but it fails because the ffmpeg process goes idle and doesn't quit or let go of the file, so TarTube can't rename the file and just waits or eventually errors out.

Here's the end of a log from the output tab, where the first line seems to be a summary of a successful download, then the renaming error occurs. notice that this has "The system cannot find the file specified" as in the OP's error.

frame=10500 fps=168 q=-1.0 Lsize=   55474kB time=00:07:00.02 bitrate=1081.9kbits/s speed=6.74x
video:48498kB audio:6687kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.524575%
ERROR: unable to rename file: [WinError 32] The process cannot access the file because it is being used by another process: 'V:/downloads/Baby Race.mp4.part' -> 'V:/downloads/Baby Race.mp4'
ERROR: [WinError 2] The system cannot find the file specified: 'V:/downloads/Baby Race.mp4'

Perhaps TarTube needs to have a mechanism for terminating ffmpeg (or other helper) processes before trying to do other post-processing??

axcore commented 2 years ago

I believe that TarTube is recognising that the downloads are finished, and trying to rename the file from '.mp4.part' -> '.mp4'

Tartube does not do that kind of renaming, it's all handled by youtube-dl and ffmpeg, which are running in a separate system process. Tartube merely reads output to STDOUT and STDIN, and looks out for the child process to terminate. (It looks like you already k now what these terms mean.)

I don't use Windows so I've never seen this type of error. Presumably you would get the same error if you were running youtube-dl without Tartube.

The next time you see the error, make a note of the video's URL, and then try downloading it separately. If one video produces the same WinError each time then we have a basis for further testing. If it doesn't, then that is also useful information.

Rygle commented 2 years ago

First, thanks for such a useful GUI, and for your help!

The URL I fed YarTube for the series is https://iview.abc.net.au/show/bluey (it is probably geo-blocked outside Australia)

The URL for the episode mentioned above is https://iview.abc.net.au/video/CH1903Q037S00 (Baby race)

I also had the same problems with the following episodes (can tell because I renamed them manually after the others and can sort by mod date), and I remember the error messages in the output were identical. To be honest I've had similar problems with a number from different shows on the ABC iView site (only been doing this for a few days). If you can get past the geoblocking, these are only 7 minute episodes, so not too big for testing.

BBQ - https://iview.abc.net.au/video/CH1702Q023S00 Shadowlands - https://iview.abc.net.au/video/CH1702Q015S00 Backpackers - https://iview.abc.net.au/video/CH1702Q028S00 Barky Boats - https://iview.abc.net.au/video/CH1903Q033S00 Stumpfest - https://iview.abc.net.au/video/CH1903Q008S00 Swim School - https://iview.abc.net.au/video/CH1903Q039S00

I am using yt-dlp and had a go using the without YarTube before I found it. I will try to download these manually using the CLI version and report back.

axcore commented 2 years ago

Great! I am moving house at the moment, so I can't do any testing of my own.

axcore commented 2 years ago

Today I checked those links, and yt-dlp produced a broken site template error.

Regarding the frozen FFmpeg processes: I can't think of a way to unfreeze them, or even to detect that they are frozen, given that FFmpeg does not produce any output visible to Tartube. The thing to do, as you say, would be to use the CLI version of yt-dlp to download the video, and then if FFmpeg gets stuck, to report that as a yt-dlp issue.

Closing this issue now, as the original problem is ancient and unreproducable.