z1nc0r3 / AnyVideo-Downloader-Flow-Plugin

A Simple yet Powerful Flow Launcher plugin for downloading videos from literally thousands of websites.
https://www.flowlauncher.com/docs/#/plugins
16 stars 1 forks source link

System.IO.InvalidDataException: 'yt-dlp' is not recognized as an internal or external command, #15

Open CUR5EDFLVME opened 6 days ago

CUR5EDFLVME commented 6 days ago

When I try to download any video, flow launcher crashes with this message:

Please open new issue in: https://github.com/Flow-Launcher/Flow.Launcher/issues

  1. upload log file: C:\Users\cur5e\AppData\Roaming\FlowLauncher\Logs\1.19.4\2024-11-07.txt
  2. copy below exception message

Flow Launcher version: 1.19.4 OS Version: 22631.4317 IntPtr Length: 8 x64: True

Python Path: C:\Users\cur5e\AppData\Roaming\FlowLauncher\Environments\Python\PythonEmbeddable-v3.11.4\pythonw.exe Node Path: C:\Users\cur5e\AppData\Roaming\FlowLauncher\Environments\Node.js\Node-v16.18.0\node-v16.18.0-win-x64\node.exe Date: 11/07/2024 02:23:04 Exception: System.IO.InvalidDataException: 'yt-dlp' is not recognized as an internal or external command, operable program or batch file.

at Flow.Launcher.Core.Plugin.JsonRPCPlugin.ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 243 at Flow.Launcher.Core.Plugin.JsonRPCPlugin.ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 248 at Flow.Launcher.Core.Plugin.JsonRPCPlugin.ExecuteResultAsync(JsonRPCResult result) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 117 at Flow.Launcher.Core.Plugin.JsonRPCPluginBase.<>c__DisplayClass18_0.<b0>d.MoveNext() in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPluginBase.cs:line 89 --- End of stack trace from previous location --- at Flow.Launcher.ViewModel.MainViewModel.OpenResultAsync(String index) in C:\projects\flow-launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 389 at CommunityToolkit.Mvvm.Input.AsyncRelayCommand.AwaitAndThrowIfFailed(Task executionTask) at System.Threading.Tasks.Task.<>c.b128_0(Object state) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

2024-11-07.txt

z1nc0r3 commented 5 days ago

Is this when you start the plugin (just after typing "vd" in the FL) or after selecting a video from the result list?

CUR5EDFLVME commented 5 days ago

When selecting a video from the result list

z1nc0r3 commented 5 days ago

Thanks. I found that there is a bug in the getting yt-dlp.exe path. Working on a fix now and a new version will be released soon.

Pacha-io commented 4 days ago

Hello everyone! 😁

It doesn't work for me either. I tried to correct the error, for it I added the directory of 'yt-dlp' manually in the path of the system environment variables; then I got the error during the download that 'FFmpeg' was missing, which caused an error in the union of the files that download and in the handling of the codecs; so I decided to install the packages through ' winget install "FFmpeg (Shared)" ', which already creates me a single file.

I'm still stuck with a new problem, now when I use the command 'vd ...w.youtu...' it downloads the video with the format I ask for, but it embeds the 'Opus' audio codec: image

But now when I try to use 'vd ...w.youtu...' to download just the audio, then it downloads the audio in the correct format that I choose.

z1nc0r3 commented 4 days ago

I noticed that I had yt-dlp and ffmpeg installed globally without even realizing it. So the plugin used those binaries all the time even during the testing 😅

I did fix the core issue mentioned in this issue (not recognizing yt-dlp) but came across another problem due to the usage of ffmpeg. I introduced preferred audio settings by using the extract audio feature of yt-dlp but just noticed that it required ffmpeg binary.

And since the ffmpeg binary is significantly larger I have to come up with a workaround to support audio-only downloads 🤞.

z1nc0r3 commented 4 days ago

Hi @Pacha-io

I'm still stuck with a new problem, now when I use the command 'vd ...w.youtu...' it downloads the video with the format I ask for, but it embeds the 'Opus' audio codec:

With the current configurations of the plugin, the selected video will be merged with the best audio that is supported by the video provider. Is this something related to this?

