I want to stream youtube videos from command line using VLC media player. I was able to stream youtube videos using this command

cvlc https://www.youtube.com/watch?v=m2Oo4kBHBNU

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 https://www.youtube.com/watch?v=m2Oo4kBHBNU this command. How should I force commandline VLC to play video of specific quality?

| improve this question | | | | |

You can set the required input video settings in VLC for your YouTube clip in either of two ways:

  1. Locally using the command line
  2. Globally using the GUI

Details of both options below:

  1. Altering input video locally using the command-line:

    You can request a specific video size from youtube from the commandline by using the --preferred-resolution option. This has the bonus of not changing vlc global settings, so settings specified in this manner are not saved. Settings for this are (seen in cvlc -h):

    1. -1 (The default, this selects best available video quality)
    2. 1080 (This selects Full HD: 1080p)
    3. 720 (This selects HD: 720p)
    4. 576 (This selects Standard Definition: 576 or 480 lines)
    5. 360 (This selects Low Definition: 360 lines)
    6. 240 (This selects Very Low Definition: 240 lines)

    So for your clip the following works nicely:

    cvlc --preferred-resolution 240 https://www.youtube.com/watch?v=m2Oo4kBHBNU 
  2. Altering 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)

You have to love vlc :)

| improve this answer | | | | |
  • Thanks it worked but if we can change the resolution using command line itself would have been better – Eka Jul 9 '16 at 6:14
  • 1
    OIC: cvlc --preferred-resolution 240 https://www.youtube.com/watch?v=m2Oo4kBHBNU is what you are after, I will add this in.... – andrew.46 Jul 9 '16 at 6:20
  • Please add this code to the answer itself ; once more thank you very much :) – Eka Jul 9 '16 at 6:21
  • 1
    OK it is added an some extra information as a bonus :). And have a great day! – andrew.46 Jul 9 '16 at 6:32
  • And you can list available resolutions with -F or --list-formats: youtube-dl --list-formats https://www.youtube.com/watch?v=m2Oo4kBHBNU. – Pablo Bianchi Mar 10 '19 at 18:31

Your Answer

