YouTube Music Data Consumption – Vnstat

This article was originally posted here! 

YouTube Music doesn’t provide any option to control video quality. There exists a feature which helps you change the streaming quality of audio, but I think it’s useless. Moreover, the video quality is gets automatically adjusted depending upon your connection speed.

With the help of vnstat, I monitored the data usage of YouTube Music’s initial load in Chrome’s Guest Session.

$ vnstat -l -i enp0s20u1u4

enp0s20u1u4 is my default interface.

                           rx         |       tx
--------------------------------------+------------------
  bytes                     4.32 MiB  |         382 KiB
--------------------------------------+------------------
          max            1.76 Mbit/s  |      178 kbit/s
      average          589.62 kbit/s  |    50.91 kbit/s
          min               0 kbit/s  |        0 kbit/s
--------------------------------------+------------------
  packets                       3623  |            2438
--------------------------------------+------------------
          max                161 p/s  |         161 p/s
      average                 60 p/s  |          40 p/s
          min                  0 p/s  |           0 p/s
--------------------------------------+------------------
  time                    60 seconds
  • rx ~ downloaded or received and tx ~ uploaded or transmitted

4.32 MiB of data was utilized during the fresh load of YouTube Music, which gets reduced to 151 KiB on another reload. Cache!

Important:

  • A mebibyte (MiB) equals 220 bytes.
  • To get the value in MB, all we have to do is (MiB x 1.049)
  • 4.32 MiB = ~4.52 MB
  • For the sake of simplicity, I’ll stick to MiB
                           rx         |       tx
--------------------------------------+------------------
  bytes                      151 KiB  |          77 KiB
--------------------------------------+------------------
          max             190 kbit/s  |       94 kbit/s
      average           46.57 kbit/s  |    23.74 kbit/s
          min               0 kbit/s  |        0 kbit/s
--------------------------------------+------------------

So far, everything seems pretty useless, but I just want to check two things –

  • Whether reducing audio quality helps in less consumption of data. I had already said that the feature is useless, but I’m not quite sure about it.
  • Playing with Bandwidth Throttling to reduce video quality so that I can check the difference of data usage while streaming the same song over different network speed.

The Difference in Data Consumption – Audio Quality Change

Song – Geom – Back To You. Throughout the whole post, I’ll use the same song.

I usually listen to it while working. Try not to watch it when you’re doing something, it’s kind of distracting.

Running vnstat for checking the live transfer rate gives –

                           rx         |       tx
--------------------------------------+------------------
  bytes                    15.94 MiB  |         450 KiB
--------------------------------------+------------------
          max            4.53 Mbit/s  |      103 kbit/s
      average          483.72 kbit/s  |    13.34 kbit/s
          min               0 kbit/s  |        0 kbit/s
--------------------------------------+------------------
  packets                      12794  |            2801
--------------------------------------+------------------
          max                423 p/s  |          69 p/s
      average                 47 p/s  |          10 p/s
          min                  0 p/s  |           0 p/s
--------------------------------------+------------------
  time                  4.50 minutes

Song’s actual length is 4.24 min, but here it shows 4.50 min and that’s because I forgot to play the song. It didn’t make any difference in data consumption.

So far, I’ve been doing everything using Chrome’s Guess Session but looks like YouTube Music doesn’t let you change audio quality if you aren’t logged in. Alright, I’ll just log in.

After changing the audio quality, here’s what I got –

                           rx         |       tx
--------------------------------------+------------------
  bytes                    13.55 MiB  |         350 KiB
--------------------------------------+------------------
          max            4.46 Mbit/s  |      109 kbit/s
      average          408.09 kbit/s  |    10.28 kbit/s
          min               0 kbit/s  |        0 kbit/s
--------------------------------------+------------------

Before it was 15.94 MiB and now it’s 13.55 MiB. So, I saved 2.4 MiB of data. I think it won’t make a big of a difference.

Conclusion: Changing audio quality isn’t an efficient solution to reduce data usage while streaming music.

Experimenting with Bandwidth Throttling

Chrome’s latest version provides three options to manipulate connection speed. Won’t dig too much. Just a quick check over different network options.

  • Online
    • This took 15.94 MiB of data to play a 4.24 min long song.
    • My internet connection speed was 19 Mbps.
  • Fast 3G
    • I didn’t see any change. Quite disappointing, but I had already guessed the results.
    • Consumed 15.80 MiB of data.
  • Slow 3G
    • Lagged, a couple of times.
    • Video quality was reduced.
    • Consumed bytes: 7.65 MiB (rx) | 282 KiB (tx). A reasonable amount of data consumption if you just want to listen to songs while doing your work.
    • Saved 8.15 MiB
    • Almost half of the data used in comparison to Normal 4G and Fast 3G network.
  • Custom
    • I want to test how does YouTube Music performs over 2G networks, and in order to do that, I need to set values for upload, download, and latency using Chrome’s throttling feature.
    • I’m using 2G, 3G, 4G, and 5G Download Comparison chart as the source to set the download/upload speed of the 2G network.
    Generation: 2G
    Technology: EDGE
    Maximum Download Speed: 0.3Mbit/s or 300 Kbps
    Maximum Upload Speed: 0.1Mbit/s or 100 Kbps
    

    NOTE – Latency is inversely proportional to the network efficiency.

For 2G Network, we can set the latency to 130 ms (the range is 100-500 ms).

                           rx         |       tx
--------------------------------------+------------------
         bytes              6.76 MiB  |         349 KiB
--------------------------------------+------------------
          max            2.36 Mbit/s  |      408 kbit/s
      average          200.55 kbit/s  |    10.13 kbit/s
          min               0 kbit/s  |        0 kbit/s
--------------------------------------+------------------
          time                        |    4.30 minutes

Interesting! Switching from Fast 3G to 2G EDGE didn’t put much of the impact as the. The data consumption got reduced by ~13.16%. I was expecting much more.

For the final test, I’ll reduce 50% of download/upload speed and increase 50% of latency to see what’s the result.

  • Download Speed: 150 Kbps
  • Upload Speed: 50 Kbps
  • Latency: 195 ms

This is what I got –

                           rx         |       tx
--------------------------------------+------------------
  bytes                     5.82 MiB  |         302 KiB
--------------------------------------+------------------
          max             716 kbit/s  |       59 kbit/s
      average          147.08 kbit/s  |     7.45 kbit/s
          min               0 kbit/s  |        0 kbit/s
--------------------------------------+------------------

Awesome! The data usage went down from 15.94 MiB which got utilized over the 4G network to 5.82 MiB (actually slower than 2G EDGE).

I didn’t compromise with the audio quality. There was no reason to.

Yes, there were multiple lags while streaming the video, but it was expected. I set up the upload/download way too low. I think with a little more tweaking with the throttling, I can manage to get a decent speed so that not only I can control the useless data usage, but stream music without any lags.


Links

Leave a comment