Mythcommflag

From MythTV Official Wiki
Revision as of 00:44, 1 March 2014 by Haar (talk | contribs) (Script Results)

Jump to: navigation, search

Mythcommflag is the internal process used by the backend to flag commercials in MythTV recordings. There are various options that can be set on how commercials are detected. See the front end configuration manual for details.

Usage

$ mythcommflag --help
Misc. Options:
--chanid                    Specify chanid of recording to operate on.
--dry-run                   Don't actually queue operation, just list what would
                            be done
-O OR --override-setting    Override a single setting defined by a key=value
                            pair.
--override-settings-file    Define a file of key=value pairs to be loaded for
                            setting overrides.
--queue                     Insert flagging job into the JobQueue, rather than
                            running flagging in the foreground.
-h OR --help OR --usage     Display this help printout, or give detailed
                            information of selected option.
--version                   Display version information.
--starttime                 Specify start time of recording to operate on.

Commflagging Options:
--method                    Commercial flagging method[s] to employ:
                            off, blank, scene, blankscene, logo, all, d2,
                            d2_logo, d2_blank, d2_scene, d2_all

--method does not currently accept text values. See http://code.mythtv.org/trac/ticket/10793 and http://code.mythtv.org/trac/ticket/10989

Instead use integers: 0=off, 1=blank, 2=scene, 4=logo

Combine methods by adding: ie blankscene=3=1+2, all=7=1+2+4

Add 256 for the experimental d2 methods eg d2_logo=260=256+4. One developer commented that the d2 methods are slower, but no better.

Note that when --method accepts text values, d2_all does not include the d2_scene method - found to be unhelpful, especially in the US. So d2_all=261, and not 263

The experimental methods appear to have a current fault. An infinite loop, causing a failure to process the job queue and using 100% CPU. See http://code.mythtv.org/trac/ticket/11141

--outputmethod              Format of output written to outputfile, essentials,
                            full.

--outputmethod option is currently ignored and defaults to essentials. See http://code.mythtv.org/trac/ticket/10793 and http://code.mythtv.org/trac/ticket/10989

--rebuild                   Do not flag commercials, just rebuild the seektable.

Advanced Options:
--force                     Force operation, even if program appears to be in
                            use.
--outputfile                File to write commercial flagging output [debug].

Input Options:
-f OR --file                Specify file to operate on.
--video                     Rebuild the seek table for a video (non-recording)
                            file.

Logging Options:
--loglevel                  Set the logging level.  All log messages at lower
                            levels will be discarded.
                            In descending order: emerg, alert, crit, err,
                            warning, notice, info, debug
                            defaults to info
--logpath                   Writes logging messages to a file in the directory
                            logpath with filenames in the format:
                            applicationName.date.pid.log.
                            This is typically used in combination with --daemon,
                            and if used in combination with --pidfile, this can
                            be used with log rotators, using the HUP call to
                            inform MythTV to reload the file
--nodblog                   Disable database logging.
--noprogress                Don't print progress on stdout.
-q OR --quiet               Don't log to the console (-q).  Don't log anywhere
                            (-q -q)
--syslog                    Set the syslog logging facility.
                            Set to "none" to disable, defaults to none.
-v OR --verbose             Specify log filtering. Use '-v help' for level info.

Choosing a Recording

Two methods are available to choose which recording to work on. The first is to specify the channelid and start time,

--chanid 1067 --starttime 20060424183000

Note the start time format is in YYYYMMDDHHMMSS.

The other method is to specify the file,

-f /MythTV/tv/1856_20060425200000.mpg

Rebuild Seektable

Many times the seektable may be bad, or you may do some editing of a recording outside of Myth. In order for Myth to properly FF, RW and seek it needs to have an up to date seektable. If this issue occurrs, you can use mythcommflag as one of the possible tools to repair the seektable.

Important.png Note: After rebuilding the seektable, any cutlist you have will no longer be properly synced and should be recreated.

Non Flagging Operations

The following options are mutually exclusive with commercial flagging, and if specified they will cause mythcommflag to perform an action other than commercial flagging.

--video filename             Rebuild the seektable for a video (non-recording) file
--rebuild                    Do not flag commercials, just rebuild seektable

Examples of Mythcommflag Jobs Speed

Script

Run this script to add entries to the examples.

#!/bin/bash
#
# Script to generate wiki formatted mythcommflag report.
#
# Usage:
# 1. Download and save this script to "mythcommflag.report.sh" 
# 2. Run mythcommflag -f mythtv_recording_of_your_choice.mpg
#  - After logo detection the fps for commercial flagging will be printed out.
#    Change FPS below to your FPS that is reported (eg FPS="50 fps") and save this script.
# 3. Run "sh mythcommflag.report.sh mythtv_recording_of_your_choice.mpg"
#  - Cut and paste output and add to this website (you must first create an account to edit this page).
#

