Comskip for Linux released

  Thread Rating:
  • 6 Votes - 4.17 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
cbxbiker61 Offline
Senior Member
Posts: 183
Joined: Nov 2010
Reputation: 2
Post: #1
Current version is 0.93i.

I've just put comskip 0.91 (now 0.93) for Linux online. I'm in the process of converting it over to fully object oriented C++11. I plan to complete the conversion to C++11 by the 1.00 release.

0.93i is more tolerant to damaged input files.

0.93h eliminates warnings when building with ffmpeg 2.2+.

0.93g fixes segfault when no video codec is found (damaged video file).

0.93f changes deprecated parameters for ffmpeg 2.1+.

0.93e fixes an error in floating point audio handling.
This version also works with the recently released ffmpeg 2.0.

0.93c fixed a minor warning with gcc 4.8.1+.

0.93b works with s16p audio input.

0.93a should fix a segfault when using live_tv=1.

0.93 removes the MAXWIDTH and MAXHEIGHT restrictions. It is now more memory efficient when processing video that is less than 1920x1080.

0.92r is a quick fix for some bounds errors that some users have experienced.

0.92q replaces some questionable macros with c++ template code which make debugging easier. Even more bounds checking enabled which is enabled by default.

0.92p fixes a potential indexing error and adds a bit more bounds checking.

0.92o fixes memory leaks and also fixes variable framerate encoded video processing.

0.92k reduces the runtime memory requirement.

0.92g fixes the mkv_time_offset, it was inadvertently being added to the offset when running against .ts. It also fixes an out of range problem that was causing a segfault on armv7 systems. I've now compiled and tested on an armv7 system and am quite satisfied that the results match the x86_64 results.

0.92f works with FFmpeg 1.1+.

0.92d fixes the generation of .csv files. The conversion to C++11 continues...

0.91e fixes a segfault on media files with faulty audio streams.

The 0.91d version adds two new config options in comskip.ini.

edl_mode=0 ; the mode specified in the generated edl file, 0=cut, 3=commercial break
mkv_time_offset=30.0 ; offset in seconds, to work around what appears to be an xbmc or ffmpeg bug

http://www.xilka.com/xilka/source/comskip-0.93i.tar.xz

It requires ffmpeg 0.9 or greater and argtable2.

If your system ffmpeg is 0.9 or greater building is as simple as:
Code:
cd /var/tmp
mkdir ComSkipWork
wget http://www.xilka.com/xilka/source/comskip-0.93i.tar.xz
tar xf comskip-0.93i.tar.xz
cd comskip-0.93i
./configure --prefix=/usr
make -j8
sudo make install

If your system ffmpeg is older than 0.9:
Code:
cd /var/tmp
mkdir ComSkipWork
wget http://ffmpeg.org/releases/ffmpeg-2.2.tar.bz2
tar xf ffmpeg-2.2.tar.bz2
cd ffmpeg-2.2
./configure --prefix=/var/tmp/ComSkipWork/install
make -j8
make install
cd ..
wget http://www.xilka.com/xilka/source/comskip-0.93i.tar.xz
tar xf comskip-0.93i.tar.xz
cd comskip-0.93i
PKG_CONFIG_PATH=/var/tmp/ComSkipWork/install/lib/pkgconfig ./configure --prefix=/usr
make -j8
sudo make install

If you system argtable2 doesn't work...
Code:
1. download the latest argtable2
2. extract it into it's own subdirectory
3. ./configure --prefix=/var/tmp/ComSkipWork/install
4. make -j8
5. make install

Then to build comskip add /var/tmp/ComSkipWork/install/lib/pkgconfig to the
PKG_CONFIG_PATH just as you would for an static ffmpeg
(man pkg-config for additional info).

It installs config files in /etc/comskip.

Once installed it's as easy as running "comskip filename.ts" or "comskip filename.mkv". Note that this version does support mkv files which the windows version doesn't.

Here is the post processing script that I use.[/code]

Code:
#! /usr/bin/bash

INPUTVIDEO="$1"  # Full path to recording, i.e. /home/user/Videos/News.ts

if [[ $1 == *.ts ]]; then
    BASENAME=`/usr/bin/basename $INPUTVIDEO .ts`
