DEV Community

Cover image for Sample files — test files for bugs, not file sizes
Muhammad Zeeshan
Muhammad Zeeshan

Posted on

Sample files — test files for bugs, not file sizes

A while back I was working on a video player inside an app. Basic stuff. Pick a file, play it. It worked on every file I threw at it, so I shipped it.

Few days later I received a bug report with screen recording. Black screen, audio playing fine, no video. The file was an MP4. My test file was also an MP4. Same extension, same container, completely different result.

The difference was the codec inside. His file was HEVC. Mine was H.264. I never tested that because I never had a file to test it with.

So I went looking for one.

What I found instead

If you search for sample video download, you land on sites like file-examples.com or filesamples.com. They are useful, and I have used them multiple times. But all the available variants are just size or resolution based:

  • MP4 / SD / 1.26 MB
  • MP4 / HD / 36.48 MB
  • MP4 / 4K / 66.41 MB

It answers two question:

  • how big is the file?
  • how crisp is it?

Its perfectly fine if you are testing an upload limit or how it looks in a high resolution device. It does not help at all when your player shows a black screen, because all provided files are of the same codec, the same frame rate, the same color tags. Downloading a bigger version of a file that already works tells you nothing new.

I wanted the opposite. I did not care about size or resolution. I cared about what was inside.

So I built Sample Files

Sample Files is a small tool on my site that gives you ready made test files, grouped by the situation and use cases you are testing instead of by how many kilobytes they are.

Sample file is not a file generator. You do not fill a form and press "Generate". Every file is already made, already checked, and sitting there waiting for you to download it. Open the format you need, read the short label on each file, grab the one that matches your case. Few variants have an info icon that shows any additional information about the use case.

Sample Files showing variants for MP4

Back to the video player. Under videos you get things like:

  • H.264 in MP4, the safe one that plays everywhere
  • HEVC, with and without the hvc1 tag, which is the exact reason some files play on iOS and Mac and some do not
  • AV1 and VP9, which QuickTime will politely refuse to open
  • Variable frame rate files, which quietly break seeking and duration maths
  • Different color space tags, so you can see if your player washes out the picture
  • Files with chapter markers
  • Files with two or three audio tracks, so you can build and test a track switcher
  • Files with metadata embedded, and files with none at all

Every one of those is a real bug I have either hit myself or watched someone else hit. That black screen I shipped? There is a file for it now.

55+ formats, not just video

MP4 is just where I started. The tool now covers 55+ formats, and a good number of them go far past the usual "here's a small one and a big one" treatment.

  • MOV has the same codec, frame rate and tagging depth as MP4.
  • RTF has files written by five different editors, plus spec version and encoding variants.
  • ZIP splits across compression methods, encryption types, Zip64, non-Latin filenames and a few deliberately broken archives.
  • TAR.GZ covers the old tar flavors, sparse files and path traversal cases.
  • PNG with its filter methods.
  • TIFF with its compression and layout variants
  • FLAC and Opus for audio, and CSV with the delimiter, encoding and quoting messes that wreck importers.

If you work with any of those, there is more waiting for you than a size list.

Go break something

It is free, there is no signup, and you download only the file you need instead of a giant bundle.

👉 mzeeshan.me/tools/sample-files

I am still adding formats and variants, so if you have hit a file that broke your app in a strange way, fill out the form on the page. If its a case that is beneficial for other users in general its exactly the kind of case I want to add next. Odds are good someone else has the same black screen sitting in their bug tracker right now.

Form for adding new formats and variants

Top comments (0)