if [ $# -ne 1 ]
then
 echo Usage: $0 mythtv_recording_of_your_choice.mpg
 exit 1
fi

CPUNAME=`cat /proc/cpuinfo | grep "model name" | sed -e 's/model name\t: //' | head -n 1 | sed -e 's/\t/ /'`
CPUMHZ=`cat /proc/cpuinfo | grep "cpu MHz" | sed -e 's/cpu MHz//' | sed 's/ *//g' | sed 's/\t*://' | head -n 1`
KERNEL=`uname -r`
CPUSETTING='Medium'
FPS='not specified'
# RESOLUTION=`ffmpeg -i "$1" 2>&1 | grep Video | head -n 1 | awk '{ print $6 }' | sed -e 's/,//'`
RESOLUTION=`ffmpeg -i "$1" 2>&1 | grep Video | head -n 1 | sed 's/[^,]*,[^,]*, *\([^ ]*\).*/\1/'`
# FORMAT=`ffmpeg -i "$1" 2>&1 | grep Video | head -n 1 | awk '{ print $4 }' | sed -e 's/,//'`
FORMAT=`ffmpeg -i "$1" 2>&1 | grep Video | head -n 1 | sed 's/^.*Video: *\([^ ]*\).*/\1/'`
BITRATE=`ffmpeg -i "$1" 2>&1 | grep bitrate: | awk '{ print $6 }'`
EXTENSION=`basename "$1" | awk -F . '{print $NF}' | tr 'A-Z' 'a-z'`

echo "|-" > mcfreport.txt
echo "| $CPUNAME || $CPUMHZ MHz || $KERNEL || $CPUSETTING || $FORMAT / $EXTENSION || $RESOLUTION || $BITRATE kb/s || $FPS" >> mcfreport.txt
echo "|-" >> mcfreport.txt

echo "Thank you!  Please paste the following into the wiki page at: http://www.mythtv.org/wiki/Mythcommflag#Examples_of_Mythcommflag_Jobs_Speed"
cat mcfreport.txt


Important.png Note: This script cannot account for processors that downclock when idle. If you are using one of these, please adjust your report accordingly.

Script Results

Processor CPU Speed Kernel version CPU Setting Video Codec / Container Resolution Bitrate FPS
AMD Athlon MP 1200 Mhz Low 57 fps
AMD Sempron 3100+ 1800 Mhz Low 60 fps
AMD Sempron 3100+ 1800 Mhz Medium 208 fps
AMD Dual-Core 4850e 2500 Mhz Medium 380 fps
AMD Athlon(tm) II X4 600e Processor 2200.000 MHz 3.1.0-1.2-desktop Medium mpeg2video / mpg 1920x1080 16172 kb/s 95 fps
AMD Athlon II X4 635 2900 Mhz Medium 720x480 460 fps
AMD Athlon II X4 635 2900 Mhz 2.6.32-24-generic Medium h264 / mpg 1280x720 3926 kb/s 125 fps
AMD Athlon II X4 635 2900 MHz 2.6.32-24-generic Medium h264 / mpg 1920x1080 9840 kb/s 37 fps
Intel Core2 Duo 6300 1860 MHz 2.6.32-25-generic Medium mpeg2video / mpg 720x480 (NTSC) 5188 kb/s 340 fps
Intel Core2 Duo 6300 1860 MHz 2.6.32-25-generic Medium mpeg2video / mpg 1920x1080 (ATSC) 17990 kb/s 72 fps
Intel Pentium 4 2594 MHz 2.6.35-22-generic-pae Medium mpeg2video / mpg 480x480 (NTSC) 5192 kb/s 310 fps
AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ 2599.923 MHz 2.6.35.9-64.fc14.x86_64 Medium mpeg2video / mpg 720x480 5221 kb/s 498 fps
AMD Athlon(tm) 64 X2 Dual Core Processor 5200+ 2700.000 MHz 2.6.37.6-0.7-desktop Medium mpeg2video / mpg 1920x1080 18083 kb/s 76 fps
Intel(R) Core(TM)2 Duo CPU T6670 @ 2.20GHz 2201.000 MHz 2.6.38-8-generic-pae Medium mpeg2video / mpg 1280x720 15843 kb/s 94 fps
Intel(R) Core(TM)2 Duo CPU T6670 @ 2.20GHz 2201.000 MHz 2.6.38-8-generic-pae Medium mpeg2video / mpg 1920x1080 16713 kb/s 60 fps
Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz 4801.000 MHz 2.6.38-13-generic Medium h264, / mp4 1920x1088 8862 kb/s 97 fps
Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz 4801.000 MHz 2.6.38-13-generic Medium h264, / mp4 1280x720 2822 kb/s 366 fps
Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz 4801.000 MHz 2.6.38-13-generic Medium h264, / mp4 512x464 1159 kb/s 1203 fps
Intel(R) Atom(TM) CPU 330 @ 1.60GHz 1599.885 MHz 2.6.38-8-generic Medium mpeg2video, / mpg 1920x1080 11370 kb/s 38 fps
Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz 3400.000 MHz 3.2.0-26-generic Medium mpeg2video / mpg 1280x720 15843 kb/s 1180 fps
Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz 3400.000 MHz 3.2.0-26-generic Medium mpeg2video / mpg 1920x1080 15870 kb/s 528 fps
AMD FX(tm)-4100 Dual-Module Processor 3600.000 MHz 3.2.0-53-generic Medium mpeg2video / mpg 1280x720 18003 kb/s 50 fps
Intel(R) Xeon(R) CPU X3430 @ 2.40GHz 2400.000 MHz 3.2.0-48-generic-pae Medium mpeg2video / mpg 720x576 4104 kb/s 960 fps
Intel(R) Xeon(R) CPU X3430 @ 2.40GHz 2400.000 MHz 3.2.0-48-generic-pae Medium mpeg2video / mpg 1440x1080 10941 kb/s 301 fps
Intel(R) Celeron(R) CPU G1610 @ 2.60GHz 2600.000 MHz 3.8.0-30-generic Medium mpeg2video / mpg 1280x720 15061 kb/s 959 fps
Intel(R) Celeron(R) CPU G1610 @ 2.60GHz 2600.000 MHz 3.8.0-30-generic Medium mpeg2video / mpg 1920x1080 17013 kb/s 349 fps
Intel(R) Pentium(R) CPU G2120 @ 3.10GHz 3100.000 MHz 3.8.0-30-generic Medium mpeg2video / mpg 1280x720 15061 kb/s 1150 fps
Intel(R) Pentium(R) CPU G2120 @ 3.10GHz 3100.000 MHz 3.8.0-30-generic Medium mpeg2video / mpg 1920x1080 17013 kb/s 426 fps
Intel(R) Pentium(R) CPU G3420 @ 3.20GHz 3200.000 MHz 3.8.0-34-generic Medium mpeg2video / mpg 1280x720 11211 kb/s 1262 fps
Intel(R) Pentium(R) CPU G3420 @ 3.20GHz 3200.000 MHz 3.8.0-34-generic Medium mpeg2video / mpg 1920x1080 18312 kb/s 371 fps
AMD FX(tm)-8350 Eight-Core Processor 4415.173 MHz 3.8.0-34-generic Medium mpeg2video / mpg 1280x720 11211 kb/s 1311 fps
AMD FX(tm)-8350 Eight-Core Processor 4415.173 MHz 3.8.0-34-generic Medium mpeg2video / mpg 1920x1080 18312 kb/s 382 fps
Intel(R) Pentium(R) CPU G3420 @ 3.20GHz 3200.000 MHz 3.8.0-34-generic Medium mpeg2video / mpg 1280x720 15009 kb/s 1286 fps
AMD FX(tm)-8350 Eight-Core Processor 4000.000 MHz 3.8.0-34-generic Medium mpeg2video / mpg 1280x720 15009 kb/s 1212 fps
Intel(R) Core(TM) i3-4330 CPU @ 3.50GHz 3499.994 MHz 3.8.0-35-generic Medium mpeg2video / mpg 1280x720 15009 kb/s 1388 fps
AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ 2600.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1920x1080 17013 kb/s 232 fps
AMD Phenom(tm) II X4 905e Processor 2500.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1920x1080 17013 kb/s 282 fps
Intel(R) Celeron(R) CPU G1610 @ 2.60GHz 2600.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1920x1080 17013 kb/s 353 fps
AMD A6-6400K APU with Radeon(tm) HD Graphics 3900.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1920x1080 17013 kb/s 406 fps
AMD Phenom(tm) II X6 1100T Processor 3300.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1920x1080 17013 kb/s 413 fps
Intel(R) Pentium(R) CPU G2120 @ 3.10GHz 3100.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1920x1080 17013 kb/s 423 fps
AMD FX(tm)-8350 Eight-Core Processor 4000.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1920x1080 17013 kb/s 442 fps
Intel(R) Pentium(R) CPU G3420 @ 3.20GHz 3199.846 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1920x1080 17013 kb/s 459 fps
Intel(R) Core(TM) i3-4330 CPU @ 3.50GHz 3500.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1920x1080 17013 kb/s 500 fps
AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ 2600.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1280x720 15211 kb/s 496 fps
AMD Phenom(tm) II X4 905e Processor 2500.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1280x720 15211 kb/s 620 fps
Intel(R) Celeron(R) CPU G1610 @ 2.60GHz 2600.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1280x720 15211 kb/s 777 fps
AMD Phenom(tm) II X6 1100T Processor 3300.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1280x720 15211 kb/s 905 fps
AMD A6-6400K APU with Radeon(tm) HD Graphics 3900.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1280x720 15211 kb/s 920 fps
AMD FX(tm)-8350 Eight-Core Processor 4000.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1280x720 15211 kb/s 976 fps
Intel(R) Pentium(R) CPU G3420 @ 3.20GHz 3199.846 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1280x720 15211 kb/s 1017 fps
Intel(R) Core(TM) i3-4330 CPU @ 3.50GHz 3500.000 MHz 3.8.0-36-generic Medium mpeg2video / mpg 1280x720 15211 kb/s 1087 fps