elif [[ $1 == *.mkv ]]; then
    BASENAME=`/usr/bin/basename $INPUTVIDEO .mkv`
else
    exit 0
fi

DIRNAME=`/usr/bin/dirname $INPUTVIDEO`
EDLFILE="$DIRNAME/$BASENAME.edl"
LOGFILE="$DIRNAME/$BASENAME.log"
TXTFILE="$DIRNAME/$BASENAME.txt"
LOGOFILE="$DIRNAME/$BASENAME.logo.txt"
COMSKIPPATH="/home/hts/comskip/comskip.exe"
COMSKIPLOGS="/home/hts/comskip/logs/"

# not using these in the script yet, if ever
if false; then
c=$3        #Channel name                    BBC world
C=$4        #Who created this recording            user
t=$5        #Program title                    News
d=$6        #Program description                News and stories...
S=$7        #Start time stamp of recording, UNIX epoch    1224421200
E=$8        #Stop time stamp of recording, UNIX epoch    1224426600
fi

function ClearLog()
{
    echo "*****" >/tmp/tvheadendpp$$.log
    echo "***** INPUT = $INPUTVIDEO *****" >>/tmp/tvheadendpp$$.log
    echo "*****" >>/tmp/tvheadendpp$$.log
}

function FlagCommercials()
{
    chmod 644 $INPUTVIDEO
    echo "Starting Commercial Flagging" >>/tmp/tvheadendpp$$.log
    echo "*****" >>/tmp/tvheadendpp$$.log
    echo "***** OUTPUT = "$EDLFILE" *****" >>/tmp/tvheadendpp$$.log
    echo "*****" >>/tmp/tvheadendpp$$.log
    /usr/bin/whoami >>/tmp/tvheadendpp$$.log    # for debugging purposes, who is running this script?
    /usr/bin/date >>/tmp/tvheadendpp$$.log
    echo "*****" >>/tmp/tvheadendpp$$.log
    echo "*****" >>/tmp/tvheadendpp$$.log

    /usr/bin/comskip -t "$INPUTVIDEO" 2>&1 </dev/null >>/tmp/tvheadendpp$$.log

    echo "*****" >>/tmp/tvheadendpp$$.log
    echo "*****" >>/tmp/tvheadendpp$$.log

    [[ ! -f $LOGFILE ]] || /usr/bin/mv "$LOGFILE" $COMSKIPLOGS
    [[ ! -f $TXTFILE ]] || /usr/bin/mv "$TXTFILE" $COMSKIPLOGS
    [[ ! -f $LOGOFILE ]] || /usr/bin/mv "$LOGOFILE" $COMSKIPLOGS

    echo "EDL for $INPUTVIDEO:" >>/tmp/tvheadendpp$$.log
}

ClearLog
FlagCommercials

echo "Finished at `/usr/bin/date`" >>/tmp/tvheadendpp$$.log
(This post was last modified: 2014-11-13 11:58 by cbxbiker61.)
find quote
Prof Yaffle Offline
Donor
Posts: 1,188
Joined: Mar 2011
Reputation: 28
Location: UK - in the middlish (mostly).
Post: #2
I expected a sea of "wow, great, thanks" here, but apparently not. You'll have to accept my "wow, great, thanks" instead, then!

However - no luck compiling this on Ubuntu Oneiric 11.10.

I had to install some dependencies as you pointed out, viz. ffmpeg and argtable2 (lib-argtable2-0, in fact) - but also libavformat-dev because of various complaints.

Anyway, ./configure seems to work okay, but compilation fails:

Code:
xbmc@revo:~/comskip-0.91$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for gawk... (cached) gawk
checking how to run the C preprocessor... gcc -E
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for ANSI C header files... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking whether g++ supports C++11 features by default... no
checking whether g++ supports C++11 features with -std=gnu++11... no
checking whether g++ supports C++11 features with -std=gnu++0x... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking whether lstat correctly handles trailing slash... yes
checking whether stat accepts an empty string... no
checking for memset... yes
checking for strerror... yes
checking for avcodec_close in -lavcodec... yes
checking for avformat_open_input in -lavformat... yes
checking for av_log_set_level in -lavutil... yes
checking for arg_lit0 in -largtable2... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands

