Author |
Message |
maw1082
|
Posted: Sun Jan 07, 2007 12:24 pm |
|
Joined: Sat Mar 04, 2006 12:37 pm
Posts: 3
|
I am running into a problem trying to remove commercials from my recorded programs. I have set up a user job to do the following
1. Flag
mythcommflag -f $VIDEODIR/$FILENAME
2. GenerateCutlist
mythcommflag --gencutlist -f $VIDEODIR/$FILENAME
3. Transcode with lossless MPEG-2 and use cutlist to remove commercials
mythtranscode --honorcutlist --showprogress -i $VIDEODIR/$FILENAME -o $VIDEODIR/$FILENAME.tmp -m
After running these commands, I thought I should have a file with a .tmp extension that should be equivalent to the original except with the commercials cut out. I used http://www.mythtv.org/wiki/index.php/Removing_Commercials#Troubleshooting to help m create this script. The script loads and runs without errors. The problem is that the new file is almost identical in size and length to the original. Only a few seconds are edited out.
My system config (Knoppmyth R5E50 frest install)
BFG nForce4 PCIExpress
AMD Opteron 170
1 GB pc3200 ram
Nvidia Geforce 6600
500 gb Seagate SATA hdd
2xPVR150
Seriously in need of some help here . . . my eventual goal is to get this cutlist to work so i can encode to a lighter format like xvid. thanks[/url]
|
|
Top |
|
 |
whoa
|
Posted: Thu Jan 25, 2007 7:10 am |
|
Joined: Fri Oct 07, 2005 7:18 am
Posts: 77
Location:
Dallas, TX
|
I'd be extremely interested in this as well. I'm not a linux guru or a programmer but I do know "stuff" and am willing to help where ever I can.
|
|
Top |
|
 |
alien
|
Posted: Thu Jan 25, 2007 8:10 am |
|
Joined: Mon Jun 21, 2004 5:28 am
Posts: 700
Location:
Germany
|
Did you check in mythtv if a cutlist flagging the commercials was created before you transcoded? Commercial flagging doesn't always work very well.
_________________ ASUS AT3N7A-I (Atom 330) TBS 8922 PCI (DVB-S2)
|
|
Top |
|
 |
whoa
|
Posted: Sat Jan 27, 2007 8:56 am |
|
Joined: Fri Oct 07, 2005 7:18 am
Posts: 77
Location:
Dallas, TX
|
It appears that the commercial flagging happens correctly, but I see errors in the user jobs. Here's what I got after a show was recorded:
2007-01-27 07:00:30.219 AFD: Opened codec 0x8180260, id(MP2) type(Audio)
2007-01-27 08:00:00.287 TVRec(1): Changing from RecordingOnly to None
2007-01-27 08:00:00.338 Finished recording Heavy Metal "Blackbird Stealth!": channel 1047
2007-01-27 08:00:00.384 Reschedule requested for id 0.
[mpeg @ 0xb736f7f0]Parser not found for Codec Id: 94210 !
0: start_time: 0.036 duration: 323.603
1: start_time: 1492.666 duration: 323.670
2: start_time: 0.026 duration: 323.572
stream: start_time: 0.287 duration: 20181.222 bitrate=930 kb/s
2007-01-27 08:00:00.640 AFD: Opened codec 0x82a8620, id(MPEG2VIDEO) type(Video)
2007-01-27 08:00:00.736 AFD: Opened codec 0x829e540, id(MP2) type(Audio)
2007-01-27 08:00:01.712 Finished recording Heavy Metal "Blackbird Stealth!": channel 1047
2007-01-27 08:00:03.191 Scheduled 326 items in 2.8 = 0.00 match + 2.80 place
2007-01-27 08:00:06.910 RingBuf(/myth/tv/1047_20070127070000.mpg): Waited 1.0 seconds for data to become available...
2007-01-27 08:00:07.920 RingBuf(/myth/tv/1047_20070127070000.mpg): Waited 2.0 seconds for data to become available...
[mpeg2video @ 0xb72d64a8]ac-tex damaged at 3 9
[mpeg2video @ 0xb72d64a8]Warning MVs not available
2007-01-27 08:00:08.685 JobQueue: Commercial Flagging Finished, 4 break(s) found.
[mpeg @ 0xb736f7f0]Parser not found for Codec Id: 94210 !
0: start_time: 0.036 duration: 323.603
1: start_time: 1492.666 duration: 323.670
2: start_time: 0.026 duration: 323.572
stream: start_time: 0.287 duration: 20181.222 bitrate=930 kb/s
2007-01-27 08:00:08.704 AFD: Opened codec 0x828f400, id(MPEG2VIDEO) type(Video)
2007-01-27 08:00:08.705 AFD: Opened codec 0x8203690, id(MP2) type(Audio)
2007-01-27 08:00:25.187 JobQueue: Started "User Job #1 - Flag" for "Heavy Metal" recorded from channel 1047 at Sat Jan 27 07:00$
2007-01-27 08:00:26.236 Using runtime prefix = /usr
2007-01-27 08:00:26.356 New DB connection, total: 1
mythcommflag: ERROR: Unable to find DB info for
2007-01-27 08:00:26.395 JobQueue: Finished "User Job #1 - Flag" for "Heavy Metal" recorded from channel 1047 at Sat Jan 27 07:0$
2007-01-27 08:00:30.205 JobQueue: Started "User Job #2 - GenerateCutlist" for "Heavy Metal" recorded from channel 1047 at Sat J$
2007-01-27 08:00:30.451 Using runtime prefix = /usr
2007-01-27 08:00:30.490 New DB connection, total: 1
mythcommflag: ERROR: Unable to find DB info for
2007-01-27 08:00:30.510 JobQueue: Finished "User Job #2 - GenerateCutlist" for "Heavy Metal" recorded from channel 1047 at Sat $
2007-01-27 08:00:35.222 JobQueue: Started "User Job #3 - Transcode" for "Heavy Metal" recorded from channel 1047 at Sat Jan 27 $
2007-01-27 08:00:35.535 Using runtime prefix = /usr
2007-01-27 08:00:35.572 New DB connection, total: 1
2007-01-27 08:00:35.583 Enabled verbose msgs: important
2007-01-27 08:00:35.584 Couldn't deduce channel and start time from
2007-01-27 08:00:35.629 Couldn't open input file, error #-6
2007-01-27 08:00:35.638 JobQueue: Finished "User Job #3 - Transcode" for "Heavy Metal" recorded from channel 1047 at Sat Jan 27$
2007-01-27 09:30:28.873 MainServer::HandleAnnounce Monitor
2007-01-27 09:30:28.875 adding: mythserver as a client (events: 0)
So now my question is - can someone please verify that the script commands that maw1082 listed are correct?
|
|
Top |
|
 |
whoa
|
Posted: Sun Feb 25, 2007 8:15 pm |
|
Joined: Fri Oct 07, 2005 7:18 am
Posts: 77
Location:
Dallas, TX
|
To add to this thread (still could use some help)...
I am using mythweb's checkbox to flag commercials and looking at the backend logs - it seems to find them pretty well (for every hour of video it gets typically 5 commercial breaks).
I am also using a script found here:
http://www.mythtv.org/wiki/index.php/Sc ... ommercials
to gen the cutlist and to do the transcoding, however looking at the backend logs I am getting the following error:
ERROR 1045 (28000): Access denied for user 'mythtv'@'localhost' (using password: NO)
which seems to interrupt the script at the first commercial cut. What do I need to do to insert my password for the user 'mythtv'@'localhost' part of this script?
|
|
Top |
|
 |
