How to compress or Zip whole folder using GZipStream - gzipstream

Any idea how I can do this? I am able to compress a single file.

You cannot GZip an entire folder directly, since GZip operates on a single stream of data. You will first have to turn the folder into such a stream.
One way to do this would be to create a Tar archive from the directory. This will give you a single stream to work on, and since the Tar format is not compressed, GZip will usually achieve good compression ratios on Tar files.

GZip doesn't support multiple files. They have to be combined in another container first like Tar. If you need full Zip support for C# use this library:
http://www.icsharpcode.net/opensource/sharpziplib/

Related

Does Mosaic supports ingesting compressed data?

We have a scenario of uploading compressed files into Blob container in Microsoft Azure and then read it.
Is it possible in Mosaic to do it and if yes, what is the way to achieve it?
We have files in .gz format.
Yes you can upload and read compressed files in Mosaic through Azure Reader.
Currently, Mosaic supports two compression types - .ZIP & .GZ
To read compressed files in Mosaic's Azure Reader node you can follow below steps -
In Path field, provide the path of the compressed folder as shown in screen shot below
Make the toggle button for Is Compressed is True
Select the compression type - (either .ZIP or .GZ)
In compressed path we will have to provide the file without the compressed extension.
e.g. if the compressed file is ‘ABC.csv.gz’ then in compressed path it would be ‘ABC.csv’
Similarly for files compressed in .zip format, the compressed path will be the path of files within that compressed folder.
e.g. compressed folder is ‘ABC.zip’ then compressed path would be ‘ABC/file.csv’
Select the format of the file and Validate.

How to use temporary files and replace the input when using ffmpeg in batch?

What I did so far:
I learned with this answer that I can use negative mapping to remove unwanted streams (extra audio, subtitles) from my video files.
I them proceeded to apply it to a few dozen files in a folder using a simple for /r loop on Windows' cmd. Since I thought this process as some kind of trim, I didn't care about my original files and wanted ffmpeg to replace them, which of course it cannot.
I tried to search a bit further and find ways to work around this issue without simply using a new destination an manually replacing files afterwards, but had no luck.
However a lot of my findings seemed to indicate that ffmpeg has capabilities to use external temporary files for some of it's functions, even though I couldn't really find more onto it.
What I want to do:
So is there any way that I can make ffmpeg remove those extra streams and them replace the original file somehow. I'll also be needing to use this to multiple file, by I don't think this would be a big issue...
I really need this to be done with ffmpeg, as learning the tool to it's full extent is a long-therm goal of mine and I want to keep working on that curve, but as for batch/cmd, I prefer it because I haven't properly learned a programming language yet (even if I often meddle with a few), but I would be happy to use suggestions of any kind for handling ffmpeg!
Thank you!
Not possible with ffmpeg alone
ffmpeg can't do in-place file changes.
The output must be a new file.
However, deleting/removing/replacing to original file with the new file should be trivial in your batch script.
I saw some vague references while searching and also stumbled upon the cache protocol and -hls_flags temp_file
The cache protocol allows some limited seeking during playback of live inputs. -hls_flags temp_file is only usable with the HLS muxer and creates a file named filename.tmp which is then renamed once the active segment completes. Neither are usable for what you want to do.

Gzip compression using boost library

I want a compress write a program which can compress directory and all its files in a .gz file. I have tried using using gzip filter but I dont know how can I add directory and multiple files. Also I would like to uncompress the same.
gzip by itself only compresses a single stream of data with no assumed structure. To archive directories using gzip, it is most commonly combined with tar, which has the ability to compress using gzip built in. I'm sure you have seen those sorts of files, which end in .tar.gz. You can probably find a library that processes those files.

How to write a script in ruby that adds the playtime of movies up

I have various folders with .avi and .mkv files in it.
I would like to write a script in ruby to count all these files and extract their playtime to see how much time I have spent watching movies.
I am new to programming, so I have no idea how to access the metadata in these files.
Any help on how to do this?
I have never used it, but there is a gem called rvideo, which allows you to get video file metadata (it uses ffmpeg underneath).
According to the documentation to get the video file duration you'd just have to run:
RVideo::Inspector.new(:file => "some_file.avi").duration
Couple that with Dir.glob, and you're pretty much set.

File writer filter creating a bigger AVI file then original

I am using the SampleGrabber filter to get the frames of an AVI file and alter them before writing them to another (new) AVI file using the File writer filter.
The problem that I am facing is that the new AVI file size is greater then the original file. I removed the SampleGrabber filter thinking that it might be my code causing the problem, but still the new file size is greater then the original file. I tested it with graphedit.
The filters used were File reader->AVI Splitter->AVI Mux->File writer.
I really want to preserve the file size. Is there any other filter or property that I have to set. At the moment I am only adding the Filters in GraphBuilder and rendering the file.
I am using DirectShowLib.Net.
I just did a quick test using
File source (async) -> AVI splitter -> AVI mux -> file writer
in graphedit and the output file always seems to come out the same size as the input for me. The only thing I can think of is that your input file might be compressed. It might be worth inspecting the input file with an app like gspot to determine that. As I understand it DirectShow will sometimes insert appropriate filters in order to make a connection, so if you're trying to connect your file source to an AVI splitter it may insert a decompressor if needed. Hope that's of some use

Resources