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

Only 'default' format works #326

Closed beew closed 2 years ago

beew commented 3 years ago

tartube 2.3.306

If you try to get audio, e.g mp3, a popup appears complaining about youtube-dl's path (it is in /usr/bin/ here) but the actual error log is

/usr/bin/youtube-dl --newline -i --hls-prefer-native --write-description --write-info-json --write-annotations --cookies /home/monkeybrain/tartube-data/cookies.txt --write-thumbnail -f mp3 --merge-output-format mp3 --output /home/monkeybrain/Music/%(title)s.%(ext)s https://www.youtube.com/watch?v=NTayABOrFrk
[youtube] NTayABOrFrk: Downloading webpage
ERROR: requested format not available

OS is Archlinux. I am running tartube from a folder without installing, but earlier tried pip install got the same error. Tartube-2.3.110 works though.

axcore commented 3 years ago

noexist

The file you are trying to download does not exist (as evidenced by the screenshot above).

I suspect you are using the Classic Mode tab, and that you selected the format mp3, and clicked the button Download in this format (please tell me if that's not the case).

Since the file doesn't exist, the solution is to click Convert to this format using FFmpeg/AVconv. You will need to add the URL to the top half of the window again, before clicking the Add URLs button.

I will think about adjusting the popup window to suggest this same solution, as I can see how it would be confusing.

axcore commented 3 years ago

I changed the popup window to show this. Do you think it's an improvement?

isbetter2

beew commented 3 years ago

@axcore

Actually the file does exist. If you change the format to "default" it downloaded a MKL and downloading and converting to audio (tried wav, mp3, ogg and flac) works for tartube 2.3.110 as well as youtube-dl command line.

They all failed with tartube 2.3.306 and only with tartube2.3.306

Re the popup interface.

I think it may be misleading because tartube 2.3.306 does find youtube-dl in /usr/bin as evident by the error message. It didn't work for some other reasons.

axcore commented 3 years ago

Ok, I have tested Classic Mode in v2.3.110. First, I set the format to 'Default', and received an .mkv video.

/home/ra/.local/bin/youtube-dl --newline -i --hls-prefer-native -o /home/ra/%(title)s.%(ext)s --write-description --write-info-json --write-annotations --cookies /home/ra/tartube-data/cookies.txt --write-thumbnail https://www.youtube.com/watch?v=NTayABOrFrk

Then I set the format to to .mp3, downloaded the same video, and received a .webm that was converted to .mp3.

/home/ra/.local/bin/youtube-dl --newline -i --hls-prefer-native -o /home/ra/%(title)s.%(ext)s --write-description --write-info-json --write-annotations --cookies /home/ra/tartube-data/cookies.txt --write-thumbnail -x --audio-format mp3 https://www.youtube.com/watch?v=NTayABOrFrk

The important part of the second command is -x --audio-format mp3. The -x means "Convert video files to audio-only files (requires ffmpeg/avconv and ffprobe/avprobe)'.

Finally, I set the format to .avi. According to the screenshot above, that file does not exist, and this is in fact what we actually see:

/home/ra/.local/bin/youtube-dl --newline -i --hls-prefer-native -o /home/ra/%(title)s.%(ext)s --write-description --write-info-json --write-annotations --cookies /home/ra/tartube-data/cookies.txt --write-thumbnail -f avi --merge-output-format avi https://www.youtube.com/watch?v=NTayABOrFrk [youtube] NTayABOrFrk: Downloading webpage ERROR: requested format not available

This is the expected behaviour for v2.3.110. When a video format was selected, the download failed if that format wasn't available. But when an audio format was selected, a video was downloaded, and the audio was extracted from that and converted to .mp3.

I changed the behaviour because inconsistent interfaces are bad, and because it was confusing people.

axcore commented 3 years ago

Now, in v2.3.306, we have a different interface: the user can choose explicitly between downloading a particular video/audio format, and downloading a default video format which is then converted.

So, if Download in this format is selected, the download will fail if the video/audio format isn't one of those listed in the screenshot: .webm, .mp4 or .m4a.

Convert to this format using FFmpeg/AVconv will succeed in all cases, if FFmpeg or AVconc are actually installed.

You said:

works for tartube 2.3.110 as well as youtube-dl command line.

Perhaps you can show me the youtube-dl command you are using to download the .mp3 of your video directly. Then we can work out what is causing the confusion.

axcore commented 3 years ago

You also said:

Re the popup interface. I think it may be misleading because tartube 2.3.306 does find youtube-dl in /usr/bin as evident by the error message. It didn't work for some other reasons.

How do you think it can be improved? It is a common complaint that people install Tartube, try to download a video, and nothing happens. So there needs to be some kind of advice, rather than leaving the user to work it out for themselves.

beew commented 3 years ago

@axcore

Perhaps you can show me the youtube-dl command you are using to download the .mp3 of your video directly. Then we can work out what is causing the confusion.

Hi, here is the command along with the output

$ youtube-dl --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=NTayABOrFrk
[youtube] NTayABOrFrk: Downloading webpage
[download] Destination: Young Thug - Guwop feat. Quavo, Offset, and Young Scooter [Official Video]-NTayABOrFrk.webm
[download] 100% of 5.37MiB in 00:00
[ffmpeg] Destination: Young Thug - Guwop feat. Quavo, Offset, and Young Scooter [Official Video]-NTayABOrFrk.mp3
Deleting original file Young Thug - Guwop feat. Quavo, Offset, and Young Scooter [Official Video]-NTayABOrFrk.webm (pass -k to keep)
beew commented 3 years ago

How do you think it can be improved? It is a common complaint that people install Tartube, try to download a video, and nothing happens. So there needs to be some kind of advice, rather than leaving the user to work it out for themselves.

Hi, I really don't know since my use cases are very simple, just to download some music or videos occasionally and no fancy stuffs like playlist and what not. I am also quite comfortable with the cli, I am checking out tartube mainly for friends I am setting up Linux systems for.

I may be missing the point but I find tartube is confusing to use because it has too many options and settings. I think from the developer's point of view it is also hard to maintain and bug prone, but that is for you to decide of course. e.g I am not sure if it is necessary to have a bunch of different options to install/update youtube-dl. From my simple mind I think it only needs to pip install/update it with --user flag so it doesn't require sudo and ~/.local/bin will override the other versions. For most distros the version installed by system in ./usr/bin is hopelessly outdated anyway (but I am currently on Arch so that is a bit of an exception since AUR is very up to date nomally) I remember I was getting errors updating youtube-dl because the wrong box was checked. The average gui user probably doesn't understand what these options mean anyway.

I mainly just use the classical view because the old youtube-dlg was quite simple and intuitive and adequate for simple use cases such as mine. But then again it is just me, I am sure the rich features in tartube would appeal to a lot of users.

I think the error log is quite useful, but I don't know how to put it in a simple popup interface to enable the average user to figure out what to do by themselves. If you have some idea of what might fail you can provide some steps that user can follow to rectify the problem? ( I see you are trying to do that by suggesting that maybe the downloader's path is not right etc)

