NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums General General Discussion v
« Previous 1 … 73 74 75 76 77 … 159 Next »
Automating commercial cutting with Virtualdub-- anybody done it?

 
  • 0 Vote(s) - 0 Average
Automating commercial cutting with Virtualdub-- anybody done it?
pvrtinkerer
Offline

Junior Member

Posts: 48
Threads: 9
Joined: Jan 2007
#1
2008-02-21, 09:15 PM
I've just been processing a bunch of recordings that have been transcoded to Xvid, snipping out the commercials flagged by Comskip.

I've figured out that Comskip can be made to output Virtualdub Config Files, which save the data entry of keying in the frame numbers and automate the deletions of the flagged ads.

I've seen that Virtualdub can be invoked from the command line and passed scripts and arguments.

Rather than reinvent the wheel and experiment my way through Virtualdub's command line syntax, I'm wondering if anybody has figured out the best way to automate this totally.
Pentium D 925 underclocked to 2.0Ghz , 2GB DDR2 @ 533, 200 GB, 250GB, PVR-150, GeForce 6200, Win2k
dgeezer
Offline

Senior Member

Posts: 324
Threads: 9
Joined: Feb 2005
#2
2008-02-21, 09:26 PM
Check out this thread: http://forums.nextpvr.com/showthread.php...omatically

I still use a modified version of this with videoredo to cut out commercials. I twill give you a good start. I bet you can modify the batch file to work with virtualdub.
Server: Windows 10 - ASrock N3150DC -ITX Fanless Celeron
Clients: Shield TV with X-newa on Kodi, Asus chromebox - openelec - X-newa on Kodi
Deusxmachina
Offline

Senior Member

Posts: 545
Threads: 13
Joined: Aug 2007
#3
2008-02-21, 09:27 PM
To not reinvent the wheel, can't Staatik's auto commercial-cutter/transcoder do what you want? It slices, it dices, it turns water into wine.
I bet Michael Bay uses GBPVR because it's awesome:
http://www.youtube.com/watch?v=MiHsxQJ9ZOo
pvrtinkerer
Offline

Junior Member

Posts: 48
Threads: 9
Joined: Jan 2007
#4
2008-02-22, 03:34 AM
I prefer to be able to transcode first and snip later... which is why virtualdub is my tool of choice. It only takes 30 seconds to manually load the file, run the script, and save the results... but I'd like to be able to batch it.
Pentium D 925 underclocked to 2.0Ghz , 2GB DDR2 @ 533, 200 GB, 250GB, PVR-150, GeForce 6200, Win2k
pvrtinkerer
Offline

Junior Member

Posts: 48
Threads: 9
Joined: Jan 2007
#5
2008-02-22, 05:37 PM (This post was last modified: 2008-02-22, 05:46 PM by pvrtinkerer.)
Well, since nobody seems to have done this before, I did hack up a bit of perl to do what I want.

I've built the following, and call it at the end of postprocessing.bat with the %1 argument after comskip is done doing its thing. What it does is anticipate the filename after the auto-transcode happens, and then adds that file along with the cuts to apply to the virtualdub jobs list. That way the cutting doesn't happen until I run vdub and tell it to do it, though telling it so is a one click event, rather than an involved process.

Any perl hackers who could restate this in 3 lines or less are welcome to have a go at it.

Code:
# call the right package of tools for slicing and dicing filenames
use File::Spec;
# chop up the path into its component bits
($volume, $dirs, $file)= File::Spec->splitpath($ARGV[0]);

# Chop the .mpg off the end of the filename
substr($file, -4) = "";

# identify the destination, the avi and the vcf
# on my system I open a cut directory inside each show directory
# it is best to enclose file names in quotes before passing them, so I do.
$dest = $dirs . "cut\\";
$avi = $file . ".avi";
$vcf = "\"" . $volume . $dirs . $file . ".vcf" . "\"";
$in = $volume . $dirs . $avi;
$out = $volume . $dest . $avi;
$to = "\"" . $in . "\"" ."," ."\"" . $out . "\"";

#set the path to virtualdub
$exec="H:\\vdubmod\\virtualdubmod.exe";

#add the show to the vdub jobs list.  /s specifies the script, /p is the in and out path, /x tells vdub to close down after adding the job to the list

system ("$exec /s$vcf /p$to /x");
Pentium D 925 underclocked to 2.0Ghz , 2GB DDR2 @ 533, 200 GB, 250GB, PVR-150, GeForce 6200, Win2k
pvrtinkerer
Offline

Junior Member

Posts: 48
Threads: 9
Joined: Jan 2007
#6
2008-02-22, 10:21 PM
Hmmm... my perl script appears to pass the arguments I want to vdub... BUT, it seems that the cut scripts just don't register when submitted via the command line. :mad: It just copies the whole thing from source to destination, but doesn't knock out any of the ads.

Back to the drawing board... I guess I'm going to have to generate something that builds its own .jobs file out of the .vcf file. I wish the documentation were better for that tool.
Pentium D 925 underclocked to 2.0Ghz , 2GB DDR2 @ 533, 200 GB, 250GB, PVR-150, GeForce 6200, Win2k
mian
Offline

Member

Posts: 217
Threads: 29
Joined: Aug 2005
#7
2008-02-22, 11:40 PM
comskip used to be all the rage here. I used it a little a long time ago, but I never spent enough time tuning it to make the results to my liking. I'd still occasionally end up with too much or too little cut. Now I do it manually (projectx and cuttermaran) for shows I want to hold onto, and not at all for shows I intend to delete after watching once.
pvrtinkerer
Offline

Junior Member

Posts: 48
Threads: 9
Joined: Jan 2007
#8
2008-02-23, 03:17 PM (This post was last modified: 2008-02-23, 03:41 PM by pvrtinkerer.)
OK, I've achieved what I was shooting for: a perl script that turns the .vcf output of Comskip into a file that automatically snips commercials in an already transcoded Xvid by means of virtualdub.

Here it is for all to modify and enjoy:

Code:
# call the right package of tools for slicing and dicing filenames
use File::Spec;
# chop up the path into its component bits
($volume, $dirs, $file)= File::Spec->splitpath($ARGV[0]);

# Chop the .mpg off the end of the filename
substr($file, -4) = "";

# identify the destination, the avi and the vcf
# on my system I open a cut directory inside each show directory
$dest = $dirs . "cut\\";
$avi = $file . ".avi";
$vcf = $volume . $dirs . $file . ".vcf";
$in = "\"". $volume . $dirs . $avi . "\"";
$out = $volume . $dest . $avi;
$to = $volume . $dirs . $file . ".jobs";
#remnants of an experiment with encapsulating the path in quotes here
# vs. doing it on the spot as needed below.  Both ways work.

#open the comskip vcf output and read it into an array
open (VCF, $vcf);
@cuts=<VCF>;
close(VCF);

#Make a jobs file for this show
open (OUTPUT, "+>$to");

#write the preambular headers

print(OUTPUT "// VirtualDub job list (Sylia script format)
// This is a program generated file -- edit at your own risk.
//
// \$numjobs 1
//

// \$job \"Job 1\"
// \$input $in
// \$output \"$out\"
// \$state 0
// \$start_time 0 0
// \$end_time 0 0
// \$script \n\n");

# virtualdub requires double backslashes in some parts of the file but
# not others.  This transforms the single backslash into double.

$in=~ s/\\/\\\\/g;
$out=~ s/\\/\\\\/g;

# generate the body of the script

print (OUTPUT "VirtualDub.Open($in,\"\",0);
VirtualDub.video.SetDepth(24,24);
VirtualDub.video.SetFrameRate(0,1);
VirtualDub.video.SetIVTC(0,0,-1,0);
VirtualDub.video.SetRange(0,0);
VirtualDub.video.SetCompression();
VirtualDub.video.filters.Clear();\n");
#insert the cut data here from the array
foreach (@cuts) {
print (OUTPUT $_);
}
#finish off the file
print (OUTPUT "VirtualDub.SaveAVI(\"$out\");
VirtualDub.Close();

// \$endjob
//
//--------------------------------------------------
// \$done");

Pass the output of that to vdub with a /s and it handles everything. I might have to make postprocessing.bat output a bat file to make the whole thing a one doubleclick operation.
Pentium D 925 underclocked to 2.0Ghz , 2GB DDR2 @ 533, 200 GB, 250GB, PVR-150, GeForce 6200, Win2k
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Best way to automate commercial removal ottoguy 3 3,112 2019-04-08, 12:31 PM
Last Post: ottoguy
  greatest commercial ever johnsonx42 14 6,329 2013-05-16, 02:03 AM
Last Post: steeb
  Please recommend tools for cutting / encoding H.264 HDTV. Thunderflash 1 1,862 2010-08-31, 12:47 AM
Last Post: pcostanza
  Editing soft cuts first hour, not first commercial Jon_J 1 1,674 2009-05-06, 03:30 PM
Last Post: CornStopper
  VirtualDub error w/ PVR MP2 audio capone 4 2,280 2006-09-02, 07:44 PM
Last Post: capone
  VirtualDub - ...now a german trademark? ShiningDragon 12 4,877 2006-08-21, 09:33 AM
Last Post: dgeezer
  Cutting top edge ydekmekji 2 1,771 2006-03-11, 01:11 AM
Last Post: -stattik-

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode