Skip to main content

Convert any file to video and video to file

Project description

📄🔄🎞️ PixelFuse

Convert any file to video and video to file.

WARNING: videos created from files are extremely fragile

💿 Installation

  • Set up using pip:
pip install pixelfuse
  • Install from Git:
pip install git+https://github.com/TheTS-labs/PixelFuse.git

🎬 Usage

Convert file to video(fileToVideo)

To convert a file into a video just write the following command:

python -m pixelfuse fileToVideo "test/example.text.txt"

Where "test/example.text.txt" the file you want to convert to video

As output you get the file output.avi - video 640x480, 1.0 FPS, codec HFYU like this

As for the parameters:

  • path: Path - mandatory, the path to the file you want to convert
  • fps: float - frame rate, default is 1.0
  • width: int - Video length, default is 480px
  • height: int - Video height, 640px by default
  • fourcc: str - Codec, a string of 4 characters, WARNING: Use lossless codecs ONLY, default is "HFYU".
  • output: Path - Path to output file, default is "output.avi", note you need to use file extension compatible with codec, for example if you use HFYU codec you can NOT specify output as output.mp4
  • verbose: int - Output level, from 0 to 3, default is 2

🆕 Convert files to video(filesToVideo)

To convert a file into a video just write the following command:

python -m pixelfuse filesToVideo "test/example.text.txt" "test/example.image.jpg"

Where "test/example.text.txt" and "test/example.image.jpg" the files you want to convert to video

This command will create a tar.gz archive which will later convert to a video, and delete the archive

This command will also create a hash map in which it will write the hash of each file. Then convertToFile unpacks all files and checks them according to this map

As output you get the file output.avi - video 640x480, 1.0 FPS, codec HFYU like this

As for the parameters:

  • paths: list[Path] - mandatory, the paths to the files you want to convert
  • fps: float - frame rate, default is 1.0
  • width: int - Video length, default is 480px
  • height: int - Video height, 640px by default
  • fourcc: str - Codec, a string of 4 characters, WARNING: Use lossless codecs ONLY, default is "HFYU".
  • output: Path - Path to output file, default is "output.avi", note you need to use file extension compatible with codec, for example if you use HFYU codec you can NOT specify output as output.mp4
  • verbose: int - Output level, from 0 to 3, default is 2

Convert video to file(videoToFile)

To get your file(s) back now you need to use this command:

python -m pixelfuse videoToFile "test/example.video.avi"

Where "test/example.video.avi" is the video you want to convert into file(s)

As output, you will get the file with the name it was converted into a video. For example, if you converted the file "example.image.jpg", when you convert the video back to a file you get a file named example.image.jpg

Or a folder with files, if you converted several files. By default, the folder name is the name of the video file without path or extension, but you can specify something else with the exctractDir parameter

Regarding the parameters:

  • path: Path - Mandatory, the path to the video you want to convert back to a file
  • verbose: int - Output level, from 0 to 2, default is 2
  • exctractDir: str - Path to extract archive files

⚠️ Warning

Because of the way this converter works, the video output is very, very fragile

In order for you to be able to convert the file back, every pixel MUST remain unchanged, that is what you should avoid:

  • Use ONLY lossless codecs, as all other codecs corrupt the pixels. E.g. FFMPEG FFV1, Huffman HFYU, Lagarith LAGS, etc.
  • Do not convert videos to other formats, as this will most likely cause pixel damage
  • Keep in mind that if you upload videos to YouTube, it will re-encode the video(and, guess what, damage the pixels), so if you want to download videos from YouTube, you'll need to use Google Takeout
  • Do not trim the video, it will trim some of the information, and therefore the file you converted
  • Do not apply filters to the video, for example. Anything that can change pixels will damage the file and you won't be able to decode it
  • Never convert zip archives, for some unknown reason the decoder (or encoder) cannot handle these archives properly, if you want to convert multiple files you better use the filesToVideo command

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pixelfuse-2.0.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

pixelfuse-2.0.0-py3-none-any.whl (31.8 kB view details)

Uploaded Python 3

File details

Details for the file pixelfuse-2.0.0.tar.gz.

File metadata

  • Download URL: pixelfuse-2.0.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pixelfuse-2.0.0.tar.gz
Algorithm Hash digest
SHA256 23ee585519af049df415fbfd24983984aac9f8f3c38db6c0adb8f4c0b253513f
MD5 d74a5fe85e70113e4763b4245afcbfe1
BLAKE2b-256 dbc271fcb93b6ec0b9ea05cd5da12de96608abdeccffdf995dcabbd491dc4c6e

See more details on using hashes here.

File details

Details for the file pixelfuse-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pixelfuse-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 31.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pixelfuse-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ce0e8183985985420480ef30dfe95d53d38ab14bbe9c0b2e5a544a3d32bd70e
MD5 e0cefe15cabe11b45f4f614979b79930
BLAKE2b-256 3eaf3b1143980f0b380167a24cf4b178f85a24404c45678ebfe485aff5dcec37

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page