S
S
SOTVM2021-05-27 10:43:19
VLC
SOTVM, 2021-05-27 10:43:19

How to open vlc player from bash?

Given:
" a couple of direct links to 1080p audio and video stream from youtube"
obtained via youtube-dl -g
how do I pass them to vlc ?
I used to use the youtube.lua script for vlc ,
but it doesn’t work with the old one, although it was updated 2 months ago,
apparently YouTubers resaw their API again :(
yes, it only picks up 720p with it,
it’s better through youtube-dl (+ it has already been updated) , you can also 1080p,
but I don’t know how to do it from the terminal, how to start vlc ???
if so, it only opens the video :(

vlc $(youtube-dl -g https://www.youtube.com/watch?v=fTMXYj_a0Wo)


How to open from the player, i.e. via the GUI, I know, but it's not convenient.
You can watch it in the browser, but the computer is old on a 775 socket
, so 1080p, especially at a speed of x1.5, loads a percentage of 100%

PS
I tried youtube-dl + MPV player.
Works by default, without dancing with a tambourine. )))
Only youtube-dl needs to be installed from github ,
because the one that is in bubunty and debian turnips does not work (it has not been updated yet).
+ Slightly corrected the default MPV config for myself, it
remains to get used to hotkeys. (I just always used VLC)

But I'm still interested in the answer to the question.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SOTVM, 2021-05-30
@sotvm

It turned out that everything is solved very simply))
vlc 'VIDEO_DIRECT_LINK' --input-slave 'AUDIO_DIRECT_LINK'
This parameter is mentioned only in the extended help vlc -H,
but in the usual vlc --helpone there is not a word about it.

X
xotkot, 2021-05-30
@xotkot

Given:
"a couple of direct links to a 1080p audio and video stream from youtube"
obtained via youtube-dl -g

where did you get the idea that there will be 1080p ?)
you can look at the possible returns of the formats like this:
$ youtube-dl --list-formats "https://www.youtube.com/watch?v=fTMXYj_a0Wo"

spoiler

[youtube] fTMXYj_a0Wo: Downloading webpage
[info] Available formats for fTMXYj_a0Wo:
format code extension resolution note
249 webm audio only tiny 51k , webm_dash container, opus @ 51k (48000Hz), 2.13MiB
250 webm audio only tiny 71k , webm_dash container, opus @ 71k (48000Hz), 3.00MiB
251 webm audio only tiny 128k , webm_dash container, opus @128k (48000Hz), 5.39MiB
140 m4a audio only tiny 129k , m4a_dash container, [email protected] (44100Hz), 5.41MiB
394 mp4 256x144 144p 62k , mp4_dash container, [email protected] 62k, 30fps, video only, 2.60MiB
160 mp4 256x144 144p 73k , mp4_dash container, [email protected] 73k, 30fps, video only, 3.08MiB
278 webm 256x144 144p 82k , webm_dash container, [email protected] 82k, 30fps, video only, 3.46MiB
395 mp4 426x240 240p 116k , mp4_dash container, [email protected] 116k, 30fps, video only, 4.85MiB
133 mp4 426x240 240p 121k , mp4_dash container, [email protected] 121k, 30fps, video only, 5.08MiB
242 webm 426x240 240p 142k , webm_dash container, [email protected] 142k, 30fps, video only, 5.96MiB
396 mp4 640x360 360p 225k , mp4_dash container, [email protected] 225k, 30fps, video only, 9.40MiB
134 mp4 640x360 360p 238k , mp4_dash container, [email protected] 238k, 30fps, video only, 9.96MiB
243 webm 640x360 360p 250k , webm_dash container, [email protected] 250k, 30fps, video only, 10.46MiB
135 mp4 854x480 480p 369k , mp4_dash container, [email protected] 369k, 30fps, video only, 15.44MiB
244 webm 854x480 480p 379k , webm_dash container, [email protected] 379k, 30fps, video only, 15.87MiB
397 mp4 854x480 480p 386k , mp4_dash container, [email protected] 386k, 30fps, video only, 16.13MiB
136 mp4 1280x720 720p 606k , mp4_dash container, [email protected] 606k, 30fps, video only, 25.36MiB
247 webm 1280x720 720p 667k , webm_dash container, [email protected] 667k, 30fps, video only, 27.90MiB
398 mp4 1280x720 720p 798k , mp4_dash container, [email protected] 798k, 30fps, video only, 33.36MiB
18 mp4 640x360 360p 639k , avc1.42001E, 30fps, mp4a.40.2 (44100Hz), 26.72MiB
22 mp4 1280x720 720p 740k , avc1.64001F, 30fps, mp4a.40.2 (44100Hz) (best)

where you can see that for this video there is no 1080p at all)
note youtube-dl always takes best by default , that is, in this case it will be just 720p
$ youtube-dl --list-formats "https://www.youtube.com/watch?v=fTMXYj_a0Wo" | grep best
22           mp4        1280x720   720p  740k , avc1.64001F, 30fps, mp4a.40.2 (44100Hz) (best)

if you wish, you can select the desired format manually, for example, for this mp4 480p video:
youtube-dl --format="397+bestaudio" -g "https://www.youtube.com/watch?v=fTMXYj_a0Wo"

where 397 is the number of the stream from --list-formats , we
also specify +bestaudio since stream 397 goes only as video only , so we say that we also need to attach an audio track with the best quality to this video,
but so that each time we don’t suffer and don’t look for a suitable format or not to leave to chance (what Google considers best) you can simply write the necessary conditions in the format, for example:
youtube-dl --format="bestvideo[height<=?1080]+bestaudio" -g "https://www.youtube.com/watch?v=fTMXYj_a0Wo"

will take (from --list-formats) the video as close as possible to the extension (height) 1080 (equal or less)
you can even specify codecs and fps and also specify additional conditions through a slash (/), for example:
youtube-dl --format="bestvideo[height<=?1080][vcodec^=h264]+bestaudio/best[height<=?1080]/best" -g "https://www.youtube.com/watch?v=fTMXYj_a0Wo"

the first condition
is bestvideo[height<=?1080][vcodec^=h264]+bestaudio
height is less than or equal to 1080 and codec h264
then the second condition if the first
best[height<=?1080] did not work,
that is, if not with the h264 codec, then load with any but current if there is a resolution of 1080 or less
, also just best includes both bestvideo and bestaudio
ps .
Tried youtube-dl + MPV player.
Works by default, without dancing with a tambourine. )))

so that you don’t enter the format in mpv every time, you can specify the necessary values ​​​​in the mpv.conf config variable
ytdl-format="...."
for ytdl-format the same format as described above for the --format key
ps2
if you use firefox then install this extension
will allow you to run the player (mpv?) by simply selecting it from the context menu (right-click on the YouTube link), damn convenient

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question