whoa
|
Posted: Tue Feb 27, 2007 1:08 pm |
|
Joined: Fri Oct 07, 2005 7:18 am
Posts: 77
Location:
Dallas, TX
|
Further update:
Code: ERROR 1045 (28000): Access denied for user 'mythtv'@'localhost' (using password: NO) was fixed by adding in a username and PW to the MySQL request w/i the script and then adding in that username/pw acces to MySQL so now the script runs without errors but like the original poster only a small portion of the file is edited out. Here's the output from the scripts execution: Code: root@mythserver:/usr/local/bin# removecommercials /myth/tv 1020_20070225230000.mpg 2007-02-27 13:47:18.891 Using runtime prefix = /usr 2007-02-27 13:47:18.989 New DB connection, total: 1 2007-02-27 13:47:19.011 mythcommflag version: 0.20.20060828-3 www.mythtv.org 2007-02-27 13:47:19.016 Enabled verbose msgs: important
MythTV Commercial Flagger, started at Tue Feb 27 13:47:19 2007 Flagging commercial breaks for: ChanID Start Time Title Breaks ------ -------------- ----------------------------------------- ------ 2007-02-27 13:47:19.020 New DB connection, total: 2 1020 20070225230000 Smallville 2007-02-27 13:47:19.057 Using protocol version 31 0: start_time: 0.034 duration: 323.450 1: start_time: 0.032 duration: 323.412 stream: start_time: 0.360 duration: 3593.905 bitrate=4959 kb/s 100%/242fps[mpeg2video @ 0xb726a4a8]ac-tex damaged at 19 0 [mpeg2video @ 0xb726a4a8]Warning MVs not available 6
Finished commercial break flagging at Tue Feb 27 13:54:44 2007
2007-02-27 13:54:44.964 Using runtime prefix = /usr 2007-02-27 13:54:45.096 New DB connection, total: 1 2007-02-27 13:54:45.143 New DB connection, total: 2 2007-02-27 13:54:45.463 Using runtime prefix = /usr 2007-02-27 13:54:45.500 New DB connection, total: 1 2007-02-27 13:54:45.510 Enabled verbose msgs: important 2007-02-27 13:54:45.515 New DB connection, total: 2 2007-02-27 13:54:45.534 Using protocol version 31 0: start_time: 0.034 duration: 323.450 1: start_time: 0.032 duration: 323.412 stream: start_time: 0.360 duration: 3593.905 bitrate=4959 kb/s 2007-02-27 13:54:45.809 New DB connection, total: 3 2007-02-27 13:54:45.820 Switching to MPEG-2 transcoder. Mux rate: 6.49 Mbit/s 2007-02-27 13:54:50.899 4.3% complete 2007-02-27 13:54:55.922 7.9% complete 2007-02-27 13:55:00.923 11.8% complete 2007-02-27 13:55:05.930 13.8% complete 2007-02-27 13:55:10.940 16.9% complete 2007-02-27 13:55:15.945 20.7% complete 2007-02-27 13:55:20.946 24.2% complete 2007-02-27 13:55:25.959 27.8% complete 2007-02-27 13:55:30.964 30.7% complete 2007-02-27 13:55:35.978 32.8% complete 2007-02-27 13:55:41.019 35.3% complete 2007-02-27 13:55:46.031 38.0% complete 2007-02-27 13:55:51.035 40.9% complete 2007-02-27 13:55:56.066 43.9% complete 2007-02-27 13:56:01.067 47.0% complete 2007-02-27 13:56:06.084 49.6% complete 2007-02-27 13:56:11.097 52.4% complete 2007-02-27 13:56:16.114 55.2% complete 2007-02-27 13:56:21.131 58.0% complete 2007-02-27 13:56:26.137 60.4% complete 2007-02-27 13:56:31.143 63.2% complete 2007-02-27 13:56:36.144 65.9% complete 2007-02-27 13:56:41.162 68.5% complete 2007-02-27 13:56:46.167 71.2% complete 2007-02-27 13:56:51.168 74.0% complete 2007-02-27 13:56:56.195 76.5% complete 2007-02-27 13:57:01.214 79.3% complete 2007-02-27 13:57:06.245 82.1% complete 2007-02-27 13:57:11.268 84.8% complete 2007-02-27 13:57:16.288 87.7% complete 2007-02-27 13:57:21.298 90.6% complete 2007-02-27 13:57:26.314 93.4% complete 2007-02-27 13:57:31.316 96.6% complete 2007-02-27 13:57:36.325 99.4% complete 2007-02-27 13:59:01.190 Using runtime prefix = /usr 2007-02-27 13:59:01.335 New DB connection, total: 1 2007-02-27 13:59:01.418 mythcommflag version: 0.20.20060828-3 www.mythtv.org 2007-02-27 13:59:01.418 Enabled verbose msgs: important
MythTV Commercial Flagger, started at Tue Feb 27 13:59:01 2007 Rebuilding SeekTable(s) for: ChanID Start Time Title Status ------ -------------- ----------------------------------------- ------ 2007-02-27 13:59:01.482 New DB connection, total: 2 1020 20070225230000 Smallville 2007-02-27 13:59:01.779 Using protocol version 31 0: start_time: 0.034 duration: 323.450 1: start_time: 0.032 duration: 323.412 stream: start_time: 0.360 duration: 3593.905 bitrate=4959 kb/s 60%/ 957fps2007-02-27 14:00:12.455 RingBuf(/myth/tv/1020_20070225230000.mpg): Waited 1.0 seconds for data to become available... 100%/ 1015fps2007-02-27 14:00:49.892 RingBuf(/myth/tv/1020_20070225230000.mpg): Waited 1.0 seconds for data to become available... 2007-02-27 14:00:50.902 RingBuf(/myth/tv/1020_20070225230000.mpg): Waited 2.0 seconds for data to become available... Rebuilt
Finished commercial break flagging at Tue Feb 27 14:00:55 2007
2007-02-27 14:00:56.291 Using runtime prefix = /usr 2007-02-27 14:00:56.408 New DB connection, total: 1 2007-02-27 14:00:56.440 New DB connection, total: 2 2007-02-27 14:00:56.608 Cutlist set to: root@mythserver:/usr/local/bin#
So where the heck is the script going wrong at? Commercial flagging or in the actual removal of the commercials? Anyone...
|
|
Top |
|
 |