Thanks for the app and your work.

beew commented 3 years ago

Oh speaking of updating and installing youtube-dl I remember when setting up V2.3.306 I clicked install/update youtube-dl it said a copy was already installed in /usr/bin and that I should update via the same method that it was installed. That actually doesn't make a lot of sense since youtube-dl is often installed as a dependency or recommended package for mpv by package manager, but that version is ancient. and will never get updated in a static distro like Ubuntu. The user can of course install up to date version with pip himself, but since you already provide the button it seems defeating the purpose to require the user (who may not know pip) to do it himself with the cli.

So instead of checking if youtube-dl is already installed tartube should just install the latest in ~/.local/bin and that's it That way the user always has the latest youtube-dl when updating through tartube without having to know anything about pip.

axcore commented 3 years ago

Hi, here is the command along with the output

Yes, that is the almost the same as my example above (-x is the same as --extract-audio). This command downloads the .webm and then uses FFmpeg or AVconv to convert it to .mp3. FFmpeg/AVconv doesn't produce visible output, so you can't see those stages in the copy-pasted text.

I may be missing the point but I find tartube is confusing to use because it has too many options and settings.

People keep requesting new features, and I have implemented most of them, so you can blame those people for the complexity. Tartube v1.0.0 was quite simple :)

Anyway, most users don't need to use any of those features. Add some URLs and download them, that's a total of three buttons to click, not complex at all. Just like when I use Audacity or Gimp, I don't know how 99% of the features work, but the basic functionality is simple so I can just use that.