Pacha-io commented 4 days ago

Hi @Pacha-io

I'm still stuck with a new problem, now when I use the command 'vd ...w.youtu...' it downloads the video with the format I ask for, but it embeds the 'Opus' audio codec:

With the current configurations of the plugin, the selected video will be merged with the best audio that is supported by the video provider. Is this something related to this?

@z1nc0r3

Yes, that's exactly what I mean, and since Windows 11 doesn't normally recognize the 'Opus' audio codec, it should be merged with some option like '.wav' or '.mp4'.

Is there any way we can change the default settings for the audio codec to be merged with the video?

z1nc0r3 commented 4 days ago

@z1nc0r3

Yes, that's exactly what I mean, and since Windows 11 doesn't normally recognize the 'Opus' audio codec, it should be merged with some option like '.wav' or '.mp4'.

Is there any way we can change the default settings for the audio codec to be merged with the video?

I think we can go with a little complex one like this (only for audio btw) in the yt-dlp examples

Download the best mp4 video available, or the best video if no mp4 is available $ yt-dlp -f "bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b"

Since we can't expect all the videos to have the chosen formats, we may need to use a wildcard as mentioned above.

Pacha-io commented 4 days ago

Where can I change the settings to assign these values:

$ yt-dlp -f "bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b"

I understand very well that we can't expect all the formats to be available.