Code:
xbmc@revo:~/comskip-0.91$ make
make  all-am
make[1]: Entering directory `/home/xbmc/comskip-0.91'
g++ -DHAVE_CONFIG_H -I.     -g -O2 -std=gnu++0x -MT comskip-mpeg2dec.o -MD -MP -MF .deps/comskip-mpeg2dec.Tpo -c -o comskip-mpeg2dec.o `test -f 'mpeg2dec.cpp' || echo './'`mpeg2dec.cpp
In file included from comskip.h:28:0,
                 from mpeg2dec.cpp:66:
BlackFrame.h: In constructor âCS::BlackFrame::BlackFrame()â:
BlackFrame.h:13:5: error: type âCS::BlackFrameâ is not a direct base of âCS::BlackFrameâ
BlackFrame.h: In copy constructor âCS::BlackFrame::BlackFrame(const CS::BlackFrame&)â:
BlackFrame.h:16:5: error: type âCS::BlackFrameâ is not a direct base of âCS::BlackFrameâ
mpeg2dec.cpp: In function âvoid decodeOnePicture(FILE*, double, CS::CommercialSkipper*)â:
mpeg2dec.cpp:1037:50: warning: âAVInputFormat::read_seekâ is deprecated (declared at /usr/include/libavformat/avformat.h:390) [-Wdeprecated-declarations]
mpeg2dec.cpp:1037:50: warning: âAVInputFormat::read_seekâ is deprecated (declared at /usr/include/libavformat/avformat.h:390) [-Wdeprecated-declarations]
mpeg2dec.cpp: In function âbool {anonymous}::video_packet_process({anonymous}::VideoState*, AVPacket*)â:
mpeg2dec.cpp:1177:74: error: âavcodec_get_frame_classâ was not declared in this scope
mpeg2dec.cpp:1177:112: error: âav_opt_ptrâ was not declared in this scope
mpeg2dec.cpp: In function âvoid {anonymous}::file_close()â:
mpeg2dec.cpp:1582:38: error: âavformat_close_inputâ was not declared in this scope
mpeg2dec.cpp: In function âint main(int, char**)â:
mpeg2dec.cpp:1781:37: warning: âAVInputFormat::read_seekâ is deprecated (declared at /usr/include/libavformat/avformat.h:390) [-Wdeprecated-declarations]
mpeg2dec.cpp:1781:37: warning: âAVInputFormat::read_seekâ is deprecated (declared at /usr/include/libavformat/avformat.h:390) [-Wdeprecated-declarations]
make[1]: *** [comskip-mpeg2dec.o] Error 1
make[1]: Leaving directory `/home/xbmc/comskip-0.91'
make: *** [all] Error 2
xbmc@revo:~/comskip-0.91$

I looked up the errors to see if I could trace the error in BlackFrame.h, but I've tied myself in knots with inheritance, non-hierarchical class definitions and virtual base classes, so my head hurts now ...
find quote
cbxbiker61 Offline
Senior Member
Posts: 183
Joined: Nov 2010
Reputation: 2
Post: #3
(2012-12-31 14:23)Prof Yaffle Wrote:  I expected a sea of "wow, great, thanks" here, but apparently not. You'll have to accept my "wow, great, thanks" instead, then!

However - no luck compiling this on Ubuntu Oneiric 11.10.

I had to install some dependencies as you pointed out, viz. ffmpeg and argtable2 (lib-argtable2-0, in fact) - but also libavformat-dev because of various complaints.

Anyway, ./configure seems to work okay, but compilation fails:

Code:
xbmc@revo:~/comskip-0.91$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for gawk... (cached) gawk
checking how to run the C preprocessor... gcc -E
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for ANSI C header files... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking whether g++ supports C++11 features by default... no
checking whether g++ supports C++11 features with -std=gnu++11... no
checking whether g++ supports C++11 features with -std=gnu++0x... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking whether lstat correctly handles trailing slash... yes
checking whether stat accepts an empty string... no
checking for memset... yes
checking for strerror... yes
checking for avcodec_close in -lavcodec... yes
checking for avformat_open_input in -lavformat... yes
checking for av_log_set_level in -lavutil... yes
checking for arg_lit0 in -largtable2... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands

Code:
xbmc@revo:~/comskip-0.91$ make
make  all-am
make[1]: Entering directory `/home/xbmc/comskip-0.91'
g++ -DHAVE_CONFIG_H -I.     -g -O2 -std=gnu++0x -MT comskip-mpeg2dec.o -MD -MP -MF .deps/comskip-mpeg2dec.Tpo -c -o comskip-mpeg2dec.o `test -f 'mpeg2dec.cpp' || echo './'`mpeg2dec.cpp
In file included from comskip.h:28:0,
                 from mpeg2dec.cpp:66:
BlackFrame.h: In constructor âCS::BlackFrame::BlackFrame()â:
BlackFrame.h:13:5: error: type âCS::BlackFrameâ is not a direct base of âCS::BlackFrameâ
BlackFrame.h: In copy constructor âCS::BlackFrame::BlackFrame(const CS::BlackFrame&)â:
BlackFrame.h:16:5: error: type âCS::BlackFrameâ is not a direct base of âCS::BlackFrameâ
mpeg2dec.cpp: In function âvoid decodeOnePicture(FILE*, double, CS::CommercialSkipper*)â:
mpeg2dec.cpp:1037:50: warning: âAVInputFormat::read_seekâ is deprecated (declared at /usr/include/libavformat/avformat.h:390) [-Wdeprecated-declarations]
mpeg2dec.cpp:1037:50: warning: âAVInputFormat::read_seekâ is deprecated (declared at /usr/include/libavformat/avformat.h:390) [-Wdeprecated-declarations]
mpeg2dec.cpp: In function âbool {anonymous}::video_packet_process({anonymous}::VideoState*, AVPacket*)â:
mpeg2dec.cpp:1177:74: error: âavcodec_get_frame_classâ was not declared in this scope
mpeg2dec.cpp:1177:112: error: âav_opt_ptrâ was not declared in this scope
mpeg2dec.cpp: In function âvoid {anonymous}::file_close()â:
mpeg2dec.cpp:1582:38: error: âavformat_close_inputâ was not declared in this scope
mpeg2dec.cpp: In function âint main(int, char**)â:
mpeg2dec.cpp:1781:37: warning: âAVInputFormat::read_seekâ is deprecated (declared at /usr/include/libavformat/avformat.h:390) [-Wdeprecated-declarations]
mpeg2dec.cpp:1781:37: warning: âAVInputFormat::read_seekâ is deprecated (declared at /usr/include/libavformat/avformat.h:390) [-Wdeprecated-declarations]
make[1]: *** [comskip-mpeg2dec.o] Error 1
make[1]: Leaving directory `/home/xbmc/comskip-0.91'
make: *** [all] Error 2
xbmc@revo:~/comskip-0.91$

I looked up the errors to see if I could trace the error in BlackFrame.h, but I've tied myself in knots with inheritance, non-hierarchical class definitions and virtual base classes, so my head hurts now ...

OK, this is due to your compiler not fully supporting constructors that call constructors of the same class. It's a new C++11 feature. I'm using gcc 4.7.2 and I wasn't sure which compiler versions would be necessary to use that feature.

I'll put a bit of conditional code in there with an init function for some of the earlier gcc's. I don't want to entirely rip the new C++11 constructor code out, since in the long run it's a lot cleaner.

Please do me a favor and run "make -k 2>&1 | tee make.log" and post the make.log with your gcc version. There are probably a few other locations that will blow up on compilers that don't support some of the C++11 bits, that will allow me to see all of the problem areas.
(This post was last modified: 2012-12-31 14:55 by cbxbiker61.)
find quote
Prof Yaffle Offline
Donor
Posts: 1,188
Joined: Mar 2011
Reputation: 28
Location: UK - in the middlish (mostly).
Post: #4
Thanks. I'm on 4.6.1 - I'll look to see how I can upgrade as well, but you've a reference point at least in that this is the default version to ship with XBMCBuntu/Eden.
find quote
xxxnelly Offline
Senior Member
Posts: 195
Joined: Dec 2010
Reputation: 1
Post: #5
I had the same issue as Prof Yaffle - I hadn't got around to posting yet.

I have switched my server to the 4.7 gcc and I get this error. ( oh and it is great we can use this with tvheadend now... )


server@server:~/comskip-0.91$ sudo make
make all-am
make[1]: Entering directory `/home/server/comskip-0.91'
g++ -DHAVE_CONFIG_H -I. -g -O2 -std=gnu++11 -MT comskip-mpeg2dec.o -MD -MP -MF .deps/comskip-mpeg2dec.Tpo -c -o comskip-mpeg2dec.o `test -f 'mpeg2dec.cpp' || echo './'`mpeg2dec.cpp
mpeg2dec.cpp: In function ‘void {anonymous}::audio_packet_process({anonymous}::VideoState*, AVPacket*)’:
mpeg2dec.cpp:578:18: warning: ‘int avcodec_decode_audio3(AVCodecContext*, int16_t*, int*, AVPacket*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4131) [-Wdeprecated-declarations]
mpeg2dec.cpp:579:75: warning: ‘int avcodec_decode_audio3(AVCodecContext*, int16_t*, int*, AVPacket*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4131) [-Wdeprecated-declarations]
mpeg2dec.cpp: In function ‘bool {anonymous}::video_packet_process({anonymous}::VideoState*, AVPacket*)’:
mpeg2dec.cpp:1177:74: error: ‘avcodec_get_frame_class’ was not declared in this scope
mpeg2dec.cpp:1177:112: error: ‘av_opt_ptr’ was not declared in this scope
make[1]: *** [comskip-mpeg2dec.o] Error 1
make[1]: Leaving directory `/home/server/comskip-0.91'
make: *** [all] Error 2

--
Frontend : OpenELEC PVR runnig on Acer Revo 3700
Backend : Ubuntu 11.10 running with TVHeadend 1 x DVB-T, 1 x Dual DVB-S2
find quote
Prof Yaffle Offline
Donor
Posts: 1,188
Joined: Mar 2011
Reputation: 28
Location: UK - in the middlish (mostly).
Post: #6
We might be very version-dependent if cbxbiker61 is using specific C++11 constructs ... I installed gcc-snapshot (4.7.0) and am getting the same errors as I had under 4.6.1.

It is, of course, perfectly possible that I'm doing something hideously wrong, since I've simply wedged gcc-snapshot into my PATH before everything else. While config.log confirms that I'm picking up the 4.7.0 gcc/g++ binaries, that doesn't mean that I'm not missing something else in the proceedings.

I might have to sit back and wait for versions to catch up, or find a suitable 4.7.2 repository to force version currency.
find quote
menno Offline
Senior Member
Posts: 233
Joined: Jun 2009
Reputation: 0
Post: #7
Interesting stuff, I noticed that the original code is Dutch Smile
Anyway is the purpose of this to cut ads on the fly while recording, or do you aim to have it ran after the record is finished, and
thus as a post processing script in Tvheadend?

I thought something like this was already around, cause I thought scene rippers use this all the time. Nice stuff though and very interesting how it
actually works, with the video and audio analyzing!
find quote
cbxbiker61 Offline
Senior Member
Posts: 183
Joined: Nov 2010
Reputation: 2
Post: #8
(2012-12-31 15:09)xxxnelly Wrote:  I had the same issue as Prof Yaffle - I hadn't got around to posting yet.

I have switched my server to the 4.7 gcc and I get this error. ( oh and it is great we can use this with tvheadend now... )


server@server:~/comskip-0.91$ sudo make
make all-am
make[1]: Entering directory `/home/server/comskip-0.91'
g++ -DHAVE_CONFIG_H -I. -g -O2 -std=gnu++11 -MT comskip-mpeg2dec.o -MD -MP -MF .deps/comskip-mpeg2dec.Tpo -c -o comskip-mpeg2dec.o `test -f 'mpeg2dec.cpp' || echo './'`mpeg2dec.cpp
mpeg2dec.cpp: In function ‘void {anonymous}::audio_packet_process({anonymous}::VideoState*, AVPacket*)’:
mpeg2dec.cpp:578:18: warning: ‘int avcodec_decode_audio3(AVCodecContext*, int16_t*, int*, AVPacket*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4131) [-Wdeprecated-declarations]
mpeg2dec.cpp:579:75: warning: ‘int avcodec_decode_audio3(AVCodecContext*, int16_t*, int*, AVPacket*)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4131) [-Wdeprecated-declarations]
mpeg2dec.cpp: In function ‘bool {anonymous}::video_packet_process({anonymous}::VideoState*, AVPacket*)’:
mpeg2dec.cpp:1177:74: error: ‘avcodec_get_frame_class’ was not declared in this scope
mpeg2dec.cpp:1177:112: error: ‘av_opt_ptr’ was not declared in this scope
make[1]: *** [comskip-mpeg2dec.o] Error 1
make[1]: Leaving directory `/home/server/comskip-0.91'
make: *** [all] Error 2