I think from the developer's point of view it is also hard to maintain and bug prone,

Luckily the original youtube-dl-gui was very well-written, so the modern Tartube code is not so complicated, I find it quite easy to maintain.

I am not sure if it is necessary to have a bunch of different options to install/update youtube-dl. From my simple mind I think it only needs to pip install/update it with --user flag so it doesn't require sudo and ~/.local/bin will override the other versions

What about users who don't have pip installed on their system? If I remove all options except pip then half of the userbase is going to be very annoyed.

So instead of checking if youtube-dl is already installed tartube should just install the latest in ~/.local/bin and that's it That way the user always has the latest youtube-dl when updating through tartube without having to know anything about pip.

Unfortunately installing other software is not allowed on some distributions. If Tartube silently installs and updates youtube-dl silently for all users, then some package repositories will remove Tartube or refuse to add it.

beew commented 3 years ago

Yes, that is the almost the same as my example above (-x is the same as --extract-audio). This command downloads the .webm and then uses FFmpeg or AVconv to convert it to .mp3. FFmpeg/AVconv doesn't produce visible output, so you can't see those stages in the copy-pasted text.

Yes, behind the scene it is. But for the gui users they just download an audio file and there is no need for an additional convert button. They don't have to know ffmpeg is working behind the scene to do the conversion and they probably don't and don't know which formats are available and which need to be converted if they don't use the cli. If they do know all the cli options then they probably don't need a gui like tartube. BTW I think Avconv is long dead, who still uses it?

I think having this additional convert to this format option is just unnecessarily confusing for users (it confused me since I missed it and so I filed this bug) If you choose to download in a format from the drop down list (classical view) All necessary conversions should be implicit (just like in tartube 2.3.110 and before), how else do you get the file?

Unfortunately installing other software is not allowed on some distributions. If Tartube silently installs and updates youtube-dl silently for all users, then some package repositories will remove Tartube or refuse to add it.

No, I don't mean to silently install youtube-dl behind the user's back. You can still have a popup prompting user to press a button to install but remove the checking of whether youtube-dl is already installed and remove the 100 options to install it, just do pip3 install -U youtube-dl --user if the button is pressed. If pip is not already installed, prompt the user to install it with the package manager, python-pip is in the repository for all distros (or python3-pip if one still uses an old system where pip is pip2 but again there is no reason to choose python2 since it is dead and pip2 install anything would likely result in error)

Since the youtube-dl provided by distros (except AUR) is ancient anyway, telling users to 'upgrade' the existing copy (behaviour of 2.3.306 when first run) makes no sense since you can't. The user would have to use pip to update youtube-dl anyway (since this is the easiest way, I think there are other ways to install youtube-dl like install script but they are just more tedious)

(yes, I am aware that pip provided by distros is outdated too, but it will work, just gives you a warning and advise to update if you run it in the terminal)

Since you asked me how tartube can be improved, I am offering my 2 cents. Please don't be offended.

axcore commented 2 years ago

I will close this old issue.

About your first comment, in the post above: I have changed the layout of the Classic Mode tab. Conversion is now the default; the user must actively intervene if they want to download the specified format.

I also changed the layout of the download options window, so even a newbie will understand that "download in this format" is not the same as "convert to this format".

Apologies if I have already told you this in another issue, but my memory is very small, probably only 16 KB.