Merge remote-tracking branch 'upstream/master'

This commit is contained in:
David Tippett 2020-10-07 09:51:07 -04:00
commit ba150c3304
2 changed files with 58 additions and 35 deletions

58
README.md Normal file
View File

@ -0,0 +1,58 @@
fvid is a project that aims to encode any file as a video using 1-bit color images
to survive compression algorithms for data retrieval.
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Naereen/StrapDown.js/graphs/commit-activity)
[![PyPI license](https://img.shields.io/pypi/l/ansicolortags.svg)](https://pypi.python.org/pypi/ansicolortags/)
<p align="center">
<img src="https://i.imgur.com/LVthky0.png" alt="fvid">
</br>
</p>
---
# Usage
Encoding files as videos
Linux/OSX
```
fvid -i [input file] -e
```
Windows
```
py -m fvid -i [input file] -e
```
Retrieving data from videos
Linux/OSX
```
fvid -i [input video] -d
```
Windows
```
py -m fvid -i [input video] -d
```
How to Contribute
-----------------
1. Check for open issues or open a fresh issue to start a discussion
around a feature idea or a bug [here](https://github.com/AlfredoSequeida/fvid/issues)
tag for issues that should be ideal for people who are not very familiar with the codebase yet.
2. Fork [the repository](https://github.com/alfredosequeida/fvid) on
GitHub to start making your changes to the **master** branch (or branch off of it).
3. Write a test which shows that the bug was fixed or that the feature
works as expected.
4. Send a pull request and bug the maintainer until it gets merged and
published. :)

35
fvid.py
View File

@ -93,19 +93,6 @@ def get_bits_from_video(video_filepath):
for filename in glob.glob(f"{FRAMES_DIR}decoded_frames*.png"):
image_sequence.append(Image.open(filename))
# process = (
# ffmpeg.input(video_filepath)
# .output("pipe:", format="rawvideo", pix_fmt="rgb24")
# .run_async(pipe_stdout=True)
# )
# image = Image.frombytes(
# size=(1920, 1080), data=process.stdout.read(1920 * 1080), mode="1"
# )
# image.save("image.png")
# get pixels from each still frame and append to one big array
bits = ""
sequence_length = len(image_sequence)
@ -170,28 +157,6 @@ def make_image_sequence(bitstring, resolution=(1920, 1080)):
def make_video(output_filepath, image_sequence):
# image1 = np.stack([imageio.imread("image0_rend.png")] * 3, 2)
# # image2 = imageio.imread("image1.png")
# # image3 = imageio.imread("imageio:immunohistochemistry.png")
# w = imageio.get_writer(filepath, fps=1, macro_block_size=None)
# w.append_data(image1)
# # w.append_data(image2)
# # w.append_data(image3)
# w.close()
# process = (
# ffmpeg.input("pipe:", pattern_type="glob", framerate=25)
# .output(filepath, vcodec="libx264rgb")
# .run_async(pipe_stdin=True)
# )
# for image in image_sequence:
# process.communicate(input=image.tobytes())
# process.communicate(input="*.png")
frames = glob.glob(f"{FRAMES_DIR}encoded_frames*.png")