I just did a review of older ffmpeg versions and avcodec_get_frame_class and av_opt_ptr exist all the way back to 0.9.x, declared in avcodec.h. I'm not sure if it had it prior to that. If you have one of those older versions, now would be a good time to update. Make sure it's not picking up an old version of avcodec.h by accident.

I've personally tested it with ffmpeg 0.11.x and 1.0.x versions.
find quote
Prof Yaffle Offline
Donor
Posts: 1,188
Joined: Mar 2011
Reputation: 28
Location: UK - in the middlish (mostly).
Post: #9
Sorry, just noticed the edit to cbxbiker61's last post.

gcc 4.6.1:

Code:
xbmc@revo:~/comskip-0.91$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6.1/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)

Log file: http://xbmclogs.com/show.php?id=25120


gcc 4.7.0 (as gcc-snapshot added to PATH as first entry):

Code:
xbmc@revo:~/comskip-0.91$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/i686-linux-gnu/4.7.0/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 20111010-0ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs --enable-languages=c,ada,c++,java,fortran,objc,obj-c++,go --prefix=/usr/lib/gcc-snapshot --enable-shared --enable-linker-build-id --with-system-zlib --disable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.7-snap/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.7-snap --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.7-snap --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=yes --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.7.0 20111010 (experimental) [trunk revision 179769] (Ubuntu/Linaro 20111010-0ubuntu1)

Log file: http://xbmclogs.com/show.php?id=25121

As I say, I could have all sorts of config issues with gcc-snapshot, so I wouldn't necessarily bet any kind of good money on the output from that!
find quote
cbxbiker61 Offline
Senior Member
Posts: 183
Joined: Nov 2010
Reputation: 2
Post: #10
(2012-12-31 15:48)menno Wrote:  Interesting stuff, I noticed that the original code is Dutch Smile
Anyway is the purpose of this to cut ads on the fly while recording, or do you aim to have it ran after the record is finished, and
thus as a post processing script in Tvheadend?

I thought something like this was already around, cause I thought scene rippers use this all the time. Nice stuff though and very interesting how it
actually works, with the video and audio analyzing!

It doesn't cut adds on-the-fly. Due to the way that logo checking happens, it first looks for a logo and then if it finds one it starts over from the beginning using the logo data. It would be pretty much impossible to do that on-the-fly.

On my FX-8350 it processes 1080p at about 200fps. Lower resolutions are processed much faster (700fps). Most of the time it seems like my video is processed in less than 7 minutes.

The code has also been cleaned up enough that it runs on Arm. I've run some tests on a CuBox and it does 1080p at about 20fps. So not real fast, but if you're not in a hurry it will work. It would take maybe and hour and 10 minutes to do an hours worth of video.
find quote
cbxbiker61 Offline
Senior Member
Posts: 183
Joined: Nov 2010
Reputation: 2
Post: #11
This version should fix the constructor issue on older gcc versions.

http://www.xilka.com/xilka/source/comskip-0.91b.tar.xz
(This post was last modified: 2012-12-31 16:51 by cbxbiker61.)
find quote
Prof Yaffle Offline
Donor
Posts: 1,188
Joined: Mar 2011
Reputation: 28
Location: UK - in the middlish (mostly).
Post: #12
(2012-12-31 15:55)cbxbiker61 Wrote:  I just did a review of older ffmpeg versions and avcodec_get_frame_class ... I've personally tested it with ffmpeg 0.11.x and 1.0.x versions.

We might get some ffmpeg challenges as well, then, unless this is included in much earlier versions.

The most recent compile from Ubuntu repositories for XBMCBuntu is 0.7.6-4:0.7.6-0ubuntu0.11.10.2 (built on Dec 18 2012 18:02:16 with gcc 4.6.1, apparently).

The most recent build from the ffmpeg PPA is seemingly 0.10.6. So it's build-it-yourself or a game of hunt-the-PPA for 0.11.x or later.

