Version (6.02 KB) by Eric
Create a movie Barcode out of any video file supported by the MATLAB function VideoReader()
Updated 6 Jan 2016

View License

Description: A sample of a video file can be represented in a single
image by taking each sampled frame, averaging the colors displayed in
that frame accross each row and saving the value of each averaged row
to one column of the output.
The result is an image similar to a barcode that is made up of snapshots
of the video file. This image is saved using the filename parsed from the
input filepath and is the output of this function.
Due to the slow functions used in this code tic/toc timing outputs
(wall time) have been added to keep track of how long it took to
initialize, how long it took ot load the video file, and how long it took
to process ~25% portions of the image.

It takes about 20 minutes to process an HD movie on an AMD 8 core with 8
gigs of RAM. processing times will vary from computer to computer and
from file to file.

movieBarcode(videoFilePath) Using the video files path from videoFilePath
movieBarcode will assume that there is no credits that should be cut and
will assume cutCredits is 0. movieBarcode will also assume standard
dimensions of 1920 pixel width and an aspect ratio of 2.66.

movieBarcode(videoFilePath,cutCredits,outputWidth,aspectRatio) will
accept the users input for cutCredits (0 for no, 1 for yes), the
outputWidth (number of pixels wide the output image is), and the aspect

Example ratios: Standard (4:3) 480x720, 720x960, 1080x1620;
HD (16:9) 480x854, 720x1280, 1080,1920;
VistaPrint Small (1.537:1) 480x738, 720x1107, 1080x1660;
imax movie ? (2.35:1) 480x1128, 720x1692;
Movie Barcode (2.66:1) 480x1280, 720x1920;

Note: This current version was created using MATLAB R2012b and for that reason, the suggested method of reading video files with hasFrame() and readFrame() was not used. Using functions written from R2010b or earlier can make this code run slower, but will reach a larger audience.

Cite As

Eric (2024). movieBarcode (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Data Import and Analysis in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes