Mythcommflag

From MythTV Official Wiki
Revision as of 19:58, 25 November 2010 by Eschvoca (Talk | contribs)

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
Valid Options are:
-c OR --chanid chanid        Flag recording with given channel ID
-s OR --starttime starttime  Flag recording with given starttime
-f OR --file filename        Flag recording with specific filename
--video filename             Rebuild the seektable for a video (non-recording) file
--sleep                      Give up some CPU time after processing each frame
--rebuild                    Do not flag commercials, just rebuild seektable
--gencutlist                 Copy the commercial skip list to the cutlist
--clearcutlist               Clear the cutlist
--setcutlist CUTLIST         Set a new cutlist.  CUTLIST is of the form:
                             #-#[,#-#]...  (ie, 1-100,1520-3012,4091-5094
--getcutlist                 Display the current cutlist
-v or --verbose debug-level  Use '-v help' for level info
--queue                      Insert flagging job into the JobQueue rather than
                             running flagging in the foreground
--quiet                      Turn OFF display (also causes the program to
                             sleep a little every frame so it doesn't hog CPU)
                             takes precedence over --blanks if given first)
--blanks                     Show list of blank frames if already in database
                             (takes precedence over --quiet if given first)
--all                        Re-run commercial flagging for all recorded
                             programs using current detection method.
--allstart YYYYMMDDHHMMSS    when using --all, only flag programs starting
                             after the 'allstart' date (default = Jan 1, 1970).
--allend YYYYMMDDHHMMSS      when using --all, only flag programs ending
                             before the 'allend' date (default is now).
--force                      Force flagging of a video even if mythcommflag
                             thinks it is already in use by another instance.
--hogcpu                     Do not nice the flagging process.
                             WARNING: This will consume all free CPU time.
-h OR --help                 This text

Note: both --chanid and --starttime must be used together
      if either is used.

If no command line arguments are specified, all
unflagged videos will be flagged.


Choosing a Recording

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

-c 1067 -s 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
--gencutlist                 Copy the commercial skip list to the cutlist
--clearcutlist               Clear the cutlist
--setcutlist CUTLIST         Set a new cutlist.
--getcutlist                 Display the current cutlist
--blanks                     Show list of blank frames if already in database


Unimplemented Options

These options appear to be unimplemented or have been removed (as of .20-fixes):

--blanks                     Show list of blank frames if already in database


Undocumented Options

These options exist in the code (as of .20-fixes), but are not documented in the help message. They are probably for internal use by MythTV.

-O/--override-setting SETTING=VAL[,SETTING=VAL...] 
override a setting loaded from the DB, where SETTING can be a variable like CommercialSkipMethod, JobQueueCPU, etc.
--method N 
specify commercial detection method N, where N is one of the values of the SkipTypes enumerated constant declared in CommDetector.h
-j N 
run the job identified by N
--dontwritetodb 
don't write the commercial break list or the status flags to the database
--onlydumpdb 
dumps the existing commercial break list (perhaps the replacement for --blanks)
--outputfile FILE 
write commercial break list (either just generated or loaded from the DB via --onlydumpdb) to FILE

Examples of Mythcommflag Jobs Speed

#!/bin/bash
#
# Script to generate wiki formatted mythcommflag report.
#
# Usage:
# 1. Download and save this script to "mythcommflag.report.sh" 
# 2. Run mythcommflag -f /var/lib/mythtv/recordings/a_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 /var/lib/mythtv/recordings/a_recording_of_your_choice.mpg"
#  - Cut and paste output and add to this website (you must first create an account to edit this page).
#

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/,//'`
FORMAT=`ffmpeg -i "$1" 2>&1 | grep Video | head -n 1 | awk '{ print $4 }' | sed -e 's/,//'`
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/index.php?title=Mythcommflag"
cat mcfreport.txt
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 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