One File, Six Formats: Just Change The Extension

Normally, if you change a file’s extension in Windows, it doesn’t do anything positive. It just makes the file open in the wrong programs that can’t decode what’s inside. However, [PortalRunner] has crafted a file that can behave as six different filetypes, simply by swapping out the extension at the end of the filename.

The basic concept is simple enough. [PortalRunner] simply found a bunch of different file formats that could feasibly be crammed in together into a single file without corrupting each other or confusing software that loads these files.

It all comes down to how file formats work. File extensions are mostly meaningless to the content of a file—they’re just a shorthand guide so an operating system can figure out which program should load them. In fact, most files have headers inside that indicate to software what they are and how their content is formatted. For this reason, you can often rename a .PNG file to .JPEG and it will still load—because the operating system will still fire up an image viewer app, and that app will use headers to understand that it’s actually a PNG and not a JPEG at heart, and process it in the proper way.

[PortalRunner] found a way to merge the headers of various formats, creating a file that could be many different types. The single file contains data for a PNG image, an MP4 video, a PDF document, a ZIP archive, a Powerpoint presentation, and an HTML webpage. The data chunks for each format are lumped into one big file, with the combined headers at the very top. The hijinx required to pull this off put some limitations on what the file can contain, and the files won’t work with all software… but it’s still one file that has six formats inside.

This doesn’t work for every format. You can’t really combine GIF or PNG for example, as each format requires a different initial set of characters that have to be at the very beginning of the file. Other formats aren’t so persnickety, though, and you can combine their headers in a way that mostly works if you do it just right.

If you love diving into the binary specifics of how file formats work, this is a great project to dive into. We’ve seen similarly mind-bending antics from [PortalRunner] before, like when they turned Portal 2 into a webserver. Video after the break.

Continue reading “One File, Six Formats: Just Change The Extension”

Video Tape Hides Video Player

While it might not be accurate to say VHS is dead, it’s certainly not a lively format. It continues on in undeath thanks to dedicated collectors and hobbyists, some of whom may be tempted to lynch Reddit user [CommonKingfisher] for embedding a video player inside a VHS tape.

Miniaturization in action. The video player probably cost about the same as the original VHS when you account for inflation.

The hack started with a promotional video card via Ali Express, which is a cheap enough way to get a tiny LCD player MP4 playing micro. As you can see, there was plenty of room in the tape for the guts of this. The tape path is obviously blocked, so the tape is not playable in this format. [CommonKingfisher] claims the hack is “reversible” but since he cut a window for the LCD out of the casing of the cassette, that’s going to be pretty hard to undo. On the other hand, the ultrasonic cutter he used did make a very clean cut, and that would help with reversibility.

The fact that the thing is activated by a magnetic sensor makes us worry for the data on that tape, too, whether or not the speaker is a peizo. Ultimately it doesn’t really matter; in no universe was this tape the last surviving copy of “The Matrix”, and it’s a lot more likely this self-playing “tape” gets watched than the VHS was going to be. You can watch it yourself in the demo video embedded below.

VHS nostalgia around here usually involves replicating the tape experience, rather than repurposing the tape. We’re grateful to [George Graves] for the tip. Tips of all sorts are welcome on our friendly neighborhood tips line.

Continue reading “Video Tape Hides Video Player”

Supercon 2023: Ben Combee And The Hacker’s Guide To Audio/Video Formats

Media formats have come a long way since the early days of computing. Once upon a time, the very idea of even playing live audio was considered a lofty goal, with home computers instead making do with simple synthesizer chips instead. Eventually, though, real audio became possible, and in turn, video as well.

But what of the formats in which we store this media? Today, there are so many—from MP3s to MP4s, old-school AVIs to modern *.h264s. Senior software engineer Ben Combee came down to the 2023 Hackaday Supercon to give us all a run down of modern audio and video formats, and how they’re best employed these days.

Continue reading “Supercon 2023: Ben Combee And The Hacker’s Guide To Audio/Video Formats”

Python Web Proxy Convinces Sonos To Stream YouTube

[Maurice-Michel Didelot] owns a Sonos smart speaker, and was lamenting the devices inability (or plain unwillingness) to stream music from online sources without using a subscription service. YouTube Music will work, but being a subscription product there is a monthly fee, which sucks since you can listen to plenty of content on YouTube for free. [Maurice] decided that the way forward was to dig into how the Sonos firmware accesses ‘web radio’ sources, and see if that could be leveraged to stream audio from YouTube via some kind of on-the-fly stream conversion process.

What? No MP4 support for web radio? Curses!

So let’s dig in to how [Maurice] chose to approach this. The smart speaker can be configured to add various streaming audio sources, and allows you add custom sources for those. The Sonos firmware supports a variety of audio codecs, besides MP3, but YouTube uses the MP4 format. Sonos won’t handle that from a web radio source, so what was there to do, but make a custom converter?

After a little digging, it was determined that Sonos supports AAC encoding (which is how MP4 encodes audio) but needs it wrapped in an ADTS (Audio Data Transport Stream) container. By building a reverse web-proxy application, in python using Flask, it was straightforward enough to grab the YouTube video ID from the web radio request, forward a request to YouTube using a modified version of pytube tweaked to not download the video, but stream it. Pytube enabled [Maurice] to extract the AAC audio ‘atoms’ from the MP4 container, and then wrap them up with ADTS and forward them onto the Sonos device, which happily thinks it’s just a plain old MP3 radio stream, even if it isn’t.

Sonos doesn’t have the best reputation, let’s say, but you can’t deny that there’s some pretty slick tech going on inside. Here’s a neat hack we covered last year, adding Sonos support to an old school speaker, and a nice teardown of a IKEA Sonos-compatible unit, which uses some neat design hacks.

Thanks [mip] for the tip!

Featured image by Charles Deluvio on Unsplash.

Video Projector From An Old Single-slide Unit

Here’s a video projector that [Matt] hacked together. He needed a small and inexpensive solution to use with his R2D2 build. As you can see in the video after the break, it has no problem playing back the Princess’ distress call. But even if R2D2 is not one of the droids you’re looking for, we think this can be useful in other ways. One use that pops into mind is for projector-based Halloween displays.

As with past projector hacks, all you really need to pull this off is a light source, an LCD screen on which you can playback video, and a lens to focus the light onto a screen. Usually the LCD is the most expensive part of the project and building an enclosure to the correct dimensions can be a bit difficult. [Matt’s] solution was to use an MP4 knockoff media player. The rest of the setup is a ’50s era slide projector. The screen from the media player is about the same size as a single film slide, so he removed the screen from the case and put it where the slides go.

Continue reading “Video Projector From An Old Single-slide Unit”