compression

How to create full compressed tar file using Python?

此生再无相见时 提交于 2019-11-26 18:23:45
How can I create a .tar.gz file with compression in Python? To build a .tar.gz (aka .tgz ) for an entire directory tree: import tarfile def make_tarfile(output_filename, source_dir): with tarfile.open(output_filename, "w:gz") as tar: tar.add(source_dir, arcname=os.path.basename(source_dir)) import tarfile tar = tarfile.open("sample.tar.gz", "w:gz") for name in ["file1", "file2", "file3"]: tar.add(name) tar.close() If you want to create a tar.bz2 compressed file, just replace file extension name with ".tar.bz2" and "w:gz" with "w:bz2". You call tarfile.open with mode='w:gz' , meaning "Open for

Free compression library for C# which supports 7zip (LZMA) [closed]

谁说胖子不能爱 提交于 2019-11-26 17:59:39
问题 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 7 years ago . I have a program (written in C#) that reads/writes its data directly (direct file access without server) to firebird database files. For a better exchange I want to (un)compress them on import/export for a better exchange over the internet without the need of an external program to (un)compress them. I know

Why does BCL GZipStream (with StreamReader) not reliably detect Data Errors with CRC32?

十年热恋 提交于 2019-11-26 17:46:32
问题 The the other day I ran into the question GZipStream doesn't detect corrupt data (even CRC32 passes)? (Of which this might very well be a "duplicate", I have mixed feelings on the subject. I was also the one who added the CRC32 to the title, but in retrospect that feels out of place with the remainder of the post). After exploring the problem a bit on my own, I think that the issue is far greater than the other question initially portrays. I expanded upon the other question and made the test

How can I determine the length (i.e. duration) of a .wav file in C#?

感情迁移 提交于 2019-11-26 17:36:25
问题 In the uncompressed situation I know I need to read the wav header, pull out the number of channels, bits, and sample rate and work it out from there: (channels) * (bits) * (samples/s) * (seconds) = (filesize) Is there a simpler way - a free library, or something in the .net framework perhaps? How would I do this if the .wav file is compressed (with the mpeg codec for example)? 回答1: You may consider using the mciSendString(...) function (error checking is omitted for clarity): using System;

IOS Video Compression Swift iOS 8 corrupt video file

天涯浪子 提交于 2019-11-26 17:35:36
问题 I am trying to compress video taken with the users camera from UIImagePickerController (Not an existing video but one on the fly) to upload to my server and take a small amount of time to do so, so a smaller size is ideal instead of 30-45 mb on newer quality cameras. Here is the code to do a compression in swift for iOS 8 and it compresses wonderfully, i go from 35 mb down to 2.1 mb easily. func convertVideo(inputUrl: NSURL, outputURL: NSURL) { //setup video writer var videoAsset = AVURLAsset

Decompress gzip and zlib string in javascript

社会主义新天地 提交于 2019-11-26 17:31:42
问题 I want to get compress layer data from tmx file . Who knows libraries for decompress gzip and zlib string in javascript ? I try zlib but it doesn't work for me . Ex , layer data in tmx file is : <data encoding="base64" compression="zlib"> eJztwTEBAAAAwqD1T20JT6AAAHgaCWAAAQ== </data> My javascript code is var base64Data = "eJztwTEBAAAAwqD1T20JT6AAAHgaCWAAAQ=="; var compressData = atob(base64Data); var inflate = new Zlib.Inflate(compressData); var output = inflate.decompress(); It runs with

Zip folder in C#

家住魔仙堡 提交于 2019-11-26 17:31:05
What is an example (simple code) of how to zip a folder in C#? Update: I do not see namespace ICSharpCode . I downloaded ICSharpCode.SharpZipLib.dll but I do not know where to copy that DLL file. What do I need to do to see this namespace? And do you have link for that MSDN example for compress folder, because I read all MSDN but I couldn't find anything. OK, but I need next information. Where should I copy ICSharpCode.SharpZipLib.dll to see that namespace in Visual Studio? This answer changes with .NET 4.5. Creating a zip file becomes incredibly easy . No third-party libraries will be

Fast Video Compression on Android

不问归期 提交于 2019-11-26 17:27:04
问题 I want to upload video files to server and compress before uploading. I'm using ffmpeg libx264. I have seen viber can upload 30 second video file of size 78MB within a minute [reduce it's down to 2.3MB]. I want to know how do they do it so fast? What I have tried so far - FFMPEG version : n2.4.2 Built with gcc 4.8 Build Configuraiton : --target-os=linux --cross-prefix=/home/sb/Source-Code/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime

How can I get gzip compression in IIS7 working?

∥☆過路亽.° 提交于 2019-11-26 17:02:57
I have installed Static and dynamic compression for IIS7, as well as setting the two web.config values at my application Virtual Folder level. As I understand it, I don't need to enable compression at the server, or site level anymore, and I can manage it on a per folder basis using my web.config file. I have two settings in my .config file that I have set to customize gzip for my app: <httpCompression dynamicCompressionDisableCpuUsage="90" dynamicCompressionEnableCpuUsage="0"> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /> <dynamicTypes> <remove mimeType="*/*"/> <add mimeType

Twitter image encoding challenge [closed]

半城伤御伤魂 提交于 2019-11-26 16:50:10
If a picture's worth 1000 words, how much of a picture can you fit in 140 characters? Note : That's it folks! Bounty deadline is here, and after some tough deliberation, I have decided that Boojum's entry just barely edged out Sam Hocevar's . I will post more detailed notes once I've had a chance to write them up. Of course, everyone should feel free to continue to submit solutions and improve solutions for people to vote on. Thank you to everyone who submitted and entry; I enjoyed all of them. This has been a lot of fun for me to run, and I hope it's been fun for both the entrants and the