whoa
|
Posted: Wed Mar 07, 2007 7:00 am |
|
Joined: Fri Oct 07, 2005 7:18 am
Posts: 77
Location:
Dallas, TX
|
This one is solved - here's how:
1. Create a script file (I named it appropriately "removecommercials") in /usr/local/bin/
2. Here's the code (please note that near line 46 you need to add in a username/pw which has access to MySQL):
Code: #!/bin/sh VIDEODIR=$1 FILENAME=$2 CHANID=$3 STARTTIME=`echo $4 | sed -e 's/\([0-9]\{4\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1-\2-\3-\4-\5/'` ERROR=$? if [ $ERROR -ne 0 ]; then echo "Copying cutlist failed for ${FILENAME} with error $ERROR" exit $ERROR fi # Sanity checking, to make sure everything is in order. if [ -z "$VIDEODIR" -o -z "$FILENAME" ]; then echo "Usage: $0 <VideoDirectory> <FileName>" exit 5 fi if [ ! -f "$VIDEODIR/$FILENAME" ]; then echo "File does not exist: $VIDEODIR/$FILENAME" exit 6 fi # The meat of the script. Flag commercials, copy the flagged commercials to # the cutlist, and transcode the video to remove the commercials from the # file. mythcommflag -f $VIDEODIR/$FILENAME ERROR=$? if [ $ERROR -gt 126 ]; then echo "Commercial flagging failed for ${FILENAME} with error $ERROR" exit $ERROR fi mythcommflag --gencutlist -f $VIDEODIR/$FILENAME ERROR=$? if [ $ERROR -ne 0 ]; then echo "Copying cutlist failed for ${FILENAME} with error $ERROR" exit $ERROR fi mythtranscode --mpgeg2 --honorcutlist -c $CHANID -s $STARTTIME -o $VIDEODIR/$FILENAME.tmp --showprogress ERROR=$? if [ $ERROR -ne 0 ]; then echo "Transcoding failed for ${FILENAME} with error $ERROR" exit $ERROR fi mv $VIDEODIR/$FILENAME $VIDEODIR/$FILENAME.old mv $VIDEODIR/$FILENAME.tmp $VIDEODIR/$FILENAME mythcommflag -f $VIDEODIR/${FILENAME} --rebuild ERROR=$? if [ $ERROR -ne 0 ]; then echo "Rebuilding seek list failed for ${FILENAME} with error $ERROR" exit $ERROR fi mythcommflag --clearcutlist -f $VIDEODIR/$FILENAME ERROR=$? if [ $ERROR -eq 0 ]; then # Fix the database entry for the file cat << EOF | mysql --user=<Insert user name here> --password=<insert PW here> mythconverg UPDATE recorded SET cutlist = 0, filesize = $(ls -l $VIDEODIR/$FILENAME | awk '{print $5}') WHERE basename = '$FILENAME'; EOF exit 0 else echo "Clearing cutlist failed for ${FILENAME} with error $ERROR" rm /usr/video/$FILENAME.tmp exit $ERROR fi 3. In mythtv-setup create a user job (I named it appropriately "removecommercials") Code: removecommercials %DIR% %FILE% %CHANID% %STARTTIME% 4. may need to do some permission stuffs Code: chmod 755 /usr/local/bin/removecommercials
Thats pretty much it. I have seen repeated posts which lead me down the same paths as to why commercial removal wasn't working using the mythtranscode command and simply put the issue is that the money switch "--honorcutlist" only works if you use the -c -s switches and NOT the -i -o switches. you can try til yer blue in the face - IT WONT WORK... Use the -c -s switches and you will get it to work.
|
|
Top |
|
 |
maw1082
|
Posted: Wed Mar 07, 2007 1:18 pm |
|
Joined: Sat Mar 04, 2006 12:37 pm
Posts: 3
|
Interesting. I kind of gave up on this method shortly after posing this question. I am excited to try this out.
Instead of continuing with the transcode method, i used a modified myth2ipod script to export to xvid format, which seems to work quite well.
|
|
Top |
|
 |
drutherford
|
Posted: Sat Apr 07, 2007 12:25 pm |
|
Joined: Mon Oct 23, 2006 3:16 pm
Posts: 12
|
Whoa,
Nice script to remove commercials, however I seem to be having one small problem with it. I followed your directions and the script does get started well and runs without errors through the generation of the cutlist with mythcommflag --gencutlist. However, while the log (in the frontend) indicates that the script runs fine without errors, the size does not change. Upon more in depth probing, I noticed that an error appears in the backend log in /var/log/myth when it attempts to transcode.
You point out a difference in the -i -o flags vs. the -c -s flags and from what I can deduce the format of either the $CHANID or $STARTTIME within the script is not matching the recording either in the mysql database or the file name in /myth/tv/.
If I run this script then run "transcode" within the "Jobs" on the GUI it produces the desired mpeg file without commercials. I would like to get this to work in one step however. Any thoughts on this?
drutherford
|
|
Top |
|
 |
whoa
|
Posted: Tue Apr 17, 2007 10:59 pm |
|
Joined: Fri Oct 07, 2005 7:18 am
Posts: 77
Location:
Dallas, TX
|
drutherford,
I'm not sure what you are having an issue with, but I can offer some suggestions as to where you can trouboeshoot your problem(s) to.
In the "removecommercials" script you can do the script manually to see exactly where yer setup is goin awry. In case you dont understand - either at the console to yer myth box or using an SSH session - open a shell somehow and execute each command you see in the script manually and see what happens. If it runs all the way through then yer end product should be yer recorded video minus most of the commercials.
Something else to try is to execute the removecommercials script but enterring your own values. Again - open a shell somehow and then execute removecommercials pointed at a file
Code: root@mythserver:~# removecommercials /myth/tv/ 1064_20070416220000.mpg 1064 2007-04-16-22-00-00
I do this frequently when I see a video file which isn't 3/4 the size of the original. Typically theres some sort of segmentation fault which causes the mythcommflag command to error out
I dont log in much unless there's a new release or I wanna figure out something thats buggin me, so post yer problems and I'll check back sometime in the near future.
|
|
Top |
|
 |
drutherford
|
Posted: Wed Apr 18, 2007 11:22 pm |
|
Joined: Mon Oct 23, 2006 3:16 pm
Posts: 12
|
Whoa,
Thanks for the suggestion. The script removecommercials did work from the commandline and in doing this exercise, I figured out the problem.
In the script I downloaded (from the wiki as per your Feb post) it uses sed to format the $STARTTIME variable incorrectly. While it is very close to correct, one hypen is missing and causing mythtv to be unable to find the video file.
Instead of this format (correct): 2007-04-18-23-00-00
$STARTTIME is in this format : 2007-04-18-23-0000
When I modified the line with sed in it to add the hypen between the minutes and seconds of the video file, it worked from the frontend and as a User Job.
A minor flaw, but a real headache to figure out.
Hope this helps someone else and thanks for your reply.
drutherford
|
|
Top |
|
 |
drutherford
|
Posted: Wed Apr 18, 2007 11:32 pm |
|
Joined: Mon Oct 23, 2006 3:16 pm
Posts: 12
|
to clarify my previous post,
the script I am using and referring to is actually NOT the one in the wiki, but the modified script that appears in whoa's post on Mar 7th (two posts below the wiki reference). Sorry for the confusion.
drutherford
|
|
Top |
|
 |