Difference between revisions of "Mythcommflag"
(→Examples of Mythcommflag Jobs Speed) |
Faginbagin (talk | contribs) (→CommDetectBorder) |
||
(57 intermediate revisions by 12 users not shown) | |||
Line 1: | Line 1: | ||
− | '''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 [[User Manual:Utilities and Setup#Commercial Skip|front end configuration manual]] for details. | + | '''Mythcommflag''' is the internal process used by the backend to [[commercial detection|flag commercials]] in MythTV recordings. There are various options that can be set on how commercials are detected. See the [[User Manual:Utilities and Setup#Commercial Skip|front end configuration manual]] for details. |
__TOC__ | __TOC__ | ||
Line 5: | Line 5: | ||
<pre> | <pre> | ||
$ mythcommflag --help | $ 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. | |
− | --queue | + | --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 |
− | + | </pre> | |
− | -- | + | --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 | |
− | |||
− | + | <pre> | |
− | + | --outputmethod Format of output written to outputfile, essentials, | |
+ | full. | ||
</pre> | </pre> | ||
+ | --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 | ||
+ | <pre> | ||
+ | --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. | ||
+ | |||
+ | </pre> | ||
== Choosing a Recording == | == Choosing a Recording == | ||
Two methods are available to choose which recording to work on. The first is to specify the channelid and start time, | 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. | Note the start time format is in YYYYMMDDHHMMSS. | ||
The other method is to specify the file, | The other method is to specify the file, | ||
-f /MythTV/tv/1856_20060425200000.mpg | -f /MythTV/tv/1856_20060425200000.mpg | ||
− | |||
== Rebuild Seektable == | == Rebuild Seektable == | ||
Line 67: | Line 100: | ||
--video filename Rebuild the seektable for a video (non-recording) file | --video filename Rebuild the seektable for a video (non-recording) file | ||
--rebuild Do not flag commercials, just rebuild seektable | --rebuild Do not flag commercials, just rebuild seektable | ||
− | |||
− | |||
− | |||
− | |||
− | |||
</pre> | </pre> | ||
+ | == Modifying Commercial Detection with Settings == | ||
+ | |||
+ | Mythcommflag supports several settings that can change its behavior. These settings can be added to the '''mythconverg.settings''' database table or they can be specified on the command line using the '''--override-setting''' or | ||
+ | '''--override-settings-file''' options. For example, if you copy and paste the following into a file called mythcommflag-override, you can tell mythcommflag to use the settings by adding '''--override-settings-file mythcommflag-override''' to the command line: | ||
+ | <pre> | ||
+ | AggressiveCommDetect=1 | ||
+ | BlankFrameDetectorDebugLevel=0 | ||
+ | BorderDetectorDebugLevel=0 | ||
+ | CommDetectBlankCanHaveLogo=1 | ||
+ | CommDetectBlankFrameMaxDiff=25 | ||
+ | CommDetectBorder=20 | ||
+ | CommDetectBoxBrightness=30 | ||
+ | CommDetectDarkBrightness=80 | ||
+ | CommDetectDimAverage=35 | ||
+ | CommDetectDimBrightness=120 | ||
+ | CommDetectLogoBadEdgeThreshold=0.85 | ||
+ | CommDetectLogoGoodEdgeThreshold=0.75 | ||
+ | CommDetectLogoSamplesNeeded=240 | ||
+ | CommDetectLogoSampleSpacing=2 | ||
+ | CommDetectMaxCommBreakLength=395 | ||
+ | CommDetectMaxCommLength=125 | ||
+ | CommDetectMinCommBreakLength=60 | ||
+ | CommDetectMinShowLength=65 | ||
+ | CommercialSkipMethod=7 | ||
+ | HistogramAnalyzerDebugLevel=0 | ||
+ | JobQueueCPU=0 | ||
+ | SceneChangeDetectorDebugLevel=0 | ||
+ | TemplateFinderDebugLevel=0 | ||
+ | TemplateMatcherDebugLevel=0 | ||
+ | </pre> | ||
+ | The above key=value pairs specify the default settings defined in the source code as of version 0.27. | ||
+ | |||
+ | === Settings Descriptions === | ||
+ | Following are descriptions of each setting, based on reading the source code. | ||
+ | |||
+ | To understand some of the settings, it helps to understand a little about how mythcommflag works. For each frame, mythcommflag examines each pixel’s luma to find the maximum (brightest), minimum (dimmest) and average. Luma is a measure of brightness and can range from 0 (black) to 255 (white) for so-called “PC levels” and from 16 to 235 for “TV levels”. For more information, see http://en.wikipedia.org/wiki/YUV. | ||
+ | |||
+ | Mythcommflag also looks for transitions to and from letter-boxed and/or pillar-boxed video. See http://en.wikipedia.org/wiki/Letterboxing_(filming) and http://en.wikipedia.org/wiki/Pillarbox to understand these terms. | ||
+ | |||
+ | ==== AggressiveCommDetect ==== | ||
+ | This setting influences blank frame detection, how many blank frames in a row constitute a gap between the program and its commercials or between commercials, and how long a commercial break can be. This setting can be changed in '''mythfrontend''' via '''Setup -> Video -> General -> General (Jobs)''', and changing the check mark for '''Strict commercial detection'''. | ||
+ | |||
+ | If 0, blank frames are those where either of the following conditions is true: | ||
+ | * The difference between the maximum luma and minimum luma is less than '''CommDetectBlankFrameMaxDiff'''. It doesn't matter how dark the frame is, so nearly solid color frames are considered blank. | ||
+ | * The maximum luma is less than '''CommDetectDarkBrightness'''. | ||
+ | |||
+ | If 1, blank frames are those where both of the following conditions are true: | ||
+ | * The maximum luma is less than '''CommDetectDimBrightness'''. | ||
+ | * The average luma is less than the minimum luma + 10. | ||
+ | |||
+ | The default value is 1. | ||
+ | |||
+ | ==== BlankFrameDetectorDebugLevel ==== | ||
+ | This setting determines what debug output is produced by the experimental blank frame detection method, '''–-method''' options '''d2_blank''' or '''d2_all'''. | ||
+ | |||
+ | If the value is non-zero, a directory of the form '''<''StorageDirectory''>/<''BaseFilename''>-debug''' will be created and some of the debug data will be placed in files in this directory. If '''–v commflag''' has been enabled on the command line, other debug data will be written to the usual mythtv log file. | ||
+ | |||
+ | The default value is 0. | ||
+ | |||
+ | ==== BorderDetectorDebugLevel ==== | ||
+ | This setting determines what debug output is produced by the experimental blank, scene and/or logo detection methods, '''--method''' options '''d2_blank''', '''d2_scene''', '''d2_logo''' or '''d2_all'''. See [[#BlankFrameDetectorDebugLevel]]. | ||
+ | |||
+ | The default value is 0. | ||
+ | |||
+ | ==== CommDetectBlankCanHaveLogo ==== | ||
+ | The default value is 1. | ||
+ | |||
+ | ==== CommDetectBlankFrameMaxDiff ==== | ||
+ | A frame is considered blank if the difference between maximum and minimum lumas is less than '''CommDetectBlankFrameMaxDiff''' and the maximum luma is less than '''CommDetectDimBrightness'''. These settings are also used somewhat differently depending on the value of '''AggressiveCommDetect'''. | ||
+ | |||
+ | The default value is 25. | ||
+ | |||
+ | ==== CommDetectBorder ==== | ||
+ | This setting excludes '''CommDetectBorder''' pixels from the top, bottom, left and right of the frame from examination. It should, for example, exclude any VBI data that might be visible at the top of a frame. | ||
+ | |||
+ | The default value is 20. | ||
+ | |||
+ | Ticket https://code.mythtv.org/trac/ticket/12308 has been submitted that changes the meaning of this setting. The ticket improves accuracy from 51% to 75%. One patch, mcf-border.patch, assumes the CommDetectBorder setting was established for 720 height video and uses those two numbers and the lowres video height to compute the border used. For example: | ||
+ | <br>If video source height = 480 then border = 20 * 480 / 4 / 720 = 2 | ||
+ | <br>If video source height = 720 then border = 20 * 720 / 4 / 720 = 5 | ||
+ | <br>If video source height = 1080 then border = 20 * 1080 / 4 / 720 = 7 | ||
+ | |||
+ | ==== CommDetectBoxBrightness ==== | ||
+ | This setting is used to detect letterboxed and/or pillar boxed frames. If the maximum luma in possible letter-box rows or pillar-box columns exceeds this setting, the frame is not considered letter-boxed or pillar-boxed. | ||
+ | |||
+ | The default value is 30. | ||
+ | |||
+ | ==== CommDetectDarkBrightness ==== | ||
+ | This setting is only used if '''AggressiveCommDetect''' is 0. See [[#AggressiveCommDetect]] for details. | ||
+ | |||
+ | The default value is 80. | ||
+ | |||
+ | ==== CommDetectDimAverage ==== | ||
+ | This setting is not used. The variable used to store it, is changed as each frame is processed to the minimum luma + 10. | ||
+ | |||
+ | The default value is 35. | ||
+ | |||
+ | ==== CommDetectDimBrightness ==== | ||
+ | A frame is considered blank if the difference between maximum and minimum lumas is less than '''CommDetectBlankFrameMaxDiff''' and the maximum luma is less than '''CommDetectDimBrightness'''. These settings are also used somewhat differently depending on the value of '''AggressiveCommDetect'''. | ||
+ | |||
+ | The default value is 125. | ||
+ | |||
+ | ==== CommDetectLogoBadEdgeThreshold ==== | ||
+ | This setting is used for logo detection. | ||
+ | |||
+ | The default value is 0.85 | ||
+ | |||
+ | ==== CommDetectLogoGoodEdgeThreshold ==== | ||
+ | This setting is used for logo detection. | ||
+ | |||
+ | The default value is 0.75 | ||
+ | |||
+ | ==== CommDetectLogoSamplesNeeded ==== | ||
+ | This setting is the number of frames sampled in preparation for logo detection. | ||
+ | |||
+ | The default value is 240. | ||
+ | |||
+ | ==== CommDetectLogoSampleSpacing ==== | ||
+ | This setting is the number of seconds between sampled frames in preparation for logo detection. | ||
+ | |||
+ | The default value is 2. | ||
+ | |||
+ | ==== CommDetectMaxCommBreakLength ==== | ||
+ | This setting is the maximum number of seconds in a commercial break. It is used to distinguish between a program and its commercials. | ||
+ | |||
+ | The default value is 395. | ||
+ | |||
+ | ==== CommDetectMaxCommLength ==== | ||
+ | This setting is the maximum number of seconds in an individual commercial. It is used to distinguish between a program and its commercials. | ||
+ | |||
+ | The default value is 125. | ||
− | == | + | ==== CommDetectMinCommBreakLength ==== |
+ | This setting is the minimum number of seconds in a commercial break. It is used to distinguish between a program and its commercials. | ||
+ | |||
+ | The default value is 60. | ||
− | + | ==== CommDetectMinShowLength ==== | |
+ | This setting is the minimum number of seconds in a program segment. It is used to distinguish between a program and its commercials. | ||
+ | |||
+ | The default value is 65. | ||
− | + | ==== CommercialSkipMethod ==== | |
− | -- | + | This setting can be changed in '''mythfrontend''' via '''Setup -> Video -> General -> General (Jobs)''', and changing the combo box value for '''Commercial detection method'''. The following table translates the text values available via mythfrontend to their SkipTypes (defined in libmyth/programtypes.h and referenced in source code) and numeric values. |
− | + | {| class="wikitable" | |
+ | ! style="text-align:left;"| Commercial detection method | ||
+ | ! style="text-align:left;"| SkipTypes and Numeric values | ||
+ | |- | ||
+ | |All Available Methods | ||
+ | |COMM_DETECT_BLANK | COMM_DETECT_SCENE | COMM_DETECT_LOGO = 7 | ||
+ | |- | ||
+ | |Blank Frame Detection | ||
+ | |COMM_DETECT_BLANK = 1 | ||
+ | |- | ||
+ | |Blank Frame + Scene Change | ||
+ | |COMM_DETECT_BLANK | COMM_DETECT_SCENE = 3 | ||
+ | |- | ||
+ | |Scene Change Detection | ||
+ | |COMM_DETECT_SCENE = 2 | ||
+ | |- | ||
+ | |Logo Detection | ||
+ | |COMM_DETECT_LOGO = 4 | ||
+ | |- | ||
+ | |Experimental: Blank Frame + Logo Detection | ||
+ | |COMM_DETECT_2 | COMM_DETECT_BLANK | COMM_DETECT_LOGO = 0x100 + 5 = 261 | ||
+ | |- | ||
+ | |Pre & Post Roll: Blank Frame + Scene Change | ||
+ | |COMM_DETECT_PREPOSTROLL | COMM_DETECT_BLANK | COMM_DETECT_SCENE = 0x200 + 3 = 515 | ||
+ | |} | ||
+ | This setting can be overridden via the command line using the --method option described in the Usage section. | ||
+ | |||
+ | The default value is 7, All Available Methods. | ||
+ | ==== HistogramAnalyzerDebugLevel ==== | ||
+ | This setting determines what debug output is produced by the experimental blank and/or scene detection methods, '''--method''' options '''d2_blank''', '''d2_scene''' or '''d2_all'''. See [[#BlankFrameDetectorDebugLevel]]. | ||
+ | |||
+ | The default value is 0. | ||
− | == | + | ==== JobQueueCPU ==== |
+ | This setting is used to set the niceness of the mythcommflag process as well as its I/O priority and whether the process should run at full speed or pause every so often. The higher the value, the higher the priorities. | ||
+ | |||
+ | This setting can be changed in '''mythtv-setup''' via '''General -> Job Queue (Backend Specific)''', and changing the combo box value for '''CPU Usage'''. | ||
+ | |||
+ | The default value is 0 or Low. | ||
− | + | ==== SceneChangeDetectorDebugLevel ==== | |
+ | This setting determines what debug output is produced by the experimental scene detection method, '''--method''' options '''d2_scene''' or '''d2_all'''. See [[#BlankFrameDetectorDebugLevel]]. | ||
+ | |||
+ | The default value is 0. | ||
− | + | ==== TemplateFinderDebugLevel ==== | |
+ | This setting determines what debug output is produced by the experimental logo detection method, '''--method''' options '''d2_logo''' or '''d2_all'''. See [[#BlankFrameDetectorDebugLevel]]. | ||
+ | |||
+ | The default value is 0. | ||
− | + | ==== TemplateMatcherDebugLevel ==== | |
+ | This setting determines what debug output is produced by the experimental logo detection method, -'''-method''' options '''d2_logo''' or '''d2_all'''. See [[#BlankFrameDetectorDebugLevel]]. | ||
+ | |||
+ | The default value is 0. | ||
− | + | === Obsolete Settings === | |
− | + | ==== CommFlagFast ==== | |
+ | This setting can be changed in '''mythfrontend''' via '''Setup -> Video -> General -> General (Jobs)''', and changing the checkmark for '''Enable experimental speedup of commercial detection'''. But it is unused by mythcommflag version 0.27. | ||
− | + | ==== CommSkipAllBlanks ==== | |
+ | You may find this in your settings table. If so, it is probably left over from an earlier version of mythtv. It is unused by mythcommflag version 0.27. | ||
− | + | === Experimenting with Settings === | |
+ | If you wish to experiment with these settings, I suggest doing it using an override settings file. Try different values on a troublesome recording until you get results you like, and then try it on a recording that already had good commercial marks. If you like the results on the recording that already had good commercial marks, then you may want to add the settings to the database, so they are applied to any time mythcommflag is executed, including by mythbackend. | ||
== Examples of Mythcommflag Jobs Speed == | == Examples of Mythcommflag Jobs Speed == | ||
− | + | === Script === | |
− | + | ||
− | + | Run this script to add entries to the examples. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | CPUNAME=`cat /proc/cpuinfo | grep "model name" | sed -e 's/model name\t: //' | head -n 1 | sed -e 's/\t/ /'` | + | #!/bin/bash |
− | CPUMHZ=`cat /proc/cpuinfo | grep "cpu MHz" | sed -e 's/cpu MHz//' | sed 's/ *//g' | sed 's/\t*://' | head -n 1` | + | # |
− | KERNEL=`uname -r` | + | # Script to generate wiki formatted mythcommflag report. |
− | CPUSETTING='Medium' | + | # |
− | FPS='not specified' | + | # Usage: |
− | RESOLUTION=`ffmpeg -i "$1" 2>&1 | grep Video | head -n 1 | awk '{ print $6 }' | sed -e 's/,//'` | + | # 1. Download and save this script to "mythcommflag.report.sh" |
− | FORMAT=`ffmpeg -i "$1" 2>&1 | grep Video | head -n 1 | awk '{ print $4 }' | sed -e 's/,//'` | + | # 2. Run mythcommflag -f mythtv_recording_of_your_choice.mpg |
− | BITRATE=`ffmpeg -i "$1" 2>&1 | grep bitrate: | awk '{ print $6 }'` | + | # - After logo detection the fps for commercial flagging will be printed out. |
− | EXTENSION=`basename "$1" | awk -F . '{print $NF}' | tr 'A-Z' 'a-z'` | + | # 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 | ||
− | + | {{Note_box|This script cannot account for processors that downclock when idle. If you are using one of these, please adjust your report accordingly.}} | |
− | |||
− | |||
− | + | === Script Results === | |
− | |||
− | |||
{| border="1" cellspacing="0" cellpadding="5" class="wikitable sortable" style="border-collapse:collapse; border-color:#8eabd0; background:#e7edf5" | {| border="1" cellspacing="0" cellpadding="5" class="wikitable sortable" style="border-collapse:collapse; border-color:#8eabd0; background:#e7edf5" | ||
Line 152: | Line 379: | ||
|- | |- | ||
| AMD Dual-Core 4850e || 2500 Mhz || || Medium || || || || 380 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 || || Medium || || 720x480 || || 460 fps | ||
Line 165: | Line 394: | ||
| Intel Pentium 4 || 2594 MHz || 2.6.35-22-generic-pae || Medium || mpeg2video / mpg || 480x480 (NTSC) || 5192 kb/s || 310 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 | ||
|- | |- | ||
− | | AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ || | + | | 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 | ||
+ | |- | ||
+ | | 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) 5150 APU with Radeon(tm) R3 || 1597.045 MHz || 3.8.0-39-generic || Medium || mpeg2video / mpg || 1920x1080 || 17013 kb/s || 155 fps | ||
+ | |- | ||
+ | | AMD Athlon(tm) 5350 APU with Radeon(tm) R3 || 2046.231 MHz || 3.8.0-39-generic || Medium || mpeg2video / mpg || 1920x1080 || 17013 kb/s || 197 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 | ||
+ | |- | ||
+ | | Intel(R) Pentium(R) CPU G3258 @ 3.20GHz || 4000.000 MHz || 3.8.0.42-generic || | Medium || mpeg2video / mpg || 1920x1080 || 17013 kb/s || 572 fps | ||
+ | |- | ||
+ | | AMD Athlon(tm) 5150 APU with Radeon(tm) R3 || 1597.045 MHz || 3.8.0-39-generic || Medium || mpeg2video / mpg || 1280x720 || 15211 kb/s || 351 fps | ||
+ | |- | ||
+ | | AMD Athlon(tm) 5350 APU with Radeon(tm) R3 || 2046.231 MHz || 3.8.0-39-generic || Medium || mpeg2video / mpg || 1280x720 || 15211 kb/s || 445 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 | ||
+ | |- | ||
+ | | Intel(R) Pentium(R) CPU G3258 @ 3.20GHz || 4000.000 MHz || 3.8.0.42-generic || | Medium || mpeg2video / mpg || 1280x720 || 15211 kb/s || 1277 fps | ||
+ | |- | ||
+ | | Intel(R) Pentium(R) CPU G3420 @ 3.20GHz || 3199.846 MHz || 3.13.0-24-generic || Medium || mpeg2video / mpg || 1280x720 || 15141 kb/s || 1106 fps | ||
+ | |- | ||
+ | | Intel(R) Pentium(R) CPU G3420 @ 3.20GHz || 3199.846 MHz || 3.13.0-24-generic || Medium || mpeg2video / mpg || 1920x1080 || 16792 kb/s || 430 fps | ||
+ | |- | ||
+ | | Intel(R) Core(TM) i3-4330 CPU @ 3.50GHz || 3500.000 MHz || 3.13.0-24-generic || Medium || mpeg2video / mpg || 1280x720 || 15141 kb/s || 1392 fps | ||
+ | |- | ||
+ | | Intel(R) Core(TM) i3-4330 CPU @ 3.50GHz || 3500.000 MHz || 3.13.0-24-generic || Medium || mpeg2video / mpg || 1920x1080 || 16792 kb/s || 475 fps | ||
+ | |- | ||
+ | | AMD Athlon(tm) 5350 APU with Radeon(tm) R3 || 2046.231 MHz || 3.13.0-32-generic || Medium || mpeg2video / mpg || 1920x1080 || 17030 kb/s || 210 fps | ||
+ | |- | ||
+ | | Intel(R) Pentium(R) CPU G3258 @ 3.20GHz || 4000.000 MHz || 3.13.0-32-generic || Medium || mpeg2video / mpg || 1920x1080 || 17030 kb/s || 566 fps | ||
+ | |- | ||
+ | | Intel(R) Pentium(R) CPU G3258 @ 3.20GHz || 4000.000 MHz || 3.13.0-32-generic || Medium || mpeg2video / mpg || 1280x720 || 15881 kb/s || 1238 fps | ||
+ | |- | ||
+ | | AMD Athlon(tm) 5350 APU with Radeon(tm) R3 || 2046.231 MHz || 3.13.0-32-generic || Medium || mpeg2video / mpg || 1280x720 || 15030 kb/s || 574 fps | ||
+ | |- | ||
+ | | Intel(R) Pentium(R) CPU G3258 @ 3.20GHz || 3200.000 MHz || 3.13.0-32-generic || Medium || mpeg2video / mpg || 1280x720 || 15030 kb/s || 1285 fps | ||
+ | |- | ||
+ | | Intel(R) Pentium(R) CPU G3258 @ 3.20GHz || 4000.000 MHz || 3.13.0-32-generic || Medium || mpeg2video / mpg || 1280x720 || 15030 kb/s || 1603 fps | ||
+ | |- | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | [[Category:MythTV_Software]] | ||
|- | |- | ||
− |
Revision as of 05:08, 27 October 2014
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.
Contents
- 1 Usage
- 2 Choosing a Recording
- 3 Rebuild Seektable
- 4 Non Flagging Operations
- 5 Modifying Commercial Detection with Settings
- 5.1 Settings Descriptions
- 5.1.1 AggressiveCommDetect
- 5.1.2 BlankFrameDetectorDebugLevel
- 5.1.3 BorderDetectorDebugLevel
- 5.1.4 CommDetectBlankCanHaveLogo
- 5.1.5 CommDetectBlankFrameMaxDiff
- 5.1.6 CommDetectBorder
- 5.1.7 CommDetectBoxBrightness
- 5.1.8 CommDetectDarkBrightness
- 5.1.9 CommDetectDimAverage
- 5.1.10 CommDetectDimBrightness
- 5.1.11 CommDetectLogoBadEdgeThreshold
- 5.1.12 CommDetectLogoGoodEdgeThreshold
- 5.1.13 CommDetectLogoSamplesNeeded
- 5.1.14 CommDetectLogoSampleSpacing
- 5.1.15 CommDetectMaxCommBreakLength
- 5.1.16 CommDetectMaxCommLength
- 5.1.17 CommDetectMinCommBreakLength
- 5.1.18 CommDetectMinShowLength
- 5.1.19 CommercialSkipMethod
- 5.1.20 HistogramAnalyzerDebugLevel
- 5.1.21 JobQueueCPU
- 5.1.22 SceneChangeDetectorDebugLevel
- 5.1.23 TemplateFinderDebugLevel
- 5.1.24 TemplateMatcherDebugLevel
- 5.2 Obsolete Settings
- 5.3 Experimenting with Settings
- 5.1 Settings Descriptions
- 6 Examples of Mythcommflag Jobs Speed
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.
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
Modifying Commercial Detection with Settings
Mythcommflag supports several settings that can change its behavior. These settings can be added to the mythconverg.settings database table or they can be specified on the command line using the --override-setting or --override-settings-file options. For example, if you copy and paste the following into a file called mythcommflag-override, you can tell mythcommflag to use the settings by adding --override-settings-file mythcommflag-override to the command line:
AggressiveCommDetect=1 BlankFrameDetectorDebugLevel=0 BorderDetectorDebugLevel=0 CommDetectBlankCanHaveLogo=1 CommDetectBlankFrameMaxDiff=25 CommDetectBorder=20 CommDetectBoxBrightness=30 CommDetectDarkBrightness=80 CommDetectDimAverage=35 CommDetectDimBrightness=120 CommDetectLogoBadEdgeThreshold=0.85 CommDetectLogoGoodEdgeThreshold=0.75 CommDetectLogoSamplesNeeded=240 CommDetectLogoSampleSpacing=2 CommDetectMaxCommBreakLength=395 CommDetectMaxCommLength=125 CommDetectMinCommBreakLength=60 CommDetectMinShowLength=65 CommercialSkipMethod=7 HistogramAnalyzerDebugLevel=0 JobQueueCPU=0 SceneChangeDetectorDebugLevel=0 TemplateFinderDebugLevel=0 TemplateMatcherDebugLevel=0
The above key=value pairs specify the default settings defined in the source code as of version 0.27.
Settings Descriptions
Following are descriptions of each setting, based on reading the source code.
To understand some of the settings, it helps to understand a little about how mythcommflag works. For each frame, mythcommflag examines each pixel’s luma to find the maximum (brightest), minimum (dimmest) and average. Luma is a measure of brightness and can range from 0 (black) to 255 (white) for so-called “PC levels” and from 16 to 235 for “TV levels”. For more information, see http://en.wikipedia.org/wiki/YUV.
Mythcommflag also looks for transitions to and from letter-boxed and/or pillar-boxed video. See http://en.wikipedia.org/wiki/Letterboxing_(filming) and http://en.wikipedia.org/wiki/Pillarbox to understand these terms.
AggressiveCommDetect
This setting influences blank frame detection, how many blank frames in a row constitute a gap between the program and its commercials or between commercials, and how long a commercial break can be. This setting can be changed in mythfrontend via Setup -> Video -> General -> General (Jobs), and changing the check mark for Strict commercial detection.
If 0, blank frames are those where either of the following conditions is true:
- The difference between the maximum luma and minimum luma is less than CommDetectBlankFrameMaxDiff. It doesn't matter how dark the frame is, so nearly solid color frames are considered blank.
- The maximum luma is less than CommDetectDarkBrightness.
If 1, blank frames are those where both of the following conditions are true:
- The maximum luma is less than CommDetectDimBrightness.
- The average luma is less than the minimum luma + 10.
The default value is 1.
BlankFrameDetectorDebugLevel
This setting determines what debug output is produced by the experimental blank frame detection method, –-method options d2_blank or d2_all.
If the value is non-zero, a directory of the form <StorageDirectory>/<BaseFilename>-debug will be created and some of the debug data will be placed in files in this directory. If –v commflag has been enabled on the command line, other debug data will be written to the usual mythtv log file.
The default value is 0.
BorderDetectorDebugLevel
This setting determines what debug output is produced by the experimental blank, scene and/or logo detection methods, --method options d2_blank, d2_scene, d2_logo or d2_all. See #BlankFrameDetectorDebugLevel.
The default value is 0.
CommDetectBlankCanHaveLogo
The default value is 1.
CommDetectBlankFrameMaxDiff
A frame is considered blank if the difference between maximum and minimum lumas is less than CommDetectBlankFrameMaxDiff and the maximum luma is less than CommDetectDimBrightness. These settings are also used somewhat differently depending on the value of AggressiveCommDetect.
The default value is 25.
CommDetectBorder
This setting excludes CommDetectBorder pixels from the top, bottom, left and right of the frame from examination. It should, for example, exclude any VBI data that might be visible at the top of a frame.
The default value is 20.
Ticket https://code.mythtv.org/trac/ticket/12308 has been submitted that changes the meaning of this setting. The ticket improves accuracy from 51% to 75%. One patch, mcf-border.patch, assumes the CommDetectBorder setting was established for 720 height video and uses those two numbers and the lowres video height to compute the border used. For example:
If video source height = 480 then border = 20 * 480 / 4 / 720 = 2
If video source height = 720 then border = 20 * 720 / 4 / 720 = 5
If video source height = 1080 then border = 20 * 1080 / 4 / 720 = 7
CommDetectBoxBrightness
This setting is used to detect letterboxed and/or pillar boxed frames. If the maximum luma in possible letter-box rows or pillar-box columns exceeds this setting, the frame is not considered letter-boxed or pillar-boxed.
The default value is 30.
CommDetectDarkBrightness
This setting is only used if AggressiveCommDetect is 0. See #AggressiveCommDetect for details.
The default value is 80.
CommDetectDimAverage
This setting is not used. The variable used to store it, is changed as each frame is processed to the minimum luma + 10.
The default value is 35.
CommDetectDimBrightness
A frame is considered blank if the difference between maximum and minimum lumas is less than CommDetectBlankFrameMaxDiff and the maximum luma is less than CommDetectDimBrightness. These settings are also used somewhat differently depending on the value of AggressiveCommDetect.
The default value is 125.
CommDetectLogoBadEdgeThreshold
This setting is used for logo detection.
The default value is 0.85
CommDetectLogoGoodEdgeThreshold
This setting is used for logo detection.
The default value is 0.75
CommDetectLogoSamplesNeeded
This setting is the number of frames sampled in preparation for logo detection.
The default value is 240.
CommDetectLogoSampleSpacing
This setting is the number of seconds between sampled frames in preparation for logo detection.
The default value is 2.
CommDetectMaxCommBreakLength
This setting is the maximum number of seconds in a commercial break. It is used to distinguish between a program and its commercials.
The default value is 395.
CommDetectMaxCommLength
This setting is the maximum number of seconds in an individual commercial. It is used to distinguish between a program and its commercials.
The default value is 125.
CommDetectMinCommBreakLength
This setting is the minimum number of seconds in a commercial break. It is used to distinguish between a program and its commercials.
The default value is 60.
CommDetectMinShowLength
This setting is the minimum number of seconds in a program segment. It is used to distinguish between a program and its commercials.
The default value is 65.
CommercialSkipMethod
This setting can be changed in mythfrontend via Setup -> Video -> General -> General (Jobs), and changing the combo box value for Commercial detection method. The following table translates the text values available via mythfrontend to their SkipTypes (defined in libmyth/programtypes.h and referenced in source code) and numeric values.
Commercial detection method | SkipTypes and Numeric values |
---|---|
All Available Methods | COMM_DETECT_SCENE | COMM_DETECT_LOGO = 7 |
Blank Frame Detection | COMM_DETECT_BLANK = 1 |
Blank Frame + Scene Change | COMM_DETECT_SCENE = 3 |
Scene Change Detection | COMM_DETECT_SCENE = 2 |
Logo Detection | COMM_DETECT_LOGO = 4 |
Experimental: Blank Frame + Logo Detection | COMM_DETECT_BLANK | COMM_DETECT_LOGO = 0x100 + 5 = 261 |
Pre & Post Roll: Blank Frame + Scene Change | COMM_DETECT_BLANK | COMM_DETECT_SCENE = 0x200 + 3 = 515 |
This setting can be overridden via the command line using the --method option described in the Usage section.
The default value is 7, All Available Methods.
HistogramAnalyzerDebugLevel
This setting determines what debug output is produced by the experimental blank and/or scene detection methods, --method options d2_blank, d2_scene or d2_all. See #BlankFrameDetectorDebugLevel.
The default value is 0.
JobQueueCPU
This setting is used to set the niceness of the mythcommflag process as well as its I/O priority and whether the process should run at full speed or pause every so often. The higher the value, the higher the priorities.
This setting can be changed in mythtv-setup via General -> Job Queue (Backend Specific), and changing the combo box value for CPU Usage.
The default value is 0 or Low.
SceneChangeDetectorDebugLevel
This setting determines what debug output is produced by the experimental scene detection method, --method options d2_scene or d2_all. See #BlankFrameDetectorDebugLevel.
The default value is 0.
TemplateFinderDebugLevel
This setting determines what debug output is produced by the experimental logo detection method, --method options d2_logo or d2_all. See #BlankFrameDetectorDebugLevel.
The default value is 0.
TemplateMatcherDebugLevel
This setting determines what debug output is produced by the experimental logo detection method, --method options d2_logo or d2_all. See #BlankFrameDetectorDebugLevel.
The default value is 0.
Obsolete Settings
CommFlagFast
This setting can be changed in mythfrontend via Setup -> Video -> General -> General (Jobs), and changing the checkmark for Enable experimental speedup of commercial detection. But it is unused by mythcommflag version 0.27.
CommSkipAllBlanks
You may find this in your settings table. If so, it is probably left over from an earlier version of mythtv. It is unused by mythcommflag version 0.27.
Experimenting with Settings
If you wish to experiment with these settings, I suggest doing it using an override settings file. Try different values on a troublesome recording until you get results you like, and then try it on a recording that already had good commercial marks. If you like the results on the recording that already had good commercial marks, then you may want to add the settings to the database, so they are applied to any time mythcommflag is executed, including by mythbackend.
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
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 |
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) 5150 APU with Radeon(tm) R3 | 1597.045 MHz | 3.8.0-39-generic | Medium | mpeg2video / mpg | 1920x1080 | 17013 kb/s | 155 fps |
AMD Athlon(tm) 5350 APU with Radeon(tm) R3 | 2046.231 MHz | 3.8.0-39-generic | Medium | mpeg2video / mpg | 1920x1080 | 17013 kb/s | 197 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 |
Intel(R) Pentium(R) CPU G3258 @ 3.20GHz | 4000.000 MHz | 3.8.0.42-generic | Medium | mpeg2video / mpg | 1920x1080 | 17013 kb/s | 572 fps |
AMD Athlon(tm) 5150 APU with Radeon(tm) R3 | 1597.045 MHz | 3.8.0-39-generic | Medium | mpeg2video / mpg | 1280x720 | 15211 kb/s | 351 fps |
AMD Athlon(tm) 5350 APU with Radeon(tm) R3 | 2046.231 MHz | 3.8.0-39-generic | Medium | mpeg2video / mpg | 1280x720 | 15211 kb/s | 445 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 |
Intel(R) Pentium(R) CPU G3258 @ 3.20GHz | 4000.000 MHz | 3.8.0.42-generic | Medium | mpeg2video / mpg | 1280x720 | 15211 kb/s | 1277 fps |
Intel(R) Pentium(R) CPU G3420 @ 3.20GHz | 3199.846 MHz | 3.13.0-24-generic | Medium | mpeg2video / mpg | 1280x720 | 15141 kb/s | 1106 fps |
Intel(R) Pentium(R) CPU G3420 @ 3.20GHz | 3199.846 MHz | 3.13.0-24-generic | Medium | mpeg2video / mpg | 1920x1080 | 16792 kb/s | 430 fps |
Intel(R) Core(TM) i3-4330 CPU @ 3.50GHz | 3500.000 MHz | 3.13.0-24-generic | Medium | mpeg2video / mpg | 1280x720 | 15141 kb/s | 1392 fps |
Intel(R) Core(TM) i3-4330 CPU @ 3.50GHz | 3500.000 MHz | 3.13.0-24-generic | Medium | mpeg2video / mpg | 1920x1080 | 16792 kb/s | 475 fps |
AMD Athlon(tm) 5350 APU with Radeon(tm) R3 | 2046.231 MHz | 3.13.0-32-generic | Medium | mpeg2video / mpg | 1920x1080 | 17030 kb/s | 210 fps |
Intel(R) Pentium(R) CPU G3258 @ 3.20GHz | 4000.000 MHz | 3.13.0-32-generic | Medium | mpeg2video / mpg | 1920x1080 | 17030 kb/s | 566 fps |
Intel(R) Pentium(R) CPU G3258 @ 3.20GHz | 4000.000 MHz | 3.13.0-32-generic | Medium | mpeg2video / mpg | 1280x720 | 15881 kb/s | 1238 fps |
AMD Athlon(tm) 5350 APU with Radeon(tm) R3 | 2046.231 MHz | 3.13.0-32-generic | Medium | mpeg2video / mpg | 1280x720 | 15030 kb/s | 574 fps |
Intel(R) Pentium(R) CPU G3258 @ 3.20GHz | 3200.000 MHz | 3.13.0-32-generic | Medium | mpeg2video / mpg | 1280x720 | 15030 kb/s | 1285 fps |
Intel(R) Pentium(R) CPU G3258 @ 3.20GHz | 4000.000 MHz | 3.13.0-32-generic | Medium | mpeg2video / mpg | 1280x720 | 15030 kb/s | 1603 fps |