Let's not let that stop us, though :-)

Good news - yes, that version seems to plough through the declarations with no problem.

Bad news - there are still issues, perhaps I do need to find myself an updated ffmpeg that isn't going to break my entire system...

Code:
xbmc@revo:~/comskip-0.91b$ make
make  all-am
make[1]: Entering directory `/home/xbmc/comskip-0.91b'
g++ -DHAVE_CONFIG_H -I.     -g -O2 -std=gnu++0x -MT comskip-mpeg2dec.o -MD -MP -MF .deps/comskip-mpeg2dec.Tpo -c -o comskip-mpeg2dec.o `test -f 'mpeg2dec.cpp' || echo './'`mpeg2dec.cpp
mpeg2dec.cpp: In function âvoid decodeOnePicture(FILE*, double, CS::CommercialSkipper*)â:
mpeg2dec.cpp:1037:50: warning: âAVInputFormat::read_seekâ is deprecated (declared at /usr/include/libavformat/avformat.h:390) [-Wdeprecated-declarations]
mpeg2dec.cpp:1037:50: warning: âAVInputFormat::read_seekâ is deprecated (declared at /usr/include/libavformat/avformat.h:390) [-Wdeprecated-declarations]
mpeg2dec.cpp: In function âbool {anonymous}::video_packet_process({anonymous}::VideoState*, AVPacket*)â:
mpeg2dec.cpp:1177:74: error: âavcodec_get_frame_classâ was not declared in this scope
mpeg2dec.cpp:1177:112: error: âav_opt_ptrâ was not declared in this scope
mpeg2dec.cpp: In function âvoid {anonymous}::file_close()â:
mpeg2dec.cpp:1582:38: error: âavformat_close_inputâ was not declared in this scope
mpeg2dec.cpp: In function âint main(int, char**)â:
mpeg2dec.cpp:1781:37: warning: âAVInputFormat::read_seekâ is deprecated (declared at /usr/include/libavformat/avformat.h:390) [-Wdeprecated-declarations]
mpeg2dec.cpp:1781:37: warning: âAVInputFormat::read_seekâ is deprecated (declared at /usr/include/libavformat/avformat.h:390) [-Wdeprecated-declarations]
make[1]: *** [comskip-mpeg2dec.o] Error 1
make[1]: Leaving directory `/home/xbmc/comskip-0.91b'
make: *** [all] Error 2
xbmc@revo:~/comskip-0.91b$
(This post was last modified: 2012-12-31 17:05 by Prof Yaffle.)
find quote
cbxbiker61 Offline
Senior Member
Posts: 183
Joined: Nov 2010
Reputation: 2
Post: #13
(2012-12-31 16:58)Prof Yaffle Wrote:  
(2012-12-31 15:55)cbxbiker61 Wrote:  I just did a review of older ffmpeg versions and avcodec_get_frame_class ... I've personally tested it with ffmpeg 0.11.x and 1.0.x versions.

We might get some ffmpeg challenges as well, then, unless this is included in much earlier versions.

The most recent compile from Ubuntu repositories for XBMCBuntu is 0.7.6-4:0.7.6-0ubuntu0.11.10.2 (built on Dec 18 2012 18:02:16 with gcc 4.6.1, apparently).

The most recent build from the ffmpeg PPA is seemingly 0.10.6. So it's build-it-yourself or a game of hunt-the-PPA for 0.11.x or later.

Let's not let that stop us, though :-)

Just build a default (static) version of ffmpeg 1.0.1 and pass appropriate flags when you do configure. I was actually doing a static ffmpeg for a while during testing. I don't use static libs much, since I like to tune my system libs. In this case it would be worth it though, so you don't have to fiddle with the default libs.
find quote
Prof Yaffle Offline
Donor
Posts: 1,188
Joined: Mar 2011
Reputation: 28
Location: UK - in the middlish (mostly).
Post: #14
Just build a static ffmpeg, he says... "just build"... mumblemumblemutter... ;-)

Okay, I cloned ffmpeg git, installed yasm as a dependency, and waited forever for ffmpeg to build.

Now it's done that, and I'm old and grey, I'm now beating comskip to death to try to get it to pay the blindest bit of attention to the new ffmpeg location. Closest I've got so far is:

Code:
env CPPFLAGS="-I/home/xbmc/ffmpeg" LDFLAGS="-L/home/xbmc/ffmpeg" ./configure --prefix=/usr

(the new ffmpeg builds - all builts with default flags - are in /home/xbmc/ffmpeg).

make on comskip now produces:

Code:
xbmc@revo:~/comskip-0.91b$ make
make  all-am
make[1]: Entering directory `/home/xbmc/comskip-0.91b'
g++  -g -O2 -std=gnu++0x  -L/home/xbmc/ffmpeg -o comskip comskip-mpeg2dec.o comskip-comskip.o comskip-BlackFrame.o comskip-ProcessCsv.o comskip-ProcessArInfo.o comskip-LoadSettings.o  -largtable2 -lavutil -lavformat -lavcodec
comskip-mpeg2dec.o: In function `file_close':
/home/xbmc/comskip-0.91b/mpeg2dec.cpp:1582: undefined reference to `avformat_close_input'
comskip-mpeg2dec.o: In function `video_packet_process':
/home/xbmc/comskip-0.91b/mpeg2dec.cpp:1177: undefined reference to `avcodec_get_frame_class'
/home/xbmc/comskip-0.91b/mpeg2dec.cpp:1177: undefined reference to `av_opt_ptr'
collect2: ld returned 1 exit status
make[1]: *** [comskip] Error 1
make[1]: Leaving directory `/home/xbmc/comskip-0.91b'
make: *** [all] Error 2

... which, I assure you, is by far the furthest I've got so far.

I'll keeping compiling with extreme prejudice...
find quote
cbxbiker61 Offline
Senior Member
Posts: 183
Joined: Nov 2010
Reputation: 2
Post: #15
(2012-12-31 18:38)Prof Yaffle Wrote:  Just build a static ffmpeg, he says... "just build"... mumblemumblemutter... ;-)

Okay, I cloned ffmpeg git, installed yasm as a dependency, and waited forever for ffmpeg to build.

Now it's done that, and I'm old and grey, I'm now beating comskip to death to try to get it to pay the blindest bit of attention to the new ffmpeg location. Closest I've got so far is:

Code:
env CPPFLAGS="-I/home/xbmc/ffmpeg" LDFLAGS="-L/home/xbmc/ffmpeg" ./configure --prefix=/usr

(the new ffmpeg builds - all builts with default flags - are in /home/xbmc/ffmpeg).

make on comskip now produces:

Code:
xbmc@revo:~/comskip-0.91b$ make
make  all-am
make[1]: Entering directory `/home/xbmc/comskip-0.91b'
g++  -g -O2 -std=gnu++0x  -L/home/xbmc/ffmpeg -o comskip comskip-mpeg2dec.o comskip-comskip.o comskip-BlackFrame.o comskip-ProcessCsv.o comskip-ProcessArInfo.o comskip-LoadSettings.o  -largtable2 -lavutil -lavformat -lavcodec
comskip-mpeg2dec.o: In function `file_close':
/home/xbmc/comskip-0.91b/mpeg2dec.cpp:1582: undefined reference to `avformat_close_input'
comskip-mpeg2dec.o: In function `video_packet_process':
/home/xbmc/comskip-0.91b/mpeg2dec.cpp:1177: undefined reference to `avcodec_get_frame_class'
/home/xbmc/comskip-0.91b/mpeg2dec.cpp:1177: undefined reference to `av_opt_ptr'
collect2: ld returned 1 exit status
make[1]: *** [comskip] Error 1
make[1]: Leaving directory `/home/xbmc/comskip-0.91b'
make: *** [all] Error 2

... which, I assure you, is by far the furthest I've got so far.

I'll keeping compiling with extreme prejudice...

Yeah your .a files would have to be in /home/xbmc/ffmpeg, which wouldn't be the case if you just built in /home/xbmc/ffmpeg.

This should fix that:
find /home/xbmc/ffmpeg -name '*.a' -exec cp {} /home/xbmc/ffmpeg ';'

Usually when I build static libs for such purposes I use something like './configure --prefix=/home/xbmc/ffmpeg-install' and then do a make install. Then you base your flags on /home/xbmc/ffmpeg-install.
find quote
Post Reply