View Full Version : cutting ads in gknot
Sci-Fi-Fan
11th February 2004, 14:57
currently im using a standalone phillips dvd recorder to capture tv to dvd, i then rip and encode the dvd to xvid using dvd2avi/ gknot / virtualdubmod, what i would like to know is if there is any way to delete specific frame ranges (ie cut the adverts) before encoding?, at the moment im doing this by ripping the dvd in 4 seperate parts by using dvd2avi to extract the sections between the adverts creating 4 .d2v files and then encoding each part seperately and finally joining the 4 parts together with nandub.
but this makes the process much more long winded and causes problems for some players as each part uses a different bitrate in order to achieve the desired final file size.
i would much rather be able to encode the whole program in 1 go with 1 bitrate and just delete the unwanted frames on the fly so to speak.
i've thought about encoding the whole dvd/program 1st then cutting the ads, but then 1 can only cut on a keyframe boundry which would either leave snippets of the ads or cut into the program parts.
any suggestions/ideas apreciated
thanx
jggimi
11th February 2004, 16:07
You can use the Trim() filter, but this will not include audio unless you add your soundtrack to the script. If your audio is LPCM, extract it from the .vob set in DVD2AVI, then use WavSource() and AudioDub() to add the soundtrack. If your delay is not 0ms, use DelayAudio() as well.
To make it easy to find the frames and build the Trim() filter, you can open the script with VdubMod. It has a built in script editor which can take your cuts and build the Trim() commands for you.
Sci-Fi-Fan
11th February 2004, 16:28
are there any guides/tutorials to using the above method as i have had no previous experiance.
thanx for the help:)
Sci-Fi-Fan
11th February 2004, 17:52
i've been playing with the script editor in vdubmod inserting various
Trim() ranges
if i understand it correctly the Trim() directive will trim the video clip so that it includes only the specified frame range, first_frame through to last_frame
Trim(clip clip, int first_frame, int last_frame)
using multiple Trim() directives to include 4 program segments and exclude the 3 segments of adverts does not appear to work.
only the 1st Trim() directive is processed to include the 1st segment of the clip, but the rest appear to be ignored.
jggimi
11th February 2004, 17:54
No guides that I'm aware of. The AviSynth manual is available at www.avisynth.org and you may find it helpful.
I'll try to create a step-by-step guide for you. Please forgive me if I miss a step or make something otherwise unclear. Open your .vob set from your capture in DVD2AVI, set your start and end points with [ and ], create your .d2v and demux your soundtrack.
If your soundtrack is not already Linear PCM (.wav), convert it to .wav format with BeSweetGUI.
Open your .d2v in Gordian Knot. Do what you normally would for a processing setup. Obviously, you will be removing advertisements, so you may allow for lower percentages from your compressibility tests.
Press the "Save & Encode" button on the Preview window, which will cause the "Save .AVS" window to appear with resing, noise reduction, and other options. Select those options you normally would. But rather than pressing "Save & Encode" --- Press the "Edit" button instead.
Add the soundtrack to your script. At the bottom of your script, add the following lines:sound=WavSource("C:\your_folder\your_soundtrack_with_Delay_<milliseconds>.wav")
AudioDub(last,sound)
DelayAudio(your delay in seconds)The variable "sound" is a temporary variable assigned to the soundtrack clip. The variable "last" is a special variable, and refers to the video in the Gknot created script above your entries. AudioDub joins the two into a single clip, and DelayAudio adjusts the audio if your delay is not 0ms. Use positive or negative values as described in the filename produced by DVD2AVI, but multiply by 1000 to convert from milliseconds to seconds. For more details, refer to the AviSynth manual link I provided above.
Press the "Preview" button. If you see any video or hear any audio, you can stop the preview as the script works. If you see a syntax error, fix it and press "Preview" again to test it.
Once the script is working, press the "Save" button and Save your .avs script. You may leave GKnot's GUI open, but for now, start VdubMod, and open the just saved .AVS file.
Trim is designed to keep frames, not excise them. So to use VdubMod to make this easy, select and delete each section you wish to remove using the Home, End, and Delete keys (or the Edit menu). When you're ready to apply these deletions to the .avs script, open the script editor (Tools...Script Edit or CTRL-E), select the empty line below the script and press CTRL-I to add a series of Trim commands that will remove your deletions and keep the rest of the video and audio intact.
From the script editor, you can do a File...Save and Refresh (F5), which will reload the script with your edits. Check to make sure the trim commands worked properly, and excised the sections you wanted removed.
Save the edited audio track from VdubMod: Streams...Streams List...Save WAV.
Edit the script one last time, and add a KillAudio() at the end to remove the WAV soundtrack from the script, now that the soundtrack has been extracted into a separate file. It will prevent the soundtrack from being processed while the video is encoded.
From Gknot, select the Encoder tab and Add Job. From the Audio 1 tab, select the .wav file you just created, and set the delay to 0ms, since you've adjusted the delay in the script earlier, and convert to .mp3 with your usual settings. From the Video tab, select your AVS file and proceed as normal.
jggimi
11th February 2004, 18:04
One error I just noticed in my step-by-step guide. You can get more accurate compresibility tests if you do them after the edits rather than before. You may wish to remove the resizing filter from the Gknot-created script, and then open the edited .avs when you return to Gknot, rather than go straight to encoding from the edited script. If so, when you return to Gknot you can open the .avs, set the appropriate aspect ratio, and proceed normally. Note that you will have trouble with .avs scripts that open .avs scripts if the video stream in the .vobs is in YV12 colorspace. If you have color trouble, such as a green image, add a ConvertToYUY2() to your script along with the KillAudio().
Sci-Fi-Fan
11th February 2004, 18:34
thank you very much for taking the time to answer my questions, i will give your guide a go and let you know how i get on:)
Sci-Fi-Fan
12th February 2004, 10:51
I completed an encode last night using your guide 100% success,
perfect result first try:)
Thanx Again
jggimi
12th February 2004, 14:06
:thanks: Thanks for letting me know it worked well for you. You're welcome.
ukb007
15th February 2004, 08:57
Jiggmi should think about it. Or has it already featured in the Guides' List ?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.