compression

How to zip files and folders in Java?

自古美人都是妖i 提交于 2019-12-05 02:44:49
问题 Please have a look at the below code. public void startCompress(String path,String fileName,String outputLocation,int compressType,int filSize) throws Exception { System.out.println("Input Location: "+path); System.out.println("Output Location: "+outputLocation); System.out.println(compressType); byte[] bs=new byte[filSize]; System.out.println(filSize); FileOutputStream fos=new FileOutputStream(outputLocation+"/test.zip"); System.out.println(fos.toString()); ZipOutputStream zos=new

How to encode grayscale video streams with FFmpeg?

╄→尐↘猪︶ㄣ 提交于 2019-12-05 02:12:57
问题 I've got a grayscale video stream coming off a Firewire astronomy camera, I'd like to use FFmpeg to compress the video stream but it will not accept single byte pixel formats for the MPEG1VIDEO codecs. How can I use the FFmpeg API to convert grayscale video frames into a frame format accepted by FFmpeg? 回答1: Edit MPEG-1 only accepts YUV. So convert your frame to yuv. Use the SwsContext structure, create it by calling sws_getContext, and then use sws_scale. Try the rawvideo codec. You will

How does WinRAR perform a compression ratio check?

爱⌒轻易说出口 提交于 2019-12-05 01:53:22
问题 E.g. how can it tell that a 4GB text file can be compressed to, say, 200MB? Obviously, it doesn't read all of the contents in 2 or so seconds... so what kind of predictive algorithm(s) does it use? 回答1: They use variant of Prediction by partial matching (PPM) called PPMd. Look at wiki 回答2: It takes usually -log(x) + log(2) bits to compress x bits. However this is a highly theoretical value and it depends heavenly on the data you want to compress. For your data you have to record each

Fastest real time decompression algorithm

心已入冬 提交于 2019-12-05 01:17:25
I'm looking for an algorithm to decompress chunks of data (1k-30k) in real time with minimal overhead. Compression should preferably be fast but isn't as important as decompression speed. From what I could gather LZO1X would be the fastest one. Have I missed anything? Ideally the algorithm is not under GPL. lz4 is what you're looking for here. LZ4 is lossless compression algorithm, providing compression speed at 400 MB/s per core, scalable with multi-cores CPU. It features an extremely fast decoder, with speed in multiple GB/s per core, typically reaching RAM speed limits on multi-core systems

Compressing a binary matrix

烈酒焚心 提交于 2019-12-04 23:54:45
问题 We were asked to find a way to compress a square binary matrix as much as possible, and if possible, to add redundancy bits to check and maybe correct errors. The redundancy thing is easy to implement in my opinion. The complicated part is compressing the matrix. I thought about using run-length after reshaping the matrix to a vector because there will be more zeros than ones, but I only achieved a 40bits compression (we are working on small sizes) although I thought it'd be better. Also,

Compress file on S3

我怕爱的太早我们不能终老 提交于 2019-12-04 23:51:37
I have a 17.7GB file on S3. It was generated as the output of a Hive query, and it isn't compressed. I know that by compressing it, it'll be about 2.2GB (gzip). How can I download this file locally as quickly as possible when transfer is the bottleneck (250kB/s). I've not found any straightforward way to compress the file on S3, or enable compression on transfer in s3cmd, boto, or related tools. Michel Feldheim S3 does not support stream compression nor is it possible to compress the uploaded file remotely. If this is a one-time process I suggest downloading it to a EC2 machine in the same

Get image from a video frame in iPhone

怎甘沉沦 提交于 2019-12-04 23:48:31
问题 Is it possible using the iPhone SDK to grab a frame from a video in iPhone and save it or use it in any way in the application? Does the SDK give any control over the video other than play/stop or maybe access to the binary data of the video? Also is it possible to know the time at which the user stopped watching the video (i know in SDK 3.0 it is possible to start the video from a specific time). Thanks EDIT: If not through the official APIs, is there another way to do any of the above in a

Video Compression ios : Reduce the size of a video usin AVAssetWriter

老子叫甜甜 提交于 2019-12-04 23:44:58
问题 I am Successful in encoding a series of image captured by AVCaptureVideoPreviewLayer of AVFoundation Framework into a Video using AVAssetWriter and AVAssetWriterInput. But the size of the video is too large, Can anyone of you suggest me a tutorial or atleast a direct me in this case or give me the correct Video output Settings for video compression. I am using the following VideoOutputSetting. videoOutputSettings = @{ AVVideoCodecKey: AVVideoCodecH264, AVVideoWidthKey: [NSNumber numberWithInt

decompress a ZIP file on windows 8 C#

别说谁变了你拦得住时间么 提交于 2019-12-04 23:28:49
I am building a metro style app for windows 8 and I have a zip file that I am downloading from a web service, and I want to extract it. I have seen the sample for compression and decompression, but that takes a single file an compresses/decompresses it. I have a whole directory structure that I need to extract. Here is what I have so far: var appData = ApplicationData.Current; var file = await appData.LocalFolder.GetItemAsync("thezip.zip") as StorageFile; var decompressedFile = await ApplicationData.Current.LocalFolder.CreateFileAsync("tempFileName", CreationCollisionOption.GenerateUniqueName)

How to extract zip file using dotnet framework 4.0 without using third party dlls [closed]

好久不见. 提交于 2019-12-04 23:15:41
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm in a fix. I need to download a zip file from network location and then decompress it on local machine and use the files. The only constraint is that I cannot use any third party dll. In .NET framework 4.5 now there is System.IO.Compression.ZipFile.ExtractToDirectory(String, String) method. I'm not sure if it's still available in VS2010, but in earlier versions J# was included in VS and J# includes the java