I would like to make a suggestion to try to solve this opportunity:

  1. Add an option within the 'Flow Launcher\Plugins\AnyVideo Downloader' menu to determine the preferred audio codec combined within the video to be downloaded. Settings template example:

    image

  2. If the video does not have this audio codec download option, then display a message saying "The preferred audio format for this video is not available; the highest resolution codec available is...".

    Or to show a list of the posible high quality available codecs (idk if that's possible or kind of easy-accesible to implement it).

This way the user knows what the highest quality audio format available is and can try to change it to get a result that is compatible with their computer and operating system.

z1nc0r3 commented 4 days ago

This is the branch that I'm working on this fix You can find the command that defines the video/audio format here. (Please check the commit history)

So about the suggestions,

Pacha-io commented 4 days ago

@z1nc0r3 it might be a good idea to have the option to reorder the codecs according to the user's preferences so that when downloading and checking the audio codec list, the filter is something like:

Priority Lists sorted by ‘Audio Quality’ and ‘OS Compatibility’:

  1. Windows (High quality with natively supported formats):

    - Audio Codec Priority (Quality > Compatibility):
        flac > wav > aiff > alac > aac > mp4a > mp3 > ac4 > eac3 > ac3 > dts > vorbis > opus > other
    
    - Audio Extension Priority (Quality > Compatibility):
        wav > flac > m4a > aac > mp3 > alac > ogg > opus > webm > other.
  2. Mac OS (High quality and compatibility with native Apple formats):

    - Audio Codec Priority (Quality > Compatibility):
        alac > flac > wav > aiff > aac > aac > mp4a > mp3 > ac4 > ac4 > eac3 > ac3 > dts > vorbis > opus > other
    
    - Audio Extension Priority (Quality > Compatibility):
        alac > m4a > wav > aac > flac > mp3 > ogg > opus > webm > other.
  3. Linux (High Quality with preference for Open Source Codecs):

    - Audio Codec Priority (Quality > Compatibility):
        flac > wav > opus > vorbis > aac > mp4a > alac > mp3 > ac4 > eac3 > eac3 > ac3 > dts > other
    
    - Audio Extension Priority (Quality > Compatibility):
        flac > wav > ogg > opus > opus > m4a > aac > mp3 > webm > other

Explanation of Choices: High Quality, first filter: FLAC, WAV, and AIFF formats are at the top of every operating system's list, as they are lossless formats and offer the best audio fidelity.

OS Compatibility, second filter: After the lossless codecs, the most compatible formats for each operating system (e.g. ALAC for Mac OS and AAC for Windows and Linux) are prioritised to ensure that the file is easy to play in each environment.

Preference for Open Compute on Linux: Linux prioritises Opus and Vorbis after FLAC and WAV, since they are open source and generally well supported on Linux systems.

Pacha-io commented 4 days ago

If you like my proposal, it might be a good idea to adjust these lists for lower audio quality for resource-limited computers or internet networks in the following or similar ways:

Audio Quality Levels for Limited Resources.

  1. Medium-High (Moderately high quality, reasonable resources):

    Windows:
        - Audio Codec Priority:
            flac > wav > aiff > alac > aac > aac > mp4a > mp3 > ac4 > ac3 > eac3 > ac3 > other
        - Audio Extension Priority:
            wav > flac > m4a > aac > mp3 > alac > ogg > other
    
    Mac OS:
        - Audio Codec Priority:
            alac > flac > wav > aiff > aac > mp4a > mp3 > ac4 > ac3 > dts > other
        - Audio Extension Priority:
            alac > m4a > wav > aac > flac > mp3 > ogg > other
    
    Linux:
        - Audio Codec Priority:
            flac > wav > opus > vorbis > aac > mp4a > alac > mp3 > ac4 > ac3 > other
        - Audio Extension Priority:
            flac > wav > ogg > opus > opus > m4a > aac > mp3 > other
  2. Medium (Moderate quality, optimised for slower connections and standard hardware):

    Windows:
        - Audio Codec Priority:
            aac > mp4a > mp3 > mp3 > ac4 > eac3 > other
        - Audio Extension Priority:
            m4a > aac > mp3 > ogg > other
    
    Mac OS:
        - Audio Codec Priority:
            alac > aac > mp4a > mp3 > eac3 > other
        - Audio Extension Priority:
            m4a > alac > aac > aac > mp3 > ogg > other
    
    Linux:
        - Audio Codec Priority:
            opus > vorbis > aac > mp4a > mp3 > other
        - Audio Extension Priority:
            ogg > opus > m4a > aac > mp3 > other
  3. Low (Basic quality, minimum resource consumption):

    Windows:
        - Audio Codec Priority:
            mp3 > aac > other
        - Audio Extension Priority:
            mp3 > m4a > other
    
    Mac OS:
        - Audio Codec Priority:
            aac > mp3 > other
        - Audio Extension Priority:
            m4a > mp3 > other
    
    Linux:
        - Audio Codec Priority:
            vorbis > mp3 > other
        - Audio Extension Priority:
            ogg > mp3 > other

Explanation of this proposal or starting point: Medium-High: Provides good audio quality, eliminating high-bandwidth codecs but maintaining good fidelity options such as FLAC and ALAC on systems where supported.

Medium: Downgrades to compressed and more efficient codecs, such as AAC and MP3, which maintain an acceptable trade-off between size and quality, ideal for standard hardware and connections.

Low: Prioritised to reduce resource consumption to a minimum, using only the most basic, compressed audio codecs, such as MP3 and Vorbis, to optimise performance on limited systems or networks.

This tuning approach would allow selection of compression audio quality with video or ‘audio-only’ downloads according to the user's cyber-physical needs and capabilities, optimising download and playback in resource-constrained environments to make AnyVideo Downloader for anyone!

Pacha-io commented 4 days ago

@z1nc0r3 what do you think about what I have proposed? Do you find it feasible and/or interesting?

z1nc0r3 commented 2 days ago

@Pacha-io, first sorry for the late reply, and thank you for this interestingly detailed comment.

There are a few difficulties with those things you mentioned. One is that implementing these ordering settings is not yet supported. FL currently supports simple input, checkbox, dropdown, etc. items.

Another thing is my original intention for developing this plugin. My target audience was simple users who wanted to quickly download a video seen on the internet, so I wanted this to be as simple as possible. Because there are so many video-downloading tools out there with many useful features.

The last thing is time. I have very little time to work on these open-source projects (which I really love tho) and I don't think I can spare time to implement a little complex thing like this.

Sorry if this comment disappointed you. But you can always contribute to the project. PRs are very welcome anytime. Thanks again!

Pacha-io commented 21 hours ago

I agree with you but what about winfows users like me? :(

I loved your work for FL and it would be great to have an option so we (Win users) could download videos with native compatibility.

PD: I'm not a programmer. :(