I want to increase the zip compression rate of video files in Unity.

Asked 1 years ago, Updated 1 years ago, 73 views

We have created a zip compression process using GZipStream.

The following code is used to compress the video file (mp4) stored in the terminal, but the compression rate is 98 to 99 percent, and the purpose of reducing the capacity is not achieved.

I would appreciate it if you could tell me about the library that can be highly compressed with Unity and the code modifications.
Thank you for your cooperation.

environment:
Unity 2018.4.22.f1

created code:

public static byte[] Compress (byte[] src)
{
    using(varms=new MemoryStream())
    {
        using(vards=new GZipStream(ms, CompressionMode.Compress, true/*ms is */))
        {
            ds.Write(src,0,src.Length);
        }
        ms.Position = 0;
        byte [ ] comp = new byte [ms.Length];
        ms.Read(comp,0,comp.Length);
        return comp;
    }
}

c# unity3d

2022-09-30 20:16

1 Answers

The MP4 itself is already a compressed video format, so I don't think it will be effective to apply more ZIP compression from here.

If you want to reduce the size of your video, you may need to re-encode it by trimming unnecessary parts or changing the resolution and bit rate.


2022-09-30 20:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.