ID: I202602261102
Status: idea
Tags: converting, file format, files

the everything converter

A few days ago I saw a video in my Youtube feed from a Youtuber called PortalRunner. It was named “Converting Between Different Mediums (Eg. Mp4 → Pdf)“. This cought my attention since normal file converters only convert between the same medium. Images to images, videos to videos and audio to audio. But this is between mediums.

In this video PortalRunner shows how he made it work, how to contribute, and what you can do with it.

On this website you will be able to convert almost any file type into another file type. It won’t be lossless, but it will allow you to. This converter works fully in your browser, you’ll never send a server your files.

How does it work

Normal file converters

With any “Normal” file converter you’ll first send your file to a server. Let’s say that we have sent a rabbit.jpg to the server. Then I’ll get to decide whether I want a .gif, .png, .webp, .jpeg etc. Then a tool will be called on the server, it is most likely ImageMagick, that will convert your image to your chosen image type. And then your image is returned to the browser.

Video types will have a similar process where it uses a tool called ffmpeg instead of ImageMagick. But the rest of the process is the same.

In the meanwhile you will have been shown about 20 ads, and your file is saved on their server which is not good for privacy.

Audio, office files, and other files can also be converted to similar types with a similar process.

This file converter

This tool works fully in the browser and has a clever way to work. Let’s say for example, we want to convert a video.mp4 into an image.png. It will work the following way:

It will look through all it’s tools that accept the .mp4 type. Then it will check all the tools that do on what output types it has. For example ffmpeg can output things like .mp4, .avif, .gif, .mov etc.

And then it will look through all tools that can handle those as input file, until it finally finds an output of .png. This is a kind of search algorithm where it will eventually find the fastest path of conversion. In our example it will take this path:

  • .mp4 to .gif with ffmpeg
  • .gif to .png with ImageMagick

But you can expand this to as many file types as you have tools. If you add an tool that handles .gif to .pdf you’ll be able to convert any video and any image type into a PDF.

How to contribute

Like said before, this project can scale infinitely. And that is kinda the goal. You can contribute to this project on this github repo. And a lot of people have done so.

When the video released there were about 10 conversion tools, now it is about 50 if not more. If you are able to convert a file to another, no matter how useless it may seem, it could help someone in the future.

How lossless is this

It depends on what route you want to take. If you convert your video into a pdf, it will loose all it’s audio, but all frames will be a separate page. So if your video has to go through the PDF to reach your destination, you will not have any audio tracks. If you convert an image to audio, it will loose a lot of data, but when you convert it back to an image, you’ll still be able to recognize the image. It really depends on which route you’ll take.

And files like Microsoft Word into OpenDocument Text will be perfect or close to it. It really depends on if you want to use a normal use-case, or if you want to do something random.


References