debian/0000775000000000000000000000000012237555712007201 5ustar debian/source/0000775000000000000000000000000012210315711010461 5ustar debian/source/format0000664000000000000000000000001412210315711011667 0ustar 3.0 (quilt) debian/manpages_files/0000775000000000000000000000000012210315711012136 5ustar debian/manpages_files/shotdetect.10000664000000000000000000000166012210315711014371 0ustar .TH shotdetect 1 January,\ 2012 .SH NAME shotdetect - scene change detector .SH SYNOPSIS \fBshotdetect\fR [options] .SH DESCRIPTION \fBshotdetect\fR detects shots and scenes in a movie. The result produced is a simple XML file containing scenes boundary and features. It is also possible to automatically get scenes boundary shots. .SH OPTIONS .TP \fB-h\fR display help .TP \fB-i\fR \fIfile\fR video input file path .TP \fB-o\fR \fIpath\fR output directory path .TP \fB-s\fR \fIthreshold\fR the threshold is the level for shot detection. High will not detect a lot, low will detect a lot of false shots. A good choice is about 60 .TP \fB-w\fR generates an xml with basic audio features .TP \fB-v\fR generates an xml with basic video features .TP \fB-f\fR generates the first image of shots .TP \fB-l\fR generates the last image of shots .TP \fB-m\fR generates the thumbnails images .TP \fB-r\fR generates the real size images debian/copyright0000664000000000000000000001510312210315711011114 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Contact: Johan MATHE Upstream-Name: shotdetect Source: http://shotdetect.nonutc.fr/ Files: * Copyright: 2007, Johan MATHE, IRI, POMPIDOU License: LGPL-2.1+ Files: debian/* Copyright: 2012-2013 Giulio Paci License: LGPL-2.1+ Files: debian/patches/1002-fix-FTBFS-libav0.9.patch Copyright: 2012 Fabrice Coutadeur License: LGPL-2.1+ Files: debian/patches/1003-fix-FTBFS-ffmpeg_1.0.x.patch debian/patches/1004-fix_comments_and_names.patch debian/patches/1005-add_framenumber_to_filename.patch debian/patches/1006-label_xaxis_with_timecode.patch Copyright: 2013 Peter B. License: LGPL-2.1+ Files: debian/manpages_files/shotdetect.1 Copyright: 2007, Johan MATHE, IRI, POMPIDOU, 2012, Giulio Paci License: LGPL-2.1+ License: LGPL-2.1+ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. . This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . The text of the GNU Lesser General Public License is available at `/usr/share/common-licenses/LGPL-2.1'. Files: ltmain.sh Copyright: 1996-2005 Free Software Foundation, Inc. 1996, Gordon Matzigkeit License: GPL-2+ with Autoconf exception Files: depcomp Copyright: 1999-2006, Free Software Foundation, Inc. Alexandre Oliva License: GPL-2+ with Autoconf exception Files: config.guess config.sub Copyright: 1992-2005 Free Software Foundation, Inc. License: GPL-2+ with Autoconf exception Files: missing Copyright: 1996, 1997, 2001, 2002 Free Software Foundation, Inc. 1996, Franc,ois Pinard License: GPL-2+ License: GPL-2+ with Autoconf exception This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. . As a special exception to the GNU General Public License, if you distribute this file as part of a program that contains a configuration script generated by Autoconf, you may include it under the same distribution terms that you use for the rest of that program. . The text of the GNU Lesser General Public License is available at `/usr/share/common-licenses/GPL-2'. License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. . The text of the GNU Lesser General Public License is available at `/usr/share/common-licenses/GPL-2'. Files: Makefile.in src/Makefile.in Copyright: 1994-2008 Free Software Foundation, Inc. License: permissive This Makefile.in is free software; the Free Software Foundation gives unlimited permission to copy and/or distribute it, with or without modifications, as long as this notice is preserved. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Files: configure Copyright: 1992-1996, 1998-2006, Free Software Foundation, Inc. License: permissive This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Files: aclocal.m4 Copyright: 1996-2007, Free Software Foundation, Inc. License: permissive This file is free software; the Free Software Foundation gives unlimited permission to copy and/or distribute it, with or without modifications, as long as this notice is preserved. Files: install-sh Copyright: 1994, X Consortium License: Expat with FSF exceptions Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: . The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. . THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. . Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other deal- ings in this Software without prior written authorization from the X Consor- tium. . FSF changes to this file are in the public domain.debian/manpages0000664000000000000000000000003212210315711010672 0ustar debian/manpages_files/*.1 debian/copyright_hints0000664000000000000000000000561012210315711012323 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: FIXME Upstream-Contact: FIXME Source: FIXME Disclaimer: Autogenerated by CDBS Files: AUTHORS ChangeLog INSTALL Makefile.am NEWS README TODO acinclude.m4 config.h.in configure.in debian/compat debian/control debian/control.in debian/gbp.conf debian/manpages debian/manpages_files/shotdetect.1 debian/patches/1001-compilation_fixes.patch debian/patches/1002-fix-FTBFS-libav0.9.patch debian/patches/1003-fix-FTBFS-ffmpeg_1.0.x.patch debian/patches/1005-add_framenumber_to_filename.patch debian/patches/1006-label_xaxis_with_timecode.patch debian/patches/series debian/rules debian/source/format debian/source/local-options debian/watch include/bdd.h include/conf.h include/config.h include/graph.h include/shot.h include/stamp-h include/xml.h mkinstalldirs src/Makefile.am Copyright: *No copyright* License: UNKNOWN FIXME Files: src/film.cpp src/graph.cpp src/image.cpp src/shot.cpp src/xml.cpp Copyright: 2007, Johan MATHE - johan.mathe@tremplin-utc.net - Centre License: LGPL-2.1+ FIXME Files: config.guess config.sub Copyright: 1992-1999 1992-2005, License: GPL-2+ FIXME Files: COPYING README.shotdetect Copyright: 2007, Johan MATHE, IRI, POMPIDOU License: LGPL-2.1+ FIXME Files: Makefile.in src/Makefile.in Copyright: 1994-2002 License: UNKNOWN FIXME Files: include/film.h include/image.h Copyright: (c ## LL) (c ## ULL) License: UNKNOWN FIXME Files: install-sh Copyright: 1994, X Consortium License: Expat FIXME Files: ltmain.sh Copyright: 1996-2001, 2003-2005 2005, Free Software Foundation, Inc." License: GPL-2+ FIXME Files: depcomp Copyright: 1999-2000, 2003-2006, Free Software License: GPL-2+ FIXME Files: missing Copyright: 1996-1997, 2001-2002, Free Software Foundation, Inc License: GPL-2+ FIXME Files: src/main.cpp Copyright: 2007, Johan MATHE - johan.mathe@tremplin-utc.net - Centre 2007-2013, Johan Mathe (Centre Pompidou - IRI)\n\n" License: LGPL-2.1+ FIXME Files: configure Copyright: (ISLOWER ? 'A' + ( - 'a') : ) (ISLOWER ? ( | 0x40) : ) 1992-1996, 1998-2001, 2006, Free Software Foundation, Inc License: UNKNOWN FIXME Files: aclocal.m4 Copyright: 1996-1997, 2000-2001, 2003, 2005, 1996-2004, 1997, 1999-2001, 2003-2005, 1997, 2000-2001, 2003-2006, 1999-2005, 1999-2006, 2001, 2003, 2005, Free Software Foundation, Inc 2001-2003, 2005 Free Software Foundation, Inc 2002-2003, 2005-2007, Free Software Foundation, Inc 2003, 2005 Free Software Foundation, Inc 2003-2006, Free Software Foundation, Inc 2004-2005, Free Software Foundation, Inc 2006, Free Software Foundation, Inc License: UNKNOWN FIXME Files: debian/patches/1004-fix_comments_and_names.patch Copyright: 2007-2013, Johan Mathe (Centre Pompidou - IRI)\n\n" de mvmt License: UNKNOWN FIXME Files: resources/xsl/default.xslt Copyright: ddc"/> par : License: UNKNOWN FIXME debian/changelog0000664000000000000000000000250512237555712011055 0ustar shotdetect (1.0.86-2build1) trusty; urgency=low * No change rebuild against libav 9. -- Dmitrijs Ledkovs Sun, 10 Nov 2013 01:05:14 +0000 shotdetect (1.0.86-2) unstable; urgency=low [ Giulio Paci ] * Add a patch to fix FTBFS with libav 0.9. Closes: #694299. Fixes FTBFS on Ubuntu 12.04. * Rename compilation_fixes.patch to 1001-compilation_fixes.patch. * Add 1003-fix-FTBFS-ffmpeg_1.0.x.patch. * Add 1004-fix_comments_and_names.patch. * Add 1005-add_framenumber_to_filename.patch (unused). * Add 1006-label_xaxis_with_timecode.patch (unused). * Set Debian Multimedia Maintainers as maintainer. * Add Giulio Paci as uploader. * Add Vcs-Git and Vcs-Browser fields in debian/control. * Drop libstdc++-dev dependency. * Drop optional libgd2-xpm-dev dependency. * Require libgd-dev (>= 2.1). * Fix copyright Format field. * Fix copyright license information for some files. * Add hardening flags. * Set debhelper compatibility level to 9. * Bump Standards-Version to 3.9.4. No changes needed. [ Sebastian Ramacher] * Add myself to Uploaders. -- Giulio Paci Sun, 01 Sep 2013 15:23:15 +0200 shotdetect (1.0.86-1) unstable; urgency=low * Initial release. Closes: #475190. -- Giulio Paci Fri, 06 Apr 2012 18:52:47 +0200 debian/gbp.conf0000664000000000000000000000014612210315711010601 0ustar # Configuration file for git-buildpackage and friends [DEFAULT] pristine-tar = True sign-tags = True debian/control0000664000000000000000000000212012237555712010577 0ustar Source: shotdetect Section: video Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian Multimedia Maintainers Uploaders: Giulio Paci , Sebastian Ramacher Build-Depends: cdbs, autotools-dev, devscripts, debhelper (>= 9~), dh-buildinfo, libxml2-dev, libxslt1-dev, libgd-dev (>= 2.1), libavcodec-dev, libavutil-dev, libavformat-dev, libswscale-dev, dpkg-dev (>= 1.16.1~) Standards-Version: 3.9.4 Vcs-Git: git://anonscm.debian.org/pkg-multimedia/shotdetect.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-multimedia/shotdetect.git Homepage: http://shotdetect.nonutc.fr/ Package: shotdetect Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: scene change detector Shotdetect is a software which is able to detect shots and scenes in a movie. . The result produced is a simple XML file containing scenes boundary and features. It is also possible to automatically get scenes boundary shots.debian/rules0000775000000000000000000000123012210637372010247 0ustar #!/usr/bin/make -f export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_CFLAGS_MAINT_APPEND = -Wall include /usr/share/dpkg/buildflags.mk include /usr/share/cdbs/1/rules/upstream-tarball.mk include /usr/share/cdbs/1/rules/utils.mk include /usr/share/cdbs/1/class/autotools.mk include /usr/share/cdbs/1/rules/debhelper.mk DEB_TAR_SRCDIR := . DEB_INSTALL_DOCS_ALL := DEB_CONFIGURE_SCRIPT_ENV += LIBS="`xml2-config --libs`" CFLAGS="$$CFLAGS `xml2-config --cflags`" # Needed by upstream build process CDBS_BUILD_DEPENDS += , libxml2-dev, libxslt1-dev, libgd-dev (>= 2.1), libavcodec-dev, libavutil-dev, libavformat-dev, libswscale-dev, dpkg-dev (>= 1.16.1~) debian/control.in0000664000000000000000000000160412237555712011212 0ustar Source: shotdetect Section: video Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian Multimedia Maintainers Uploaders: Giulio Paci , Sebastian Ramacher Build-Depends: @cdbs@ Standards-Version: 3.9.4 Vcs-Git: git://anonscm.debian.org/pkg-multimedia/shotdetect.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-multimedia/shotdetect.git Homepage: http://shotdetect.nonutc.fr/ Package: shotdetect Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: scene change detector Shotdetect is a software which is able to detect shots and scenes in a movie. . The result produced is a simple XML file containing scenes boundary and features. It is also possible to automatically get scenes boundary shots.debian/watch0000664000000000000000000000016212210315711010211 0ustar version=3 http://shotdetect.nonutc.fr/releases/shotdetect[-_](\d[\d\.]+)\.(?:tar\.(?:gz|bz2|lzma|xz)|tgz|zip|txz) debian/patches/0000775000000000000000000000000012210315711010610 5ustar debian/patches/1006-label_xaxis_with_timecode.patch0000664000000000000000000000376412210315711017426 0ustar Description: label x-axis with timecode - Change grid-ticks to 10-second steps - Display video timecode on x-axis Author: Peter B. Forwarded: no Last-Update: 2013-08-10 --- a/src/graph.cpp +++ b/src/graph.cpp @@ -166,6 +166,13 @@ void graph::draw_canvas (gdImagePtr im, string title) { + int fps = 25; // TODO: read this from video + int tick_length; + bool is_second, is_minute, is_hour; + int hour, minute, second, frame; + char time[10]; + int frames; + gdImageString (im, gdFontGetLarge (), im->sx / 2 - (title.size () * gdFontGetLarge ()->w / 2), 10, (unsigned char *) title.c_str (), grid_color); // Y-axis @@ -181,10 +188,42 @@ // X-axis gdImageLine (im, xoffset, xaxis_offset, xsize - xoffset, xaxis_offset, grid_color); - for (int i = xoffset; i < xsize - xoffset; i++) { - if (!(i % grid_size)) { - gdImageLine (im, i, xaxis_offset - 2, i, xaxis_offset + 2, grid_color); - } + for (int x = xoffset; x < xsize - xoffset; x++) { + // Calculate video position information: + frames = x - xoffset + 1; + frame = (frames % fps); + is_second = !frame; + is_minute = false; + is_hour = false; + + tick_length = 2; + if (is_second) { + second = (frames / fps) % 60; + minute = (frames / fps / 60) % 60; + hour = (int)(frames / fps / 60 / 60); + + is_minute = !second; + is_hour = !minute; + + // Do something special every 10th second: + if (!(second % 10)) { + tick_length = 10; + + // Write video position as grid label: + //printf("%d:%02d:%02d.%02d\n", hour, minute, second, frame); + sprintf(time, "%d:%02d:%02d.%02d", hour, minute, second, frame); + + gdImageString (im, + gdFontGetLarge(), + x - (strlen(time) * gdFontGetLarge()->w / 2), + xaxis_offset + 8, + (unsigned char *) time, + grid_color + ); + } + + gdImageLine (im, x, xaxis_offset - 1, x, xaxis_offset + tick_length, grid_color); + } } } debian/patches/1004-fix_comments_and_names.patch0000664000000000000000000003122012210315711016711 0ustar Description: Fix comments, typos and contact references. Author: Peter B. Forwarded: no Last-Update: 2013-08-10 --- a/include/config.h +++ b/include/config.h @@ -5,7 +5,7 @@ #define PACKAGE "shotdetect" /* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "johan.mathe@tremplin-utc.fr" +#define PACKAGE_BUGREPORT "johmathe@google.com" /* Define to the full name of this package. */ #define PACKAGE_NAME "film.cpp" --- a/include/film.h +++ b/include/film.h @@ -54,13 +54,13 @@ { private: - /* Variables d'état */ + /* Variables for state keeping */ bool first_img_set; - bool last_img_set ; + bool last_img_set; bool audio_set; bool video_set; bool thumb_set; - bool shot_set ; + bool shot_set; unsigned int ech; signed short int minright; @@ -142,9 +142,9 @@ list < shot > shots; /* Prev Score in compare_frame */ int prev_score; - /* id du plan en cours de traitement */ + /* Plan ID */ int id_plan; - /* Seuil de traitement */ + /* Threshold value */ int threshold; /* Absolute path of the media */ string global_path; @@ -154,13 +154,13 @@ xml *x; int process (); - /* Constructeur */ + /* Constructor */ film (); void process_audio (); void shotlog(string message); void create_main_dir(void); - /* Accesseurs */ + /* Accessors */ inline void set_first_img(bool val) {this->first_img_set = val; }; inline void set_last_img(bool val) {this->last_img_set = val; }; inline void set_audio(bool val) {this->audio_set = val; }; --- a/include/graph.h +++ b/include/graph.h @@ -40,7 +40,7 @@ private: -/* Données de fonctionnement internes */ + /* Internal graph data */ gdImagePtr im_colors; gdImagePtr im_qte_mvmt; gdImagePtr im_hsv; @@ -63,7 +63,7 @@ int grid_size; - int threseold; + int threshold; int color; int bgcolor; @@ -74,16 +74,16 @@ int xaxis_offset; bool grid; int ptr; - /* Descripteurs de fichiers pour les graphes */ + /* Graph filenames */ FILE *fdqte_mvmt; FILE *fdgraph_colors; FILE *fdgraph_hsv; - /* Descriptuers de ficheirs pour le XML */ + /* XML filenames */ FILE *fd_xml; FILE *fdcsv; film *f; vector < dataframe > data; -/* Couleurs */ + /* Colors */ int line_color; int background_color; int title_color; @@ -94,7 +94,7 @@ int red_color; int green_color; int blue_color; - int threseold_color; + int threshold_color; void draw_canvas (gdImagePtr im, string title); float MAX(float a, float b, float c); float MIN(float a, float b, float c); @@ -113,8 +113,8 @@ void write_xml(string filename); void set_title (string); ~graph (); - graph (int x, int y, string filename,int threseold, film *farg); - graph (int threseold, film *farg); + graph (int x, int y, string filename,int threshold, film *farg); + graph (int threshold, film *farg); inline void push_data (int val) { dataframe frame; --- a/include/shot.h +++ b/include/shot.h @@ -15,15 +15,15 @@ public: int myid; - /* Duration in frame */ + /* Duration in frames */ unsigned int fduration; /* Starting point (frame) */ unsigned int fbegin; /* Duration in ms */ double msduration; - /* Beggining en ms */ + /* Beginning in ms */ double msbegin; - /* img */ + /* images */ image *img_begin; image *img_end; shot (); --- a/src/film.cpp +++ b/src/film.cpp @@ -84,7 +84,7 @@ int nbpx = (height * width); /* - * On se ramene à la moyenne + * Reset values back to average */ score /= nbpx; c1tot /= nbpx; @@ -93,7 +93,7 @@ /* - * Derivee numerique + * Subtract score numbers to measure amount of image change */ diff = abs (score - prev_score); prev_score = score; @@ -328,7 +328,7 @@ checknumber = (samplerate * samplearg) / 1000; /* - * Boucle de traitement principale du flux + * Main processing loop */ this->frame_number = 0; while (av_read_frame (pFormatCtx, &packet) >= 0) @@ -386,7 +386,7 @@ else { /* - * Cas ou c'est la premiere image, on cree la premiere image dans tous les cas + * To avoid that there is no first image, we always create the first image: */ image *begin_i = new image (this, width, height, s.myid, BEGIN); begin_i->create_img_dir (); @@ -409,7 +409,7 @@ if (videoStream != -1) { - /* Mise en place de la dernière image */ + /* Save the last frame image */ int lastFrame = this->frame_number; shots.back ().fduration = lastFrame - shots.back ().fbegin; shots.back ().msduration = int (((shots.back ().fduration) * 1000) / fps); @@ -419,7 +419,7 @@ shots.back ().img_end = end_i; /* - * Graphe de la qté de mvmt + * Graph: Quantity of movement */ g->init_gd (); g->draw_all_canvas (); @@ -447,7 +447,7 @@ */ if (audioStream != -1) { - /* Fermetrure du fichier xml */ + /* Close the XML file */ if (audio_set) close_xml (); avcodec_close (pCodecCtxAudio); } @@ -519,7 +519,7 @@ { sample_right = *((signed short int *) (audio_buf + i)); /* - * Si un seul canal, le sample droit = sample gauche + * If there's only 1 channel, set sample_right=sample_left */ if (pCodecCtxAudio->channels >= 1) sample_left = *((signed short int *) (audio_buf + i + 2)); @@ -527,7 +527,7 @@ sample_left = sample_right; /* - * extraction des minimas et maximas + * Extract minima and maxima */ if (minright > sample_right) minright = sample_right; --- a/src/graph.cpp +++ b/src/graph.cpp @@ -56,7 +56,7 @@ this->yoffset = 10; this->size_graduation = 3; this->grid_size = 10; - this->threseold = th; + this->threshold = th; this->global_path = path; string csvpath = f->get_opath() + "/motion.csv" ; printf("%s\n",csvpath.c_str()); @@ -103,7 +103,7 @@ line_color = gdImageColorAllocate (im_qte_mvmt, 0, 0, 0); title_color = gdImageColorAllocate (im_qte_mvmt, 255, 255, 0); grid_color = gdImageColorAllocate (im_qte_mvmt, 0, 0, 0); - threseold_color = gdImageColorAllocate (im_qte_mvmt, 255, 0, 0); + threshold_color = gdImageColorAllocate (im_qte_mvmt, 255, 0, 0); // Declare color indexes for the color graph @@ -131,7 +131,7 @@ { int back_true_color; - string str = "Couleurs"; + string str = "RGB color values"; draw_canvas (im_colors, str); str = "Motion quantity"; draw_canvas (im_qte_mvmt, str); @@ -144,17 +144,17 @@ string title = "Color in function of time"; gdImageString (im_hsv, gdFontGetLarge (), im_hsv->sx / 2 - (title.size () * gdFontGetLarge ()->w / 2), 10, (unsigned char *) title.c_str (), grid_true_color); - // Yaxis + // Y-axis gdImageLine (im_hsv, xoffset, yoffset, xoffset, ysize - yoffset, grid_true_color); - // graduation + // Grid for (int i = yoffset; i < ysize - yoffset; i++) { if (!(i % grid_size)) { gdImageLine (im_hsv, xoffset - 2, i, xoffset + 2, i, grid_true_color); } } - // Xaxis + // X-axis gdImageLine (im_hsv, xoffset, xaxis_offset, xsize - xoffset, xaxis_offset, grid_color); for (int i = xoffset; i < xsize - xoffset; i++) { @@ -168,17 +168,17 @@ { gdImageString (im, gdFontGetLarge (), im->sx / 2 - (title.size () * gdFontGetLarge ()->w / 2), 10, (unsigned char *) title.c_str (), grid_color); - // Yaxis + // Y-axis gdImageLine (im, xoffset, yoffset, xoffset, ysize - yoffset, grid_color); - // graduation + // Grid for (int i = yoffset; i < ysize - yoffset; i++) { if (!(i % grid_size)) { gdImageLine (im, xoffset - 2, i, xoffset + 2, i, grid_color); } } - // Xaxis + // X-axis gdImageLine (im, xoffset, xaxis_offset, xsize - xoffset, xaxis_offset, grid_color); for (int i = xoffset; i < xsize - xoffset; i++) { @@ -198,8 +198,8 @@ fprintf(fdcsv,"%d,",data[i].global); } - // Display thresold - gdImageLine (im_qte_mvmt, xoffset, xaxis_offset - threseold, xsize - xoffset, xaxis_offset - threseold, threseold_color); + // Display threshold + gdImageLine (im_qte_mvmt, xoffset, xaxis_offset - threshold, xsize - xoffset, xaxis_offset - threshold, threshold_color); } @@ -280,7 +280,7 @@ } if (r == max) - *h = (g - b) / delta; // between yellow & magenta + *h = (g - b) / delta; // between yellow & magenta else if (g == max) *h = 2 + (b - r) / delta; // between cyan & yellow else --- a/src/image.cpp +++ b/src/image.cpp @@ -121,7 +121,7 @@ if (f->get_thumb()) { - /* Nom de l'image */ + /* Name the images */ str.str (""); if (this->type == BEGIN) str << "/thumbs/" << id << "_in.jpg"; @@ -131,7 +131,7 @@ str.str (""); str << f->global_path << "/" << thumb; - /* Mise en place du fichier */ + /* Store the image file */ if ((minijpgout = fopen (str.str ().c_str (), "wb")) == NULL) { cerr << str.str () << endl; @@ -145,7 +145,7 @@ if (f->get_shot()) { - /* Nom de l'image */ + /* Name the images */ str.str (""); if (this->type == BEGIN) str << "/shots/" << id << "_in.jpg"; @@ -155,7 +155,7 @@ str.str (""); str << f->global_path << "/" << img; - /* Mise en place du fichier */ + /* Store the image file */ if ((jpgout = fopen (str.str ().c_str (), "wb")) == NULL) { cerr << "shot log ::" << str.str () << endl; --- a/src/main.cpp +++ b/src/main.cpp @@ -24,7 +24,7 @@ show_help (char **argv) { printf ("usage: %s \n" - "Shotdetect (IRI - johmathe - $Id: main.cpp 164 2007-10-13 23:53:21Z johmathe $)\n" + "Shotdetect 1.0.86.1, Copyright (c) 2007-2013 Johan Mathe (Centre Pompidou - IRI)\n\n" "-h : show this help\n" "-i file : input file path\n" "-o path : output path\n" @@ -34,7 +34,8 @@ "-f : generate first img for each shot\n" "-l : generate last img for each shot\n" "-m : generate the thumb img\n" - "-r : generate the real img\n", argv[0]); + "-r : generate the real img\n" + "\n", argv[0]); } @@ -68,7 +69,7 @@ exit (EXIT_SUCCESS); break; - /* choix des thumbs */ + /* Options for images */ case 'f': f.set_first_img(true); break; @@ -77,27 +78,27 @@ f.set_last_img(true); break; - /* generer l'image en resolution native */ + /* Store images in their native resolution */ case 'r': f.set_shot(true); break; - /* generer l'image en miniature */ + /* Create smaller resized images (thumbnails) */ case 'm': f.set_thumb(true); break; - /* generer le xml pour les donnees video */ + /* Create XML file for video */ case 'v': f.set_video(true); break; - /* generer le xml pour les donnees audio */ + /* Create XML file for audio */ case 'w': f.set_audio(true) ; break; - /* Seuil */ + /* Threshold */ case 's': f.set_threshold(atoi (optarg)); break; @@ -116,7 +117,7 @@ } - /* Traitement des erreurs */ + /* Treatment of errors: */ if (f.get_ipath().empty()) { cerr << "Please specify an input file" << endl; --- a/src/xml.cpp +++ b/src/xml.cpp @@ -136,7 +136,7 @@ xmlTextWriterStartElement (writer, BAD_CAST "body"); xmlTextWriterStartElement (writer, BAD_CAST "shots"); - /* Mise en place des elements shots */ + /* Write shot elements into XML */ for (il = f->shots.begin (); il != f->shots.end (); il++) { strflx.str (""); debian/patches/1005-add_framenumber_to_filename.patch0000664000000000000000000000661012210315711017674 0ustar Description: add frame number to image filenames Author: Peter B. Forwarded: no Last-Update: 2013-08-10 --- a/include/image.h +++ b/include/image.h @@ -54,7 +54,7 @@ string img; int id; bool type; // BEGIN || END - int SaveFrame (AVFrame * pFrame); + int SaveFrame (AVFrame * pFrame, int frame_number); int create_img_dir (); image (film *, int, int, int, bool); }; --- a/src/film.cpp +++ b/src/film.cpp @@ -53,6 +53,7 @@ int y; int x; int diff; + int frame_number = pCodecCtx->frame_number; char c1, c2, c3; int c1tot, c2tot, c3tot; c1tot = 0; @@ -123,13 +124,13 @@ if (this->first_img_set) { image *im_begin = new image (this, width, height, s.myid, BEGIN); - im_begin->SaveFrame (pFrame); + im_begin->SaveFrame (pFrame, frame_number); s.img_begin = im_begin; } if (this->last_img_set) { image *im_end = new image (this, width, height, s.myid - 1, END); - im_end->SaveFrame (pFramePrev); + im_end->SaveFrame (pFramePrev, frame_number); shots.back ().img_end = im_end; } shots.push_back (s); @@ -390,7 +391,7 @@ */ image *begin_i = new image (this, width, height, s.myid, BEGIN); begin_i->create_img_dir (); - begin_i->SaveFrame (pFrameRGB); + begin_i->SaveFrame (pFrameRGB, frame_number); shots.back ().img_begin = begin_i; } memcpy (buffer2, buffer, numBytes); @@ -414,9 +415,13 @@ shots.back ().fduration = lastFrame - shots.back ().fbegin; shots.back ().msduration = int (((shots.back ().fduration) * 1000) / fps); duration.mstotal = int (shots.back ().msduration + shots.back ().msbegin); + + if (this->last_img_set) + { image *end_i = new image (this, width, height, shots.back ().myid, END); - end_i->SaveFrame (pFrameRGB); - shots.back ().img_end = end_i; + end_i->SaveFrame (pFrameRGB, frame_number); + shots.back ().img_end = end_i; + } /* * Graph: Quantity of movement --- a/src/image.cpp +++ b/src/image.cpp @@ -69,7 +69,7 @@ } int -image::SaveFrame (AVFrame * pFrame) +image::SaveFrame (AVFrame * pFrame, int frame_number) { // c->thumb_height remplacé par 84 int width_s = (THUMB_HEIGHT * this->width) / this->height; @@ -116,17 +116,24 @@ } + /* Pad numbers to constant string width: */ + char s_id[6]; + char s_frame_number[9]; - /* Creating file and saving it */ - if (f->get_thumb()) + sprintf(s_id, "%05d", id); + sprintf(s_frame_number, "%06d", frame_number); + + + /* Creating file and saving it */ + if (f->get_thumb()) { /* Name the images */ str.str (""); if (this->type == BEGIN) - str << "/thumbs/" << id << "_in.jpg"; + str << "/thumbs/" << s_id << "-" << s_frame_number << "_in.jpg"; else - str << "/thumbs/" << id << "_out.jpg"; + str << "/thumbs/" << s_id << "-" << s_frame_number << "_out.jpg"; thumb = str.str (); str.str (""); str << f->global_path << "/" << thumb; @@ -148,9 +155,9 @@ /* Name the images */ str.str (""); if (this->type == BEGIN) - str << "/shots/" << id << "_in.jpg"; + str << "/shots/" << s_id << "-" << s_frame_number << "_in.jpg"; else - str << "/shots/" << id << "_out.jpg"; + str << "/shots/" << s_id << "-" << s_frame_number << "_out.jpg"; img = str.str (); str.str (""); str << f->global_path << "/" << img; debian/patches/1001-compilation_fixes.patch0000664000000000000000000000450712210315711015732 0ustar Description: compilation fixes This patch fix issues that prevent the compilation steps to complete, including gcc and packaging errors. Author: Giulio Paci Forwarded: no Last-Update: 2012-03-02 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/include/film.h +++ b/include/film.h @@ -18,8 +18,8 @@ extern "C" { -#include -#include +#include +#include } --- a/include/image.h +++ b/include/image.h @@ -16,8 +16,8 @@ #include extern "C" { -#include -#include +#include +#include } #include --- a/src/film.cpp +++ b/src/film.cpp @@ -18,7 +18,7 @@ #include "film.h" #include "graph.h" extern "C" { -#include +#include } #define DEBUG @@ -239,11 +239,11 @@ { switch (pFormatCtx->streams[j]->codec->codec_type) { - case CODEC_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: videoStream = j; break; - case CODEC_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: audioStream = j; break; @@ -334,7 +334,15 @@ { if (packet.stream_index == videoStream) { - avcodec_decode_video (pCodecCtx, pFrame, &frameFinished, packet.data, packet.size); + AVPacket avpkt; + av_init_packet(&avpkt); + avpkt.data = packet.data; + avpkt.size = packet.size; + // + // HACK for CorePNG to decode as normal PNG by default + // same method used by ffmpeg + avpkt.flags = AV_PKT_FLAG_KEY; + avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &avpkt); if (frameFinished) { @@ -448,7 +456,7 @@ */ av_close_input_file (pFormatCtx); - + return 0; } void @@ -479,11 +487,15 @@ ptr = packet.data; len = packet.size; + AVPacket avpkt; + av_init_packet(&avpkt); while (len > 0) { this->audio_buf = (short *) av_fast_realloc (this->audio_buf, &samples_size, FFMAX (packet.size, AVCODEC_MAX_AUDIO_FRAME_SIZE)); data_size = samples_size; - len1 = avcodec_decode_audio2 (pCodecCtxAudio, audio_buf, &data_size, ptr, len); + avpkt.data = ptr; + avpkt.size = len; + len1 = avcodec_decode_audio3 (pCodecCtxAudio, audio_buf, &data_size, &avpkt); if (len1 < 0) debian/patches/1003-fix-FTBFS-ffmpeg_1.0.x.patch0000664000000000000000000000053212210315711015730 0ustar Description: Fix FTBFS with ffmpeg 1.0.x by replacing deprecated functions Author: Peter B. Forwarded: no Last-Update: 2013-08-10 --- a/src/film.cpp +++ b/src/film.cpp @@ -455,7 +455,7 @@ /* * Close the video file */ - av_close_input_file (pFormatCtx); + avformat_close_input (&pFormatCtx); return 0; } debian/patches/1002-fix-FTBFS-libav0.9.patch0000664000000000000000000000233612210315711015167 0ustar Description: Fix FTBFS with libav 0.9 by replacing deprecated functions Author: Fabrice Coutadeur --- a/src/film.cpp +++ b/src/film.cpp @@ -212,7 +212,8 @@ */ av_register_all (); - if (av_open_input_file (&pFormatCtx, input_path.c_str (), NULL, 0, NULL) != 0) + if( ! ( pFormatCtx = avformat_alloc_context() ) + || (avformat_open_input (&pFormatCtx, input_path.c_str (), NULL, NULL) != 0) ) { string error_msg = "Impossible to open file"; error_msg += input_path; @@ -223,7 +224,7 @@ /* * Retrieve stream information */ - if (av_find_stream_info (pFormatCtx) < 0) + if (avformat_find_stream_info (pFormatCtx, NULL) < 0) return -1; // Couldn't find stream information @@ -270,7 +271,7 @@ if (pCodecAudio == NULL) return -1; // Codec not found - if (avcodec_open (pCodecCtxAudio, pCodecAudio) < 0) + if (avcodec_open2 (pCodecCtxAudio, pCodecAudio, NULL) < 0) return -1; // Could not open codec } @@ -285,7 +286,7 @@ if (pCodec == NULL) return -1; // Codec not found - if (avcodec_open (pCodecCtx, pCodec) < 0) + if (avcodec_open2 (pCodecCtx, pCodec, NULL) < 0) return -1; // Could not open codec /* debian/patches/series0000664000000000000000000000020012210315711012015 0ustar 1001-compilation_fixes.patch 1002-fix-FTBFS-libav0.9.patch 1003-fix-FTBFS-ffmpeg_1.0.x.patch 1004-fix_comments_and_names.patch debian/compat0000664000000000000000000000000212210315711010357 0ustar 9