I want to stream youtube videos from command line using VLC media player. I was able to stream youtube videos using this command
cvlc The problem is that when ever VLC streams videos it uses highest quality video format available (480 and higher). I dont have a uniform interned download speed, some times I can play youtube video of 360 (my highest quality) and other times I can play a youtube video of 240 only.
Because VLC currently streams with highest quality (480 and above according to video) I cant stream using cvlc this command. How should I force commandline VLC to play video of specific quality?
1 Answer
You can set the required input video settings in VLC for your YouTube clip in either of two ways:
- Locally using the command line
- Globally using the GUI
Details of both options below:
Altering input video locally using the command-line:
You can request a specific video size from youtube from the commandline by using the
--preferred-resolutionoption. This has the bonus of not changing vlc global settings, so settings specified in this manner are not saved. Settings for this are (seen incvlc -h):- -1 (The default, this selects best available video quality)
- 1080 (This selects Full HD: 1080p)
- 720 (This selects HD: 720p)
- 576 (This selects Standard Definition: 576 or 480 lines)
- 360 (This selects Low Definition: 360 lines)
- 240 (This selects Very Low Definition: 240 lines)
So for your clip the following works nicely:
cvlc --preferred-resolution 240Altering input video globally using the GUI:
You can also alter the input video settings globally from the GUI preferences as shown in the screenshot below:
These settings are saved for subsequent vlc usage and will be saved in your vlc configuration file:
~/.config/vlc/vlcrc. As an example: this is added for a preferred resolution of 240:# Preferred video resolution (integer) preferred-resolution=240
You have to love vlc :)
5