5 ms·
zipping the raw avi would probably get most of the way to 95%
by blibble 6y ago
zipping the raw avi would probably get most of the way to 95%
- chii 6y agobut can you stream a zip file compressed this way to play the video on a streaming protocol?
- Dylan16807 6y agoYes. No commonly-used compression formats lack streaming capabilities.
- mayli 6y agoKodi even supports playback from multi part rars.
- bawolff 6y agoDon't zip files store the directory structure/index info at the end? I would assume that's pretty important for decompressing.
- Dylan16807 6y agoIf you assume there's only one file you could probably skip it. But the question was about using the zip file as a source for streaming, and that will work fine even if you have to spend an extra read to load the directory first.
- bawolff 6y agoI don't think you can safely assume random reads if you are streaming. Usually the point of a stream is you have to process the file in-order. Regardless, if for some weird reason you really liked the zip compression algorithm (DEFLATE), you would probably just use gzip instead (same compression algorithm, no weird file format with critical metadata at the end). Its also the compression algo used by PNGs.
- Dylan16807 6y ago> I don't think you ca safely assume random reads if you are streaming. I could interpret this a couple ways, so let me try to clarify. If you're talking about the ability to seek around inside the video, it is correct that this will not work well. If you're talking about seeking to the end of the zip file to read the directory, I don't think that was part of the scenario. My interpretation of the question is that the server has a zip file and has to output a video stream directly from the zip. If the zip itself is being delivered as a single stream, start to end... I have no idea what kind of scenario this is. There's no zip-streaming protocol out there. Filesystems can give you the end of a zip. HTTP can give you the end of a zip. > Regardless, if for some weird reason you really liked the zip compression algorithm (DEFLATE), you would probably just use gzip instead (same compression algorithm, no weird file format with critical metadata at the end). Its also the compression algo used by PNGs. Maybe. You might want windows users to be able to easily extract the video.
- chii 6y agothe question in the OP was to have the avi file be zipped, and it would offer similar levels of compression. But if you're streaming a zip file down the line, can you view the stream as it partially loads, which is possible with certain video formats (esp. if the player can handle missing key frames etc). I was under the impression that a zip file cannot be partially read and reconstruct partially the contents.
- Dylan16807 6y agoWe have to make two distinctions here. The first distinction is between streaming from the start of a file, without needing any storage space, versus streaming from a random point in the middle of the file. With a zip you can do the former, but you cannot do the latter. The second distinction is between streaming the zip itself, versus streaming from the zip without needing any storage space. If you stream the zip itself, and don't allow even a single extra read to get the directory, it will be trickier to extract the video on the fly but still probably possible. If you are streaming from the zip then you can read the end then jump to the start and begin streaming, and it will work fine. If that's a confusing mess, then I guess be more specific. What data does the video player see, and from what protocol?
- fouc 6y agogzip and zlib (and tar) are "streaming" formats
- dylan604 6y agoi seriously don't see zipping a RAW video file achieving any compression gains let alone 95%
- bawolff 6y agoIf you mean raw, in the sense of a stream of RGB (or YUV) images one after each other, i would expect zip to give significant compression, especially for something with solid colours like a desktop screen. H.265 is obviously going to be a lot better, but compared to doing nothing, even something stupid like RLE compression is going to be helpful.
- dylan604 6y agothat's not how Zip works though Edit: You can disagree, but video files do not compress with zip. Feel free to do the experiments on your own time. Zip looks for combinations of letters/sequences. That's not how a video file structured. To make video smaller, smart people created a dedicated type of compressors.
- bawolff 6y agoWhich part is not how zip works? > That's not how a video file structured You're under the impression that uncompresed raw video does not contain repeated bit patterns??? How do you think it is structured?
- dylan604 6y agoplease, show me an example with downloadable samples to recreate the experiment where zipping a video file decreases the file size.
- bawolff 6y agoUsing https://archive.org/download/ElephantsDream/ed_hd.mp4 https://archive.org/download/ElephantsDream/ed_hd.mp4 Convert to uncompressed YUV420P: $ ffmpeg -i ed_hd.mp4 elephant_dream_uncompressed.yuv Compress with zip with default compression (I also tried -9 but it didn't make much difference): $ zip compressed_elephants_dream.zip elephant_dream_uncompressed.yuv adding: elephant_dream_uncompressed.yuv (deflated 64%) $ ls -la elephant_dream_uncompressed.yuv compressed_elephants_dream.zip -rw-r--r-- 1 bawolff bawolff 1961679613 Mar 25 08:54 compressed_elephants_dream.zip -rw-r--r-- 1 bawolff bawolff 5422809600 Mar 25 08:46 elephant_dream_uncompressed.yuv 1-1961679613/5422809600 = .63826 ----- So, 63.8% compression ratio. This is terrible compared to any lossy video codec obviously, but its hardly nothing. i would expect even better ratio if the source contained mostly solid colours like a screencast