compression

How to check whether file exists in zip file using dotnetzip

不羁的心 提交于 2019-12-01 06:06:05
I am creating zip using dotnetzip library. But I don't know how to check if a file exists in the zip. If the file exists then I will update the file with path. public void makezip(string flname) { string fln =flname; string curFile = @"d:\crs.zip"; if (File.Exists(curFile)) { ZipFile zipfl = ZipFile.Read(@"D:\crs.zip"); var result = zipfl.Any(entry => entry.FileName.EndsWith(@fln)); if (result == true) { zipfl.UpdateFile(@fln); }else{ zipfl.AddFile(@fln); } zipfl.Save(@"d:\crs.zip"); } else { try { ZipFile zipfl = new ZipFile(); var result = zipfl.Any(entry => entry.FileName.EndsWith(@fln));

How to Compress video file in android

≡放荡痞女 提交于 2019-12-01 05:58:08
I want to compress video file before uploading to server.I gone through this link How to compress a video to maximum level android , but i did not get an answer. Can anyone help me ?? Give this a try mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH)); mediaRecorder.setVideoEncodingBitRate(690000 ); We can compress video using ffmpeg in android. For integrating FFmpeg in android we can use precompiled libraries like ffmpeg-android . You can use below command to compress video String[] command = {"-y", "-i", inputFileAbsolutePath, "-s", "160x120", "-r", "25", "-vcodec"

GZipStream decompression performance is poor

心已入冬 提交于 2019-12-01 05:56:01
I have a .NET 2.0 WinForms app that connects to a backend WAS server. I am using GZipStream to decode data coming back from a HttpWebRequest call made to the server. The data returned is compressed CSV, which Apache is compressing. The entire server stack is Hibernate-->EJB-->Spring-->Apache. For small responses, the performance is fine (<50ms). When I get a response >150KB, it takes more than 60 seconds to decompress. The majority of the time seems to be spent in the GZipStream constructor. This is the code showing where I get the response stream from the HttpWebResponse call: using (Stream

raw data from CVImageBuffer without rendering?

孤街醉人 提交于 2019-12-01 05:51:29
I'm getting a CVImageBufferRef from my AVCaptureSession, and I'd like to take that image buffer and upload it over the network. To save space and time, I would like to do this without rendering the image into a CIImage and NSBitmapImage, which is the solution I've seen everywhere (like here: How can I obtain raw data from a CVImageBuffer object ). This is because my impression is that the CVImageBuffer might be compressed, which is awesome for me, and if I render it, I have to uncompress it into a full bitmap and then upload the whole bitmap. I would like to take the compressed data (realizing

Disable GZIP compression for IE6 clients

允我心安 提交于 2019-12-01 05:12:51
We need to conditionally disable GZIP compression if user's browser is IE6 (it hangs browser for 5min) in few pages of larger site. Server is IIS7 and has compression for static content turned on - want that compression left working if user agent is not Mozilla/4.0. ASPX code sample anyone? Alternatively, code to conditionally redirect to the same page on another site (could create another virtual site with compression disabled) but need to pass all parameters (GET/POST). Check out this page . I believe ISAPI rewrite is available for IIS as well. Basically, it takes the browser's request and

Libarchive to extract to a specified folder?

天大地大妈咪最大 提交于 2019-12-01 05:07:10
问题 Anybody can help show examples of using libarchive to extract ZIP files to a specified folder? It looks like the sample programs provided ( untar.c , tarfilter.c and minitar ) all extracts the archive to the current working directory. Is there a way to say "extract to this folder and below" to libarchive and not clobber the program's active folder? One of the main drivers is that the extraction code will be run in a background thread, and thus changing the program working directory may create

Method to determine if an exe file has been compressed with UPX

ε祈祈猫儿з 提交于 2019-12-01 05:04:17
Is there a method to determine if an exe file has been compressed with UPX? The function to determine if an exe file has been compressed is excellent except I found a problem with the code. If the function IsUPXCompressed is called then you try to run upx, upx can not save the file it modifies. There is something not sharing rights correctly in the function. I have tested this for several hours. If I do not call the method then UPX can write the files with no problem. You you call it then try to run UPX it will not save the file. UPX reports an IOException Permission denied error when trying

GZIP decompression C# OutOfMemory

巧了我就是萌 提交于 2019-12-01 04:48:39
I have many large gzip files (approximately 10MB - 200MB) that I downloaded from ftp to be decompressed. So I tried to google and find some solution for gzip decompression. static byte[] Decompress(byte[] gzip) { using (GZipStream stream = new GZipStream(new MemoryStream(gzip), CompressionMode.Decompress)) { const int size = 4096; byte[] buffer = new byte[size]; using (MemoryStream memory = new MemoryStream()) { int count = 0; do { count = stream.Read(buffer, 0, size); if (count > 0) { memory.Write(buffer, 0, count); } } while (count > 0); return memory.ToArray(); } } } it works well for any

raw data from CVImageBuffer without rendering?

旧城冷巷雨未停 提交于 2019-12-01 04:40:21
问题 I'm getting a CVImageBufferRef from my AVCaptureSession, and I'd like to take that image buffer and upload it over the network. To save space and time, I would like to do this without rendering the image into a CIImage and NSBitmapImage, which is the solution I've seen everywhere (like here: How can I obtain raw data from a CVImageBuffer object). This is because my impression is that the CVImageBuffer might be compressed, which is awesome for me, and if I render it, I have to uncompress it

Wav audio file compression not working

偶尔善良 提交于 2019-12-01 04:16:39
问题 Is it possible to compress a wav audio file without reducing the sampling rate? I have an audio file with 256 bit rate and sampling rate - 8000Hz. I would just like to reduce the bit rate to 128/64 kbs I tried converting to mp3 and back to wav, ffmpeg -i input.wav 1.mp3 ffmpeg -i "1.mp3" -acodec pcm_s16le -ar 4000 out.wav but this reduced sampling rate as well. ffmpeg -i "1.mp3" -acodec pcm_s16le -ab 128 out.wav has default 256 bit rate 回答1: PCM ("WAV") is uncompressed, so -b:a / -ab is