YouTube Music Data Consumption - Vnstat

YouTube Music doesnā€™t provide any option to control video quality. There exists a feature which help 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

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 \(2^{20}\) 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 seem pretty useless, but I just want to check two things -

    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 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 made 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.

    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.

    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 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