Motion - Motion Browser
You are here: Foswiki>Motion Web>RelatedProjects>MotionBrowser (17 Jan 2016, MalHedrick)Edit Attach

Motion PHP Interface


This is a PHP web application that allows you to browse through all events recorded by motion and watch / download the respective video.

There is a timeline where you can see the thumbnail for each event. The timeline is for ‘n’ cameras in one day selected from a calendar.

You can also select events and delete them.

It's a great! interface for running Motion on a computer without monitor / keyboard / mouse and you only have a network connection!


Attached Files

motionbrowser_20060313.tar - PHP web interface


First you must have the motion application installed and running with;

  • mysql server and the ffmpeg libraries.
  • GD as in php4-gd or php5-gd. --this is required for drawing the thumbnails.
  • Apache web server.
  • PHP.

I've tested it with motion

Secondly a new database and table needs to be added to your mysql server. Run the command as root

mysql -h localhost -p -u root


CREATE USER 'newmotionuser'@'localhost' IDENTIFIED BY 'somepassword';

This will setup the new user for your php pages to use. Now add a database.



grant all on motiondb.* to 'motionuser1'@'localhost' identified by 'somepassword';

at this point you can check to see if you created the database by a

USE motiondb;


CREATE TABLE `security` (`camera` int(11) default NULL, `filename` varchar(80) NOT NULL default '',`frame` int(11) default NULL, `file_type` int(11) default NULL,`time_stamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,`text_event` varchar(40) NOT NULL default '0000-00-00 00:00:00',`event_time_stamp` timestamp NOT NULL default '0000-00-00 00:00:00', `file_size` varchar(36) NOT NULL default '0',KEY `time_stamp` (`time_stamp`),KEY `event_time_stamp` (`event_time_stamp`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;

this must be all as one command. This is also in the README file in the mb.tar.

There are some options in the configuration file motion.conf that are important for the way MotionBrowser works. I'm only indicating the ones that are different from the default:

  • output_normal best (I haven't tested with 'on', but it should also work)
  • ffmpeg_cap_new on
  • sql_log_mpeg on
  • mysql_db motion (my database name)
  • mysql_host localhost
  • mysql_user ... (the user name i created in MySQL)
  • mysql_password ... (the password associated with user)

Now, lets continue,

untar the motionbrowser_20060313.tar file to a folder on the root of your web server (for example: /var/www/http/motionbrowser).

Edit the extracted file to match your configuration.

If you installed php you may need to restart Apache. Now you can open MotionBrowser using http://localhost/motionbrowser/index.php

and see the PHP goodness.

Users Guide

Once you have MotionBrowser running, you can select the day you want clicking on the calendar.

To view a video of an event, click on the image of the desired event.

You can delete any event, checking the checkbox near each image and then click the button "delete selected".

You can also the select all if you want do delete all events on the current day.

You also have a link to motions setup and a link for each webcam using the small icon on the header close to the "Camera x" title.

Comments and Bug Reports

I've created a yahoo group to manage this project.

Check the url:

-- DanielAgar - 20 Jan 2007

-- JamesCordell - 20 Sep 2007

Hello, i have an error wen i deleting the files: ERROR deleting file: /media/disc1/50-20140930120025.avi

What can i do? Thanks

-- HoratiuDavidescu - 01 Oct 2014

Thanks, very helpful add-on to motion. I made a German translation; can I upload it somewhere to be included in the tar? The Yahoo group seems abandoned, only spam. Further, the abbreviation of megabyte is MB, not Mb, according to Wikipedia, see

-- AlAl - 11 Nov 2014

Minor bug in index.php: Line 279 has the French string hard-coded; should be:

echo "<p><a href=\"http://$server_addr:$setup_port\" target=_blank>$config_motion</a></p>\n";

-- AlAl - 11 Nov 2014

Installed on ubuntu 14.04 and gui wasn't working correctly. Problem was the language files. The fist line was <? and it needed to be <?php.

-- BrianPrather - 11 Jan 2015

Installed on Raspbian (Wheezy) and was getting "Notice: Undefined variable" for both listdays and today in /var/www/MotionBrowser/

Fixed listdays by removing the period before the equal sign of the first occurance i.e. '$listdays.=' became '$listdays=' and fixed the today issue by adding 'global $today;' at the start of the function in

-- MalHedrick - 17 Jan 2016

RelatedProjectsForm edit

ProjectSummary PHP interface to manage the Motion recorded events.
ProjectStatus Stable
ReleaseVersion 1.0.0
ProjectSubmitter CarlosLadeira
I Attachment Action Size Date Who Comment
MotionBrowser_Screenshot.jpgjpg MotionBrowser_Screenshot.jpg manage 55 K 14 Mar 2006 - 14:20 UnknownUser MotionBrowser screenshot
motionbrowser.tartar motionbrowser.tar manage 50 K 21 Sep 2007 - 12:02 UnknownUser A PHP web interface for motion in english and French
Topic revision: r11 - 17 Jan 2016, MalHedrick
Copyright © 1999-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.