compression

Avoid Video Compression when Selecting Movie with UIImagePickerController?

不想你离开。 提交于 2019-11-26 22:57:36
问题 I'm using UIImagePickerController to allow my user to select a video from the asset library. When the user selects the "Choose" button on the second screen, the view displays a progress bar and a "Compressing Video..." message. Why is this happening? Is there some way I can avoid this compression operation? 回答1: Answer: There is currently no way to control how UIImagePickerController compresses the picked video. I just did some quick tests. Using a test app I created, I picked the same video

Can gzip compression be selectively disabled in ASP.NET/IIS 7?

纵然是瞬间 提交于 2019-11-26 22:41:02
问题 I am using a long-lived asynchronous HTTP connection to send progress updates to a client via AJAX. When compression is enabled, the updates are not received in discrete chunks (for obvious reasons). Disabling compression (by adding a <urlCompression> element to <system.webServier> ) does solve the problem: <urlCompression doStaticCompression="true" doDynamicCompression="false" /> However, this disables compression site-wide. I would like to preserve compression for every other controller and

How can I tell if my server is serving GZipped content?

夙愿已清 提交于 2019-11-26 22:29:30
问题 I have a webapp on a NGinx server. I set gzip on in the conf file and now I'm trying to see if it works. YSlow says it's not, but 5 out of 6 websites that do the test say it is. How can I get a definite answer on this and why is there a difference in the results? 回答1: It looks like one possible answer is, unsurprisingly, curl: $ curl http://example.com/ --silent --write-out "%{size_download}\n" --output /dev/null 31032 $ curl http://example.com/ --silent -H "Accept-Encoding: gzip,deflate" -

python: read lines from compressed text files

不问归期 提交于 2019-11-26 22:26:27
Is it easy to read a line from a gz-compressed text file using python without extracting the file completely? I have a text.gz file which is aroud 200mb. When I extract it, it becomes 7.4gb. And this is not the only file I have to read. For the total process, I have to read 10 files. Although this will be a sequential job, I think it will a smart thing to do it without extarcting the whole information. I do not even know that it is possible. How can it be done using python? I need to read a text file line-by-line. Have you tried using gzip.GzipFile ? Arguments are similar to open . Using gzip

Zip support in Apache Spark

[亡魂溺海] 提交于 2019-11-26 22:24:36
问题 I have read about Spark 's support for gzip -kind input files here, and I wonder if the same support exists for different kind of compressed files, such as .zip files. So far I have tried computing a file compressed under a zip file, but Spark seems unable to read its contents successfully. I have taken a look to Hadoop 's newAPIHadoopFile and newAPIHadoopRDD , but so far I have not been able to get anything working. In addition, Spark supports creating a partition for every file under a

Python unzipping stream of bytes?

风流意气都作罢 提交于 2019-11-26 22:08:32
Here is the situation: I get gzipped xml documents from Amazon S3 import boto from boto.s3.connection import S3Connection from boto.s3.key import Key conn = S3Connection('access Id', 'secret access key') b = conn.get_bucket('mydev.myorg') k = Key(b) k.key('documents/document.xml.gz') I read them in file as import gzip f = open('/tmp/p', 'w') k.get_file(f) f.close() r = gzip.open('/tmp/p', 'rb') file_content = r.read() r.close() Question How can I unzip the streams directly and read the contents? I do not want to create temp files, they don't look good. Yes, you can use the zlib module to

Python image library (PIL), how to compress image into desired file size?

僤鯓⒐⒋嵵緔 提交于 2019-11-26 21:49:47
问题 I got a requirement to compress any uploaded images less than 500kb in file size, I have searched on google and all I can see is: >>> foo = foo.resize((160,300),Image.ANTIALIAS) >>> foo.save("path\\to\\save\\image_scaled.jpg",quality=95) If I go with this approach I will have to check if the image is less than 500kb after compress, if not then go for lower quality and size. Is there a better way to do it? 回答1: JPEG compression is not predictable beforehand. The method you described, compress

Is there a way to 'compress' an lm() object for later prediction?

邮差的信 提交于 2019-11-26 21:34:45
问题 Is there a way to 'compress' an object of class lm, so that I can save it to the disk and load it up later for use with predict.lm? I have an lm object that ends up being ~142mb upon saving, and I have a hard time believing that predict.lm needs all of the original observations / fitted values / residuals etc. to make a linear prediction. Can I remove information so that the saved model is smaller? I have tried setting some of the variables (fitted.values, residuals, etc.) to NA, but it seems

How to read data from a zip file without having to unzip the entire file

*爱你&永不变心* 提交于 2019-11-26 21:34:14
Is there anyway in .Net (C#) to extract data from a zip file without decompressing the complete file? Simply I possibly want to extract data (file) from the start of a zip file, obviously this depends if the compression algorithm compress the file in a deterministic order. DotNetZip is your friend here. As easy as: using (ZipFile zip = ZipFile.Read(ExistingZipFile)) { ZipEntry e = zip["MyReport.doc"]; e.Extract(OutputStream); } (you can also extract to a file or other destinations). Reading the zip file's table of contents is as easy as: using (ZipFile zip = ZipFile.Read(ExistingZipFile)) {

Fast Video Compression on Android

这一生的挚爱 提交于 2019-11-26 20:57:29
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-cpudetect --sysroot=/home/sb/Source-Code/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable