![]() |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools |
Rating:
|
Display Modes |
|
||||||
|
Step by Step: Video fixing, Commercial Detection, and Removal.
I've written a series of scripts, over the past several months that do a few things the BTV can't do, out of the box, and I really wanted.
First, I wanted more accurate commercial detection than Smartskip was providing. Second, I needed a way to clean up some of my video files. I record over the air HD programming, but because I am about 30 miles from the sources of the video, I sometimes get little glitches in the video. This happens on standard definition MPG videos from time to time, also. It is usually minor and doesn't cause a lot of trouble, but it becomes a problem if that video is compressed, because of lost audio or video frames. The resulting compressed video could develop audio sync problems, if the video file isn't cleaned up, first. Third, I wanted a way to cut commercials out of certain shows, but not all shows, necessarily. Some channels and some shows have very predictable and accurate commercial detection, using Comskip. Some channels, however, and some particular shows, do not have quite enough accuracy for me to be confident in cutting them out. To solve the first problem, I tested VideoRedo's Ad Detective and Comskip. I spent a good while testing and tuning each one. In the end, I found Comskip to be much more configurable and accurate. I found a batch file, here in the forum, somewhere, that would allow me to run Comskip as a Custom Post Processing task, after recording. I modified this script a bit, to suit my needs. The Comskip batch file worked well, but it ran into some problems with video files that were a little damaged and needed some fixing up, especially HD recordings. If I ran Comskip as a Custom Post Processing task, this was run before Streamsnip (on HD recordings). Streamsnip would fix up the file a little bit, but this caused the smartchapter file that was generated by Comskip to get a little off, and get worse as you proceeded further through the video. Ideally, it would be nice to be able to run Streamsnip BEFORE all other Custom Post Processing tasks. I put requests for this feature, starting 6 months ago. I was told that it would be considered for future versions, but it has not been yet been delivered. Solving this problem takes us to the solution to the second issue. The solution to the second issue (fixing up the video) was solved by getting VideoRedo. VideoRedo is not free software, but it is a fantastic piece of software. It can be used for video editing, commercial detection and removal, or just running a "QuickStream Fix" on a video file. Quickstream Fix can take a Transport Stream or MPG file and re-save it, fixing various errors in the file, while doing so. The program is fast, works well, maintains the embedded BTV program information, and doesn't introduce errors or audio synchronization problems. No other program I tried (mostly free software) could deliver all of these features. Each had their quirks and problems. VideoRedo turned out to be worth the cost. I was able to write up a batch script (with help from the VideoRedo forums) that would take my video, output a Quickstream Fixed version of that video, and then replace the original, with this fixed version. I began running this script before the Comskip (commercial detection) script, and it worked great. My videos were smooth and error free, commercial detection was great, and compressed files didn't suffer from audio synchronization problems. This left me wanting more, which is where the third solution comes in. The solution to the third problem (removing commercials from the video file) was finally achieved once I got the first two steps working well. I modified my comskip.ini file (the settings file for Comskip) to output a VideoRedo project file, in addition to a BTV Smartchapter file. I then wrote a script to pass my videos through VideoRedo, using the VideoRedo project file (generated from Comskip) to output a new version of the video, minus the commercials. I implemented a variable-matching section in this script so it would check to see if the video file name matched certain parameters. If it did, then it got the commercials cut out. If not, the script just exited. I can do pretty simple phrase matching like "*MythBusters*" to pass all episodes of MythBusters through VideoRedo and cut out the commercials. The final video, without commercials, then replaces the original video file. I spent quite a while tweaking all of these scripts to make them very simple to pass on. There is only one variable that needs to be explicitly set and each script can be used by itself, or in combination with the other scripts. You can even copy and paste all of these into one script (which is what I generally do) and run it as one long post processing chain. Here's what you will need to set all of this up. First, you will need to go here to download the appropriate files to set up your own Custom Post Processing tasks. Next, create a directory somewhere that you're going to put your Comskip files (I put all my scripts in this directory, also.) On my system, this is "M:\MEDIA\Files_Backup\Comskip". This drive and path is one of the only pieces of information that you will need to explicitly set in the scripts, below (the comskip.bat script, specifically.) Next, download Comskip from here. Unzip these files into the Comskip directory you decided on. I'm currently running version 79_129, so my configuration files will be specific to that version. Here is the contents of my Comskip.ini file (for version 79_129). Quote:
Next, I'll talk about the actual CustomPostProcessing.xml, which is used to define what post processing tasks are run and when/how they are run. Here is an example of a CustomPostProcessing.xml file, which is located in "C:\Documents and Settings\All Users\Application Data\SnapStream\Beyond TV" Quote:
On my system, since I have seven tuners (and just added two more that aren't fully integrated, yet) I have lots of recordings starting and stopping at the same time. In noticed jumpy performance in Beyond TV Link, sometimes because several recordings might stop, several more recordings start, and several post processing jobs start, all at the same time (I have a dual-core CPU, so BTV runs two post processing tasks at a time.) To minimize this slight annoyance, I wanted to implement a script that would delay the initial beginning of my post processing tasks. It only needs to delay them for a few seconds so there aren’t as many I/O operations trying to happen at the same time. I wanted to make a script that would determine a random number and then make the system wait for a random number of seconds. I found my answer with a little Googling. Someone posted a semi-random number generator that I then used to create a small delay script that makes the system wait for 1-99 seconds. To actually implement a command to wait or delay, I installed the Windows Server 2003 Resource Kit, which can be freely downloaded here. Once this is installed, do a search on your C: drive for SLEEP.EXE. Copy this file to the C:\Windows directory and now SLEEP can be called from a command line. This very simply makes the batch file sleep (or wait) for the specified number of seconds. This SLEEP command is used in most of my scripts, so it will need to be installed. The total post processing chain of events is comprised of a Delay script, then a Quickstream Fix script, then a Comskip script, and finally the Commercial Cutting script. Although this may seem like a lot, these processes are actually fairly quick and the total processing time is not unreasonable. If you want to run these jobs during hours that you don't have to watch them popping up on your screen, you can set Time Constraints on this page: http://localhost:8129/ShowSqueezeConstraints.aspx. You can schedule all of this activity during night hours, if you prefer. My home is comprised of a BTV Server that does recordings and post processing, but I watch television from a separate BTV Link machine, so I don't have to see what goes on behind the scenes. For me, running these jobs all day isn't a problem, so I have the Time Constraints disabled. Here is the contents of the Delay.bat script: Quote:
Quote:
Quote:
Here is the contents of the Cut.bat script: Quote:
For all of these scripts to work, you should NOT have any MPG, TP, or VPRJ files on the root of your video drive. On my system, my video drive is drive V: with many folders. The QSF and CUT scripts actually output video to the root of the drive, as a temporary location. They also check the root of the drive, to see if MPG, TP, or VPRJ files already exist there. This is done as a crude method of determining whether another QSF or CUT job is already running. I try to limit the total number of concurrently-running tasks, to minimize overall system I/O. This isn't necessarily required, but I do a lot of recording and compressing, so my system has a lot of I/O, as it is. All of these scripts can be run independently or combined into one large script. If you don't need to run DELAY or QSF or CUT, you can leave out whatever parts you don't need and the remaining scripts should work just as well. There are a few recommended settings within VideoRedo. Go into Tools -> Options -> Stream Parameters and set Detect/Resync Missing Frames to "Resync- Insert Extra Video Frames". While here, make sure Double Video memory is checked and set Encoder Quality to High. On the Enhanced Plus page, check "Reduce CPU Priority While Saving". On the Transport Stream Output page, change Output Mux Rate to Manual and set Mbps to 30.000. I also usually change Abort After "5" Buffer Underflows, though I'm not entirely sure how necessary this is. *EDIT* Edited Comskip.ini settings for new version (79_98) which is significantly faster than the old version and appears to be more accurate. *EDIT 2* If you enjoy using Comskip, please consider sending the program author a donation. (Paypal erik@kaashoek.com) He deserves it! *EDIT* Edited Comskip.ini settings for version 79_111. *EDIT* Edited Comskip.ini settings for version 79_125. *EDIT* Edited with fix from post 129 and for Comskip.ini settings for Comskip 79_129. Last edited by cmcquistion; 05-01-2008 at 09:38 AM. |
|
|||
|
Re: Step by Step: Video fixing, Commercial Detection, and Removal.
Amazing amount of info.
I have been trying to figure out how to set up comskip with BTV & VRD. This goes a long way to achieving that goal. (Now I just need to understand what I need to do. )I have a reluctance to trust a software to actually cut commercials accurately. Can your script be modified to merely mark for later manual editing? Thanks for all your work and especially with sharing it with the rest of us. --Gene |
|
|||
|
Re: Step by Step: Video fixing, Commercial Detection, and Removal.
Quote:
The Cut.bat section of my script has variables you can fill in with particular show names that you want to cut. If your show isn't listed, there, then it isn't cut. You can comment out the examples I have, in there, with double colons, and those will be ignored. If there is no name matching, in that section, then your video does NOT get cut. It only gets the previous steps applied to it (fixing video and running Comskip.) In my Comskip.ini, one of the options that I have turned on is to output a VideoRedo file (in addition to the BTV smartchapter file). This VPRJ file is associated with the original video. You can use this file to cut the video, manually, if you desire. You just double-click the file, tell Windows what program to open it with (VideoRedo), and when VideoRedo opens that VPRJ file, it opens the associated video file and overlays where the commercial markings are. At that point, you just click File Save As and save the video file. While it is saving, VideoRedo will cut out those regions, highlighted in red. This is how you can manually cut the files. My script example, above, at the end of the Cut.bat section has a line that reads: "IF EXIST "%~pdn1.VPRJ" DEL /F "%~pdn1.VPRJ"" What this does is delete the VPRJ file, at the end of the all these processes, so it isn't just left out there. If you want to leave that file, so you can use it for manual cutting, just delete this line or comment it out with double colons. That will leave the VPRJ file in place. The only problem with this is that Beyond TV will not delete these files, after you've watched and deleted a show, so they will start to pile up. Personally, I use Dirmon2 to watch my video folders and clean up these leftover files, when no MPG or TP file exists, any more. In my case, I output CHP files (ZoomPlayer chapter files) also, so Dirmon2 cleans those up, also. I'll post a screenshot, below, of my Dirmon2 Global Settings screen that has all the information you need to set up a "cleanup job" using Dirmon2. By the way, if you don't necessarily want to use these scripts "live" by setting up a CustomPostProcessing step and everything, you can test these out by launching them from the command line (the manual way) or just drag and drop a video file from your BTV folder onto the icon for the batch file (batch.bat, comskip.bat, etc) or the icon for the shortcut to the batch file. This will launch a command prompt and run the batch file on that video file.
__________________
To view links or images in signatures your post count must be 3 or greater. You currently have 0 posts. Last edited by cmcquistion; 03-25-2007 at 09:58 AM. |
|
|||
|
Re: Step by Step: Video fixing, Commercial Detection, and Removal.
cmcquistion: What a great write-up! I hope I have the time to implement your solution. This info prompted me to give you an idea for improvement I think you'd like to consider.
The command below will pull a line out of a text file that you could use to store those shows you want recorded. That way the BAT file isn't being edited and you could just store this on the desktop or where ever. For /F "tokens=*" %%i in (c:\batch\Cut-shows.txt) Do c:\batch\BAT-RUN.bat %%i (all on one line of course) It would have to be modified at the "DO" statement to perform based on your criteria/shows to cut. Then when BAT-RUN.bat operates in the file you use %1 to reference the %%i name that it pulled from the file. In your case you might just use %%i and call a subroutine in the bat file. I have used this to process a command against a list in that file in which I had servers. Does this give you any help? Just a thought and I wanted to contribute. Jake
__________________
BTV Server : 4.9.2 Gigabyte eg45m-ds2h e8400, EVGA 9500, 8gb, Win 2k3 Ent w/mxd Raid 0/1 2x500, Raid 1 2x1.5T, 2xHDHR, Gyration rem, crappy 51" Rear Proj BTV Server : 4.9.2 Intel D945PVS, 3.0ghz XPMCE, MCE 500, HVR1600, 2gb, 2x500gb, EVGA 7600gt, Antec 430 TPT PSU, Firefly, SVid to AOC 32" LCD BTV Link : 4.9.2 Gigabyte P35c-DS3R e6750, ATI 3850, 2gb BTV Link : 4.9.2 Gigabyte P4 2.93ghz Cele, ATI 800, 1gb BTV Link : 4.9.2 Gigabyte 73PVM-S2H e4500, On Board 7100 w/HDMI, 2gb Love Gigabyte! |
|
|||
|
Re: Step by Step: Video fixing, Commercial Detection, and Removal.
cmcquistion: Nice work, thank you!
What is the reason for doing the QSF? I thought Videoredo does that during the cutting. Also, is there a way to specify which PID VRD will QSF? In my neck of the woods the ts show I want is often not the first PID. Thanks again.
__________________
bits To view links or images in signatures your post count must be 3 or greater. You currently have 0 posts. BTV 4.6.1/P4 2.53/1GB/nVidia FX 6200/250GB ATA/80GB ATA/Linspire Server 1.6TB/PVR250/FUSIONHDTV5 USB Gold/Firewire+DCH6416/ADVC-100/(2)Linkplayer2/CS615/XP Pro/SP2 |
|
||||
|
Re: Step by Step: Video fixing, Commercial Detection, and Removal.
I still would like BTV to give us the ability to edit commercial cuts (smartchapter or whatever) on the fly.
Picture this, post processing automatically marks what it thinks are commercial breaks. As I watch the file (with its attached xml commercial file) if I skip to a commercial point and it is wrong, I can click a button on my remote and get the option to add or delete a start/stop point. I currently do this with Videoredo before saving a new file sans commercials, basically I open the smartchapter file as a project, then skip to commercial points to make sure they are accurate, replacing them if needed. It would be great to be able to do this in BTV, and then send a process to videoredo or even to showsqueeze for archival. Specifically keeping the metadata etc. Then I could take the commercial free mpeg to make a DVD or save the commercial free DIVX.
__________________
Foxconn NF4UK8AA-8EKRS, AMD 4200-x2 2gb Corsair memory, Asus Earthmate 430, Gigabyte 9500 GT, Hauppauge HVR1600 with remote, HVR950, HVR2250, and HD PVR, ATI Remote Wonder, serial cable tuners, Directv (HD) and Antenna with Electroline cable amp. Windows XP SP2 TV Samsung LNT-466F with Yamaha RX-V663 SS receiver |
|
|||
|
Re: Step by Step: Video fixing, Commercial Detection, and Removal.
Quote:
Quote:
VideoRedo does do QSF during cutting, but I don't cut all shows. I only cut a handful of shows, regularly. Going back to my previous point, I want to have a good, smooth video to get the best possible commercial detection and markings, especially if I'm going to use that information to cut the file. Unfortunately, there isn't a way to specify what PID VRD will use (at this time). In my particular location, it picked the correct PID for every channel (OTA HD) except for an NPT subchannel (not the main NPT). The only way to know what PID the VideoRedo will pick is to try it out. There is some logic built into VideoRedo for picking the correct channel, but I don't know exactly how it works. I'm now using a HDHomeRun, in addition to my OTA HD. The HDHomeRun only records the appropriate PID. It does not record the entire channel, like OTA HD recording, so with the HDHR, it is never a problem because only one program exists in the stream.
__________________
To view links or images in signatures your post count must be 3 or greater. You currently have 0 posts. |
|
|||
|
@cmcquistion:
Looks like it is time to pickup the HDHomerun and build a new PC. My current system could handle your suggested setup but the CPU would be pegged an awful lot of the time. I am planning on building either a Core 2 EX6800 Conroe or a Core 2 Quad Q6600 Kentsfield around September of this year. Either should be able to handle the multiple cpu intensive tasks. One potential issue to solve is how to get the finished file to the correct drive and folder. I have video scattered across (5) drives and 10-15 folders. But this is a minor issue that can be handled manually until when ever! Thanks again for the hard work!!
__________________
bits To view links or images in signatures your post count must be 3 or greater. You currently have 0 posts. BTV 4.6.1/P4 2.53/1GB/nVidia FX 6200/250GB ATA/80GB ATA/Linspire Server 1.6TB/PVR250/FUSIONHDTV5 USB Gold/Firewire+DCH6416/ADVC-100/(2)Linkplayer2/CS615/XP Pro/SP2 |
|
|||
|
Re: Step by Step: Video fixing, Commercial Detection, and Removal.
Quote:
Regarding your current hardware, you should be able to run this on your current system, just fine, provided you have 1 GB of memory. My last system had an Athlon 3800+ (dual core) and 1 GB of RAM. My current system has a Core 2 Duo E4300 (the cheapest Core 2 Duo) and 2 GB of RAM, though I very rarely go over 1 GB of RAM usage and usually this only happens if a program has crashed. I also use this as my main system, so I always have multiple other applications running and hogging up memory (like Firefox).
__________________
To view links or images in signatures your post count must be 3 or greater. You currently have 0 posts. Last edited by cmcquistion; 03-27-2007 at 07:10 PM. |
|
|||
|
Re: Step by Step: Video fixing, Commercial Detection, and Removal.
CMC,
Thanks. I'm recording 2 OTA HD every night and would like to automate the following process. After recording in TP, 1. comskip.exe, 2. cut commercial, 3. encode in Xvid (using quality = 50%) I can follow your batch files for steps 1 and 2. What do I need to do for Xvid encoding? I found you participated in autoxvid thread. Have you automated this process?
__________________
Dell XPS 410, C2D E6400, 2GB DDR2, 2x F5L, 500GB HDD, 7900GS dvi out to 60" Sony LCDRP, spdif to 5.1 receiver |
|
|||
|
Re: Step by Step: Video fixing, Commercial Detection, and Removal.
Quote:
Here is an example" Quote:
Quote:
__________________
To view links or images in signatures your post count must be 3 or greater. You currently have 0 posts. |
|
|||
|
Re: Step by Step: Video fixing, Commercial Detection, and Removal.
I thought I would mention that I just looked at my Showsqueeze logs and for a one-hour MPG show, it only took 18 minutes to run Quickstream fix, then Comskip, then cut out the commercials. This is on my Intel Core 2 Duo E4300, which is overclocked to 3 GHz (@ 1.425 Vcore). None of these programs (VideoRedo or Comskip) are multi-threaded, so they only use one CPU Core, effectively. I can run two jobs at once and see only a very small performance penalty.
TP files, of course, take longer than MPG files to process because of their higher bitrate and resolution. If I had to guess, I would say that they typically take 2-3 times as long as MPG files. VideoRedo is faster than Snapstream's Streamsnip, for trimming Transport Streams (and VideoRedo's Quickstream fix does more actions and does them better.) VideoRedo runs very quickly on MPG files, typically taking less than 2 minutes for a one-hour MPG show. Comskip, likewise, is significantly faster than Snapstream's Smartchapter generation, while doing a more accurate job and offering the abillity to tweak it's settings.
__________________
To view links or images in signatures your post count must be 3 or greater. You currently have 0 posts. |
|
|||
|
Re: Step by Step: Video fixing, Commercial Detection, and Removal.
Not to offend ---
VideoReDo is not a very good program to use for correcting "errors." As evidence ... I had been having problems ShowSqueezing some MPG files (analog recordings from VCR tapes using BeyondTV). One particular problem was that ShowSqueeze reduced 3hr programs to 1 to 1-1/2 hr. Clearly the problem must be "errors" in the digital file. I tried VideoReDo (Quickstream Fix) on the MPG files and the "fixed" MPG files came out to be about the same length 1 to 1-1/2 hrs. "Proof" that the files had errors. Not so fast. I had several 3 hr MPG files that when ShowSqueeze came out 3 hr (WMP format). Ran those MPG files through VideoReDo (Quickstream Fix). Came out 1 to 1-1/2 hr long. Clearly VideoReDo does not work out of the box. While I am sure that with enough time one can make VideoReDo work on some files, VideoReDo is not the solution claimed. The amazing part of this is ALL the original MPG files play perfectly with a number of different software packages - including BeyondTV and VideoReDo. --- I did contact the VideoReDo people with a great offer if they could make their product work but ...
__________________
Athlon64 X2 4600+; 2GB memory Built my own wooden case - curly cherry:
|
|
||||
|
Re: Step by Step: Video fixing, Commercial Detection, and Removal.
I have to disagree here. I consider Videoredo the last resort in fixing a file before I give up. It will play back most corrupted formats, make them playable and correct audio sync issues. I took a 3+ hour tp of the NFC playoffs that picked up enough dropped frames to be corrupt in btv, ran a quickstream fix and poof, 3hr+ of playable HD video. I have never had a problem created by videoredo, and most problems it has fixed. Any problem it hasn't been able to fix nothing else has been able.
Now, I still use other software when building mpg files, but video redo and joiner are the best and quickest for cutting out or joining together.
__________________
Foxconn NF4UK8AA-8EKRS, AMD 4200-x2 2gb Corsair memory, Asus Earthmate 430, Gigabyte 9500 GT, Hauppauge HVR1600 with remote, HVR950, HVR2250, and HD PVR, ATI Remote Wonder, serial cable tuners, Directv (HD) and Antenna with Electroline cable amp. Windows XP SP2 TV Samsung LNT-466F with Yamaha RX-V663 SS receiver |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Fixing DVD Burning plugin step 6 of 9 failure | ky90025 | Beyond TV and Beyond TV Link User-to-User Troubleshooting & Support Forum | 1 | 11-07-2007 10:21 AM |
| Fixing DVD Burning plugin step 6 of 9 failure | ky90025 | Beyond TV and Beyond TV Link | 0 | 10-29-2007 04:10 PM |
| Step by Step understanding | jviola | Beyond TV and Beyond TV Link User-to-User Troubleshooting & Support Forum | 3 | 03-06-2006 01:12 PM |
| Software - step by step | cgrey | Beyond TV and Beyond TV Link User-to-User Troubleshooting & Support Forum | 4 | 10-09-2003 02:46 PM |
| Please...step-by-step to play video on networked PC | wsalopek | Beyond TV and Beyond TV Link User-to-User Troubleshooting & Support Forum | 7 | 10-09-2002 08:54 PM |