I have ~200 gif black-and-white files, 600-900 Kb each. The overall size is about 102 Mb.
I create pdf from them -
convert *.gif result.pdf
result.pdf file size is about 98 Mb. But I need a PDF file of size less than 25 Mb.
I tried different options - compress, quality, density - but none of them helped.
What else could I try?
Try
convert 150_orig.gif -compress FAX -type bilevel tiff:- | convert - result.pdf
This reduces the file size from 613448B to 157477B.
I am cropping a tif image file using gdal_translate but the resulting file is of bigger size compared to the original file.
Here is the sample command that I am using to crop the image
gdal_translate -srcwin 4000 4500 2000 3000 Ortho.tif Ortho_cropped.tif
You can compress the output too with the following
gdal_translate -srcwin 4000 4500 2000 3000 -co COMPRESS=DEFLATE -co PREDICTOR=2 Ortho.tif Ortho_cropped.tif
This uses deflate compression which is often quite effective. A predictor of 2 is often nice for integer values, while you can change the predictor to 3 if your values are floats.
You can use other compressions too like ZSTD if you are using gdal >= 2.3 which should be faster and archive similar compression rates. If you do not care about lossy compression, you can even use JPEG.
If you do not know the compression of your original image you can see what it is using the command gdalinfo Ortho.tif where the compression is described under Image Structure Metadata
I am using gdal_translate command
$ gdal_translate.exe -of JPEG -outsize 2% 2% d:\rochester_bldg_region.shp d:\b.jpg
ERROR 4: `d:\rochester_bldg_region.shp' not recognized as a supported file format.
Use gdal_rasterize, which burns vector geometries into a raster.
Note that this utility can't directly write JPEG files, so you will need to create a GeoTIFF, then convert that to JPEG.
I'm writing a script to test some .ts files. At this point, I want to judge if each .ts file has any content. So I need to know the minimum size of a 360p quality .ts file (let's say it's just 0.00001s). So can anyone tell me the minimum size of a .ts file in 360p quality? Or is it just 0Byte?
0 bytes is "valid" in that it is a TS file that exists, but does not contain content. The minimum size of a 'parseable' TS file will be 188 bytes. TS is broken into 188 bytes packets and padded if smaller. But a 188 byte TS file will not be playable. You at least need a PAT and PMT. But it still does not contain any video (or audio) The smallest video frame I have ever created was 603 bytes (64x64 pix) here. Plus we need at minimum TS header(4) + AF/PCR(8) + PS Header w/ PTS(13). 603 + 4 + 8 + 13 = 628 / 188 =~ 3.34. Rounded up to 4 packets plus PAT and PMT. 188 * 6 = 1128 bytes. A single audio packet will not likely take more that one packet, so add another 188 for that.
No matter what library/SDK to use, I want to convert from avi to asf very quickly (I could even sacrifice some quality of video and audio). I am working on Windows platform (Vista and 2008 Server), better .Net SDK/code, C++ code is also fine. :-)
I learned from the below link, that there could be a very quick way to convert from avi to asf to support streaming better, as mentioned "could convert the video from AVI to ASF format using a simple copy (i.e. the content is the same, but container changes).". My question is after some hours of study and trial various SDK/tools, as a newbie, I do not know how to begin with so I am asking for reference sample code to do this task. :-)
(as this is a different issue, we decide to start a new topic. :-) )
Issue with streaming AVI files
thanks in advance,
George
EDIT 1:
I have tried to get the binary of ffmpeg from,
http://ffmpeg.arrozcru.org/autobuilds/ffmpeg-latest-mingw32-static.tar.bz2
then run the following command,
C:\software\ffmpeg-latest-mingw32-static\bin>ffmpeg.exe -i test.avi -acodec copy
-vcodec copy test.asf
FFmpeg version SVN-r18506, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --enable-memalign-hack --prefix=/mingw --cross-prefix=i686-ming
w32- --cc=ccache-i686-mingw32-gcc --target-os=mingw32 --arch=i686 --cpu=i686 --e
nable-avisynth --enable-gpl --enable-zlib --enable-bzlib --enable-libgsm --enabl
e-libfaac --enable-pthreads --enable-libvorbis --enable-libmp3lame --enable-libo
penjpeg --enable-libtheora --enable-libspeex --enable-libxvid --enable-libfaad -
-enable-libschroedinger --enable-libx264
libavutil 50. 3. 0 / 50. 3. 0
libavcodec 52.25. 0 / 52.25. 0
libavformat 52.32. 0 / 52.32. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0. 7. 1 / 0. 7. 1
built on Apr 14 2009 04:04:47, gcc: 4.2.4
Input #0, avi, from 'test.avi':
Duration: 00:00:44.86, start: 0.000000, bitrate: 5291 kb/s
Stream #0.0: Video: msvideo1, rgb555le, 1280x1024, 5 tbr, 5 tbn, 5 tbc
Stream #0.1: Audio: pcm_s16le, 22050 Hz, mono, s16, 352 kb/s
Output #0, asf, to 'test.asf':
Stream #0.0: Video: CRAM / 0x4D415243, rgb555le, 1280x1024, q=2-31, 1k tbn,
5 tbc
Stream #0.1: Audio: pcm_s16le, 22050 Hz, mono, s16, 352 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 224 fps=222 q=-1.0 Lsize= 29426kB time=44.80 bitrate=5380.7kbits/s
video:26910kB audio:1932kB global headers:0kB muxing overhead 2.023317%
C:\software\ffmpeg-latest-mingw32-static\bin>
http://www.microsoft.com/windows/windowsmedia/player/webhelp/default.aspx?&mpver=11.0.6001.7000&id=C00D11B1&contextid=230&originalid=C00D36E6
then have the following error when using Windows Media Player to play it, does anyone have any ideas?
http://www.microsoft.com/windows/windowsmedia/player/webhelp/default.aspx?&mpver=11.0.6001.7000&id=C00D11B1&contextid=230&originalid=C00D36E6
Maybe you could use FFMPEG and run a command like this (I haven't tried):
ffmpeg.exe -i test.avi -acodec copy -vcodec copy test.asf