MrS0m30n3 / youtube-dl-gui

A cross platform front-end GUI of the popular youtube-dl written in wxPython.
The Unlicense
9.3k stars 1.59k forks source link

Gui cannot download some files that youtube-dl can #49

Closed Pcsl closed 9 years ago

Pcsl commented 9 years ago

Hello there,

I really like your software and find it very useful but I'm having problems to download some specific links, specifically from the platform this link comes from: http://www.mitele.es/programas-tv/este-hotel-es-un-desastre/temporada-1/programa-1/ . Using the command line interface from youtube-dl the files is download without problems but when I try to download it using your GUI, it got stuck in "Downloading" and doesn't show any speed, ETA, percent nor size. Actually I think that the files doesn't start to download. Apart from that when this happens, the button "STOP" doesn't work and can't close the program, I have to use the task manager to force close it.

I hope you can look into this.

MrS0m30n3 commented 9 years ago

Hi @Pcsl

Which version of youtube-dlg you are using?

I was unable to download the url you gave me both with the latest version of youtube-dl and youtube-dlg. The GUI terminates normally with an Error status for the given URL.

You should do the following:

Pcsl commented 9 years ago

I can download that link with youtube-dl 2015.07.07 without problems (I need ffmpeg in the same folder though).

I tried to add the log here but the problem is that the task never stops, it just get stuck in "Downloading" and never ends so there's no way to view the log as it seems it's saved when the download terminates.

MrS0m30n3 commented 9 years ago

Can you tell me which version of youtube-dlg you are using?

Does this problem occurs every time you try to download the given url ? Also, can you run youtube-dl (command-line) with the -v option and paste your output here?

Pcsl commented 9 years ago

I'm using the last version 0.3.8 for Windows (portable). Yeah, that problems occurs every time (I tried more than 10 times). Here you have the log:

D:>youtube-dl -v http://www.mitele.es/programas -tv/este-hotel-es-un-desastre/temporada-1/programa-1/ [debug] System config: [] [debug] User config: [] [debug] Command-line args: [u'-v', u'http://www.mitele.es/programas-tv/este-hote l-es-un-desastre/temporada-1/programa-1/'] [debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252 [debug] youtube-dl version 2015.07.07 [debug] Python version 2.7.8 - Windows-7-6.1.7601-SP1 [debug] exe versions: ffmpeg N-71883-geb9fb50 [debug] Proxy map: {} [mitele.es] programa-1: Downloading webpage [mitele.es] programa-1: Downloading XML [mitele.es] programa-1: Downloading JSON metadata [mitele.es] programa-1: Downloading m3u8 information [debug] Invoking downloader on u'http://mitele1-vh.akamaihd.net/i/geo/2i/mC/2imC et301xsyiRFSEV3ab3/Aayo0VkwFejznVJ1XXnDE4.1100,,.mp4.csmil/index_0av.m3u8?null= ' [download] Destination: Programa 1 - Gurney's Inn - Montauk, NY-875446af.mp4 ffmpeg version N-71883-geb9fb50 Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.9.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca -- enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena ble-decklink --enable-zlib libavutil 54. 23.101 / 54. 23.101 libavcodec 56. 35.101 / 56. 35.101 libavformat 56. 31.100 / 56. 31.100 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 16.100 / 5. 16.100 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 Input #0, hls,applehttp, from 'http://mitele1-vh.akamaihd.net/i/geo/2i/mC/2imCet 301xsyiRFSEV3ab3/Aayo0VkwFejznVJ1XXnDE4.1100,,.mp4.csmil/index_0_av.m3u8?null=':

Duration: 00:42:34.00, start: 0.100511, bitrate: 0 kb/s Program 0 Metadata: variant_bitrate : 0 Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv), 720x4 04 [SAR 1021:1024 DAR 45945:25856], 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, flt p, 88 kb/s Stream #0:2: Data: timedid3 (ID3 / 0x20334449) [mp4 @ 056fcb00] Codec for stream 0 does not use global headers but container fo rmat requires global headers [mp4 @ 056fcb00] Codec for stream 1 does not use global headers but container fo rmat requires global headers Output #0, mp4, to 'Programa 1 - Gurney's Inn - Montauk, NY-875446af.mp4.part':

Metadata: encoder : Lavf56.31.100 Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 720x404 [SAR 102 1:1024 DAR 45945:25856], q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 88 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help frame= 261 fps=0.0 q=-1.0 size= 1523kB time=00:00:10.42 bitrate=1196.5kbits/ frame= 501 fps=477 q=-1.0 size= 2933kB time=00:00:20.01 bitrate=1200.6kbits/

MrS0m30n3 commented 9 years ago

The gui does not provide any info about the size, eta, download speed etc. because those informations are not available neither on the youtube-dl.

Now for the second issue with the stop button, i was able to reproduce it using a proxy. The gui hangs both on Windows and Linux when the stop button is pressed. This issue does not only apply in the mitele.es but on every site that uses the hls.py downloader.

Also, the download process never stops both on Windows and Linux.

I will take a closer look on this.

Pcsl commented 9 years ago

Thanks for your work! Apart from that, did you find out why the download works with my youtube-dl version but not with youtube-dl-gui¿

MrS0m30n3 commented 9 years ago

There were two different bugs.

Both bugs had more or less to do with the hls downloader and the usage of ffmpeg (more specifically with this line of code).

The first bug was that the subprocess module was deadlocking due to the large amount of ffmpeg output in the stderr pipe which had as a result to freeze the download process (this issue is now fixed both on Windows and Linux using a seperate thread to read from the stderr pipe).

The second bug was that currently there is no way to kill the whole process group using the subprocess module (see: https://bugs.python.org/issue5115). So basically the stop button kills only the youtube-dl process which leaves ffmpeg process as an orphan, which in turn makes youtube-dlg to wait for the completion of the ffmpeg process before it closes down itself. (If you use something like Process Explorer and pay attention to what is happening when you click the stop button you will get what i mean).

This issue is now fixed on Linux using the os.killpg function. On Windows there is no easy way to terminate the whole process group using the subprocess module, so the stop button won't work when the hls downloader is used. In order to overcome this issue on Windows you can use the native hls downloader (does not use ffmpeg) by setting the --hls-prefer-native option under Options > Commands tab.

I uploaded the patched version (it's not stable) here. I was able to successfully download your url using the patched version and by setting the --hls-prefer-native option.

Can you give it a try and let me know?

MrS0m30n3 commented 9 years ago

Μore generally, you should be able to download any url that uses the hls downloader without setting the --hls-prefer-native option under Options > Commands , but on Windows the stop button won't work unless you set it or until this issue is fixed.

Notes

Pcsl commented 9 years ago

First of all I tried to download using the patched version without setting the --hls-prefer-native option. The download works now and shows 100% when it's finished, however the status says "Error". Anyway it's completed successfully, it's just that it says "Error" on the GUI. The Stop button doesn't finish the task here.

Setting --hls-prefer-native works flawlessly, shows the percentage completed while it's downloading and the task it's completed succesfully too. It also shows "Error" at the Status column even if it were downloaded completely. Here there is no problem to stop the task.

So yeah, it seems everything is working as you described.

MrS0m30n3 commented 9 years ago

Everything seems fine except the Error status.

You should check your log under Options > Log tab. Also, check if you have set the -v option under Options > Commands which creates the debug output to the log file. If you have the -v option remove it and give it another try.

Pcsl commented 9 years ago

Yeah, you are right, if I remove the -v option the status is right, it just says "Finished". So it seems to be working fine now.

MrS0m30n3 commented 9 years ago

Thanks for your report. If you encounter any problems, feel free to open a new issue.

Hrxn commented 9 years ago

Good job, great work! :+1:

(Just a little bit of encouragement) :smile:

MrS0m30n3 commented 9 years ago

Thank you @Hrxn :facepunch: