Hacker News new | ask | show | jobs
by Jackypot 2014 days ago
Perhaps someone here can answer a question I've had for a while: if you stream a video which is actually a static image (think a song on YouTube, the 'video' is just the album cover) is there any way to optimise that? Or must the server stream that same image constantly as though it was a regular video?
3 comments

That's optimized based on the video codec itself where you keep frames with major changes but surrounding frames can be optimized by encoding where certain pixels move. That's essentially what the bitrate tells us, how much of the bits are new and how many are copied from a previous frame. This is an oversimplification, but with static images, you would need a low bitrate after the initial few frames because it doesn't change. And bitrate is a proxy to how much data is transmitted while streaming, it's bits per second.

So a more concise answer, the codecs used for video by YouTube have the optimization you're thinking about built in. It would send a "pixel didn't change from last frame" and not need to send all the color information for all the pixels.

YouTube does not really do variable frame rate, and it's messy for editing, but it's another optimization that is possible and could be useful for the type of video you're describing.

The article describes DASH which you would need to send the full frame initially every time segment but per segment the previously described concept still applies. I don't believe YouTube uses DASH for anything outside live streams.

I do not know the answer, but I would absolutely shocked if it was streamed as a regular video. To the best of my knowledge, there are many, many optimizations which go into video.

This is a pretty good high-level video I came across - https://www.youtube.com/watch?v=r6Rp-uo6HmI

I mean, technically, it would be "streamed as a regular video", it's just that "regular video encoding" is pretty efficient at encoding a single unchanging image nowadays.
The previous answers were speculative, but I have tried to download a random audio/video that was uploaded through YouTube's media programme (directly by media companies), and the answer is that they do re-send the video frame every 5 seconds for both H.264 and VP9, and it is encoded both at a rate of 25 frames per second and the width and height are the same. Here are the file details for both formats:

H.264/AAC4:

  Video
  ID                                       : 1
  Format                                   : AVC
  Format/Info                              : Advanced Video Codec
  Format profile                           : High@L3.2
  Format settings                          : CABAC / 2 Ref Frames
  Format settings, CABAC                   : Yes
  Format settings, Reference frames        : 2 frames
  Codec ID                                 : avc1
  Codec ID/Info                            : Advanced Video Coding
  Duration                                 : 3 min 29 s
  Bit rate                                 : 375 kb/s
  Width                                    : 1 080 pixels
  Height                                   : 1 080 pixels
  Display aspect ratio                     : 1.000
  Frame rate mode                          : Constant
  Frame rate                               : 25.000 FPS
  Color space                              : YUV
  Chroma subsampling                       : 4:2:0
  Bit depth                                : 8 bits
  Scan type                                : Progressive
  Bits/(Pixel*Frame)                       : 0.013
  Stream size                              : 9.35 MiB (74%)
  Writing library                          : x264 core 155 r2901 7d0ff22
  Codec configuration box                  : avcC

  Audio
  ID                                       : 2
  Format                                   : AAC LC
  Format/Info                              : Advanced Audio Codec Low Complexity
  Codec ID                                 : mp4a-40-2
  Duration                                 : 3 min 29 s
  Bit rate mode                            : Constant
  Bit rate                                 : 128 kb/s
  Channel(s)                               : 2 channels
  Channel layout                           : L R
  Sampling rate                            : 44.1 kHz
  Frame rate                               : 43.066 FPS (1024 SPF)
  Compression mode                         : Lossy
  Stream size                              : 3.19 MiB (25%)
  Default                                  : Yes
  Alternate group                          : 1

VP9/Opus:

  Video
  ID                                       : 1
  Format                                   : VP9
  Codec ID                                 : V_VP9
  Duration                                 : 3 min 29 s
  Width                                    : 1 080 pixels
  Height                                   : 1 080 pixels
  Display aspect ratio                     : 1.000
  Frame rate mode                          : Constant
  Frame rate                               : 25.000 FPS
  Language                                 : English
  Default                                  : Yes
  Forced                                   : No
  Color range                              : Limited

  Audio
  ID                                       : 2
  Format                                   : Opus
  Codec ID                                 : A_OPUS
  Duration                                 : 3 min 29 s
  Channel(s)                               : 2 channels
  Channel layout                           : L R
  Sampling rate                            : 48.0 kHz
  Bit depth                                : 32 bits
  Compression mode                         : Lossy
  Language                                 : English
  Default                                  : Yes
  Forced                                   : No