Skip to content

Commit

Permalink
Lots of changes
Browse files Browse the repository at this point in the history
- Adding graphical user interface
- Command line arguments support
- Remove most of the code from Program.cs and put into other clases
- Edit readme to reflect changes
  • Loading branch information
Kevin Gut committed Nov 27, 2016
1 parent 398cc49 commit 29c4c48
Show file tree
Hide file tree
Showing 14 changed files with 1,707 additions and 273 deletions.
45 changes: 24 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,37 @@
Creates Color Bands from movies

It is now the second time I see Color Bands on reddit without a source code provided,
as if it was made by some evil magic.
as if it was made by some evil magic. This time the person creating those is also selling these images.

# How to use
Just double click the .exe file and fill in the requested values.

**Hint:** When asked for file names, you can drag the file itself on the console to fill in the full path.

## Questions asked
List of questions you are asked to answer
Well now you can create them on your own. And it's fast too.
For most source files it encodes with at least 20x playback speed.

### Source video file
The path and name of the video file to use
# How to use
This application can be used in Windowed and Console mode.

### Destination image file
The path and name of the destination image (the color band)
## Windowed mode
Just double click the .exe file to get the graphical user interface.

### Image height
The height of the image. The width is determined by the number of frames in the video.
## Console mode
You can use it in command line mode (untested as fo now).
Type `ColorBand /?` for help.

### Use single color
If you answer `y`, then each frame is reduced to one color.
If you answer `n`, then each frame is reduced to a width of 1.
# Single color mode
Single color mode reduces a frame to a single pixel instead of a vertical line.
This causes the frame band to be only one color per frame.
The height value still works. This is what most people generate, but it looks less awesome.
Multi color mode examples can be found on [imgur](http://imgur.com/a/M9oIx).

# TODO
- Make the programm accept command line arguments
- GUI
- Error checking
- [X] Adding graphical interface
- [X] Autodetect height from video
- [X] Use command line arguments instead of prompts
- [X] Some error checking
- [ ] Make image joiner async for UI

# FFMPEG
# License
This application is licensed under the [GNU agpl 3.0](https://www.gnu.org/licenses/agpl-3.0.txt).
FFmpeg is licensed under [this mess](https://www.ffmpeg.org/legal.html).

# FFMPEG
This work contains the compiled ffmpeg binaries inside blob.bin.
20 changes: 12 additions & 8 deletions colorBand/Compressor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public static class Compressor
/// <remarks>During compression, the path information is lost</remarks>
/// <param name="Files">Full file names.</param>
/// <param name="Destination">Destination stream</param>
public static void Compress(string[] Files, Stream Destination)
/// <param name="Verbose">Logs each compressed file if true</param>
public static void Compress(string[] Files, Stream Destination, bool Verbose)
{
FileInfo[] FF = Array.ConvertAll(Files, delegate(string f) { return new FileInfo(f); });

Expand All @@ -27,9 +28,10 @@ public static void Compress(string[] Files, Stream Destination)
BW.Write(Files.Length);
foreach (FileInfo F in FF)
{
#if DEBUG
Console.WriteLine("Compressing {0}", F.Name);
#endif
if (Verbose)
{
Console.Error.WriteLine("Compressing {0}", F.Name);
}
byte[] Data = File.ReadAllBytes(F.FullName);
BW.Write(Encoding.UTF8.GetByteCount(F.Name));
BW.Write(Encoding.UTF8.GetBytes(F.Name));
Expand All @@ -45,7 +47,8 @@ public static void Compress(string[] Files, Stream Destination)
/// </summary>
/// <param name="Directory">Destination directory</param>
/// <param name="Source">Compressed source stream</param>
public static void Decompress(string Directory, Stream Source)
/// <param name="Verbose">Logs each decompressed file if true</param>
public static void Decompress(string Directory, Stream Source, bool Verbose)
{
using (GZipStream GZ = new GZipStream(Source, CompressionMode.Decompress))
{
Expand All @@ -55,9 +58,10 @@ public static void Decompress(string Directory, Stream Source)
for (int i = 0; i < Count; i++)
{
string FileName = Encoding.UTF8.GetString(BR.ReadBytes(BR.ReadInt32()));
#if DEBUG
Console.WriteLine("Decompressing {0}", FileName);
#endif
if (Verbose)
{
Console.Error.WriteLine("Decompressing {0}", FileName);
}
byte[] Content = BR.ReadBytes(BR.ReadInt32());
File.WriteAllBytes(Path.Combine(Directory, FileName), Content);
}
Expand Down
Loading

0 comments on commit 29c4c48

Please sign in to comment.