Body: <p>I have a very high quality video and I need to produce a high quality and a low quality version for transport into other systems.</p>
  
  <p>For the high quality version I use</p>
  
  <ul>
  <li>a lossy compression (currently VP9 because I have HW acceleration for that)</li>
  </ul>
  
  <p>For the low quality version I use</p>
  
  <ul>
  <li>half the framerate (possibly I could use even lower)</li>
  <li>lower resolution</li>
  <li>cropping to 50% of the canvas</li>
  <li>possibly an even lossier compression</li>
  </ul>
  
  <p>Both video files need to be transferred over the same limited bandwidth link. The lower quality is somewhat time critical, so it needs to be as small as possible. The high quality video is not time critical, it can be transferred whenever free bandwidth is available. But the link being limited overall, I do not want to waste anything. Obviously some information is duplicated if I transfer the low quality video first and then the full high quality video. I wonder whether there are existing <a href="https://en.wikipedia.org/wiki/Delta_encoding" rel="nofollow noreferrer">delta encodings</a> that allow me to transfer only the low quality file and a delta file and reconstruct a high quality video at the destination.</p>
  
  <p>Although information is duplicated, with standard video compressions I don't think there is much data duplicated if I just produce 2 videos using different parameters. So the delta would not be helpful. Instead the video encoding needs to be tuned in a clever way resulting in duplicated data that does not need to be sent twice. </p>
  
  <p>A very naive algorithm to produce a useful delta would work like this: I start to produce the high quality version, thereby guaranteeing that every odd frame (if counting starts at 1) is an I-frame. To produce the low quality version I remove every even frame from the high quality version. So I get a low quality video with half the frame rate. As the delta I collect all the even frames and transfer them separately. At the destination I can combine odd and even frames again to losslessly reconstruct the high quality video.</p>
  
  <p>Obviously that is not a very good algorithm. The delta will most likely be p-frames (or b if the codec used those). So I end up with a "big" low quality video and a "small" delta. The "other way round" would be preferred. Maybe the low quality video consisting of only I-frames could still be compressed using a lossless compression. This algorithm does not yet make use of cropping and downscaling. The cropping part I might be able to figure out myself without deeper studies in video encoding, the downscaling unlikely so.</p>
  
  <p>So the question is: Are there known delta encodings for video files that would be applicable here? Preferably with an open source implementation.</p>
  
  <p>As a further constraint I do not have a GPU available on the machine applying the delta. (But a GPU is available on the machine producing the delta.)</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-05T06:36:19.507Z
Comments.Text: With an existing pair of videos, this can't be done. An encoded bitstream has its own syntax (hence called encoded), and the coded elements across different versions of the video (resolution, framerate) can't be correlated like that. A naive delta encoding would take up significant size.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-05T07:52:08.723Z
Comments.Text: @Gyan I don't expect that would be possible for any arbitrary pair of video files. The files need to be encoded with the delta in mind, like in my naive algorithm does. Edited the question to further stress that.
Comments.UserDisplayName: Uwe Geuder
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-05T08:02:22.540Z
Comments.Text: The closest but not identical tech is [SVC](https://en.wikipedia.org/wiki/Scalable_Video_Coding) but encoders are proprietary and support is limited. It is available for audio though e.g. [WavPack](https://en.wikipedia.org/wiki/WavPack#Hybrid_mode).
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-05T09:54:19.897Z
Comments.Text: Thanks @Gyan, SVC seems extremely close to what I'm looking for. It's specified for streams, but creating separate files for the substreams should be possible without needing to understand the coding theory behind it. According to https://lists.freedesktop.org/archives/gstreamer-devel/2012-May/035998.html no open source encoder exists. It's been 8 years, but maybe the situation is still unchanged?
Comments.UserDisplayName: Uwe Geuder
Tags: <video><encoding>
Title: Delta encoding for video files?
UserDisplayName: Uwe Geuder
ThreadText: # Delta encoding for video files?
  
  (Asked by: username_0 on 2020-04-04)
  
  I have a very high quality video and I need to produce a high quality and a low quality version for transport into other systems.
  
  For the high quality version I use
  
  * a lossy compression (currently VP9 because I have HW acceleration for that)
  
  For the low quality version I use
  
  * half the framerate (possibly I could use even lower)
  * lower resolution
  * cropping to 50% of the canvas
  * possibly an even lossier compression
  
  Both video files need to be transferred over the same limited bandwidth link. The lower quality is somewhat time critical, so it needs to be as small as possible. The high quality video is not time critical, it can be transferred whenever free bandwidth is available. But the link being limited overall, I do not want to waste anything. Obviously some information is duplicated if I transfer the low quality video first and then the full high quality video. I wonder whether there are existing [delta encodings](https://en.wikipedia.org/wiki/Delta_encoding) that allow me to transfer only the low quality file and a delta file and reconstruct a high quality video at the destination.
  
  Although information is duplicated, with standard video compressions I don't think there is much data duplicated if I just produce 2 videos using different parameters. So the delta would not be helpful. Instead the video encoding needs to be tuned in a clever way resulting in duplicated data that does not need to be sent twice.
  
  A very naive algorithm to produce a useful delta would work like this: I start to produce the high quality version, thereby guaranteeing that every odd frame (if counting starts at 1) is an I-frame. To produce the low quality version I remove every even frame from the high quality version. So I get a low quality video with half the frame rate. As the delta I collect all the even frames and transfer them separately. At the destination I can combine odd and even frames again to losslessly reconstruct the high quality video.
  
  Obviously that is not a very good algorithm. The delta will most likely be p-frames (or b if the codec used those). So I end up with a "big" low quality video and a "small" delta. The "other way round" would be preferred. Maybe the low quality video consisting of only I-frames could still be compressed using a lossless compression. This algorithm does not yet make use of cropping and downscaling. The cropping part I might be able to figure out myself without deeper studies in video encoding, the downscaling unlikely so.
  
  So the question is: Are there known delta encodings for video files that would be applicable here? Preferably with an open source implementation.
  
  As a further constraint I do not have a GPU available on the machine applying the delta. (But a GPU is available on the machine producing the delta.)
  
  **Tags:** video, encoding
  
  > **Comments:**
  > **username_1**: With an existing pair of videos, this can't be done. An encoded bitstream has its own syntax (hence called encoded), and the coded elements across different versions of the video (resolution, framerate) can't be correlated like that. A naive delta encoding would take up significant size.  
  > **username_0**: @username_1 I don't expect that would be possible for any arbitrary pair of video files. The files need to be encoded with the delta in mind, like in my naive algorithm does. Edited the question to further stress that.  
  > **username_1**: The closest but not identical tech is [SVC](https://en.wikipedia.org/wiki/Scalable_Video_Coding) but encoders are proprietary and support is limited. It is available for audio though e.g. [WavPack](https://en.wikipedia.org/wiki/WavPack#Hybrid_mode).  
  > **username_0**: Thanks @username_1, SVC seems extremely close to what I'm looking for. It's specified for streams, but creating separate files for the substreams should be possible without needing to understand the coding theory behind it. According to https://lists.freedesktop.org/archives/gstreamer-devel/2012-May/035998.html no open source encoder exists. It's been 8 years, but maybe the situation is still unchanged?  
  
  ---
  
  ## 0 answers
  
  