Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.2.1] yt-dlp configuration is ignored ? #68

Open
jeandestouches opened this issue May 15, 2022 · 4 comments
Open

[0.2.1] yt-dlp configuration is ignored ? #68

jeandestouches opened this issue May 15, 2022 · 4 comments

Comments

@jeandestouches
Copy link

Hi,
Thanks for adding downloading with yt-dlp to pipe-viewer. It works fine but my yt-dlp config is ignored, I tried to add it in pipe-viewer.conf like that :

  ytdl_cmd                      => "/usr/bin/yt-dlp --config-locations ~/.config/yt-dlp/config",

but it is still ignored. Or maybe am I doing it wrong ?
Thanks

@trizen
Copy link
Owner

trizen commented May 21, 2022

The resolutions and formats are selected by pipe-viewer.

See the source code: https://github.com/trizen/pipe-viewer/blob/main/bin/pipe-viewer#L3465...L3474

The video part and the audio part is downloaded with the -f [itag] option. If you specified in the config-file a certain format and/or resolution, it will be ignored. Instead, specify the resolution and formation in pipe-viewer, with:

--res=[RESOLUTION]

and video/audio format with:

--prefer-mp4     # prefer videos in MP4 format
--prefer-m4a     # prefer audio in M4A format

Example for downloading MP4 videos at 480p resolution:

pipe-viewer -d --prefer-m4a --prefer-mp4 --res=480p [YouTube URL]

See also: trizen/youtube-viewer#181 (comment)

@mrpingo
Copy link

mrpingo commented Feb 29, 2024

I would love to pass some options to yt-dlp like "-N, --concurrent-fragments N" but those are not recognized or I am doing something bad. I tried:
ytdl_cmd => "/usr/bin/yt-dlp -N 10",
ytdl_cmd => "/usr/bin/yt-dlp --concurrent-fragments 10",
and also the configuration path:
ytdl_cmd => "/usr/bin/yt-dlp --config-locations ~/.config/pipe-viewer/yt-dlp/config",
with -N 10 inside with no avail.

How do I propperly pass some options to yt-dlp so they are not ignored?

Many thanks

@trizen
Copy link
Owner

trizen commented Mar 1, 2024

@mrpingo The options passed to yt-dlp are not ignored. However, the --concurrent-fragments option applies only to dash/hlsnative formats, which are not preferred by pipe-viewer when there are other formats available.

A workaround for this would be to add yt-dlp as a video player inside the config file:

video_players => {

    #...

    yt_dlp => {
               arg     => "",
               cmd     => "yt-dlp -N 10 *URL*",
               fs      => "",
               novideo => "",
               srt     => "",
              },

    #...
  },

...and execute pipe-viewer as:

$ pipe-viewer --player=yt_dlp

@mrpingo
Copy link

mrpingo commented Mar 1, 2024

Many thanks for your comment!

At first I thought on doing exactly that and pipe the output to mpv, but I didn't know how to put the URL variable in "args" and ended looping my thoughts and never tried, but you just gave me the insight although it looks to me very "hacky".

Anyway I finally did it by changing this lines using the mpv player lines and piping the output into mpv:

mpv => {

arg => "--concurrent-fragments=20 *URL* -o - | mpv --profile=fast --really-quiet --force-media-title=*TITLE* --audio-file=*AUDIO* -",

cmd => "/usr/bin/yt-dlp",

},

It works pretty well, but I dont know if it can be done more "politely" and programatically clean.

Many many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants