Log in

View Full Version : Cutting .avi or HDTV .tp format


westcam
13th July 2005, 12:28
First of all don't shout why don't you use search, i use it and non of this match so i creat this thread.

I recorded a HDTV .tp format and as usual the tv show has commercial ads break so i wonder if there is a special application that can cut those commercial ads from the tv show and merg them as one .avi file. can it be done with .tp file or after it encoded to xvid .avi then cut it later?

can VirtualDub perform that task? if it can, please write step by step because i am new to this.

THANKS ;)

edit: spelling

Raziel6969
13th July 2005, 12:59
Hello,

I don't know how to cut .tp files (i don't use them), but if you can convert to avi, virtualdub is the way to split avi without reencoding in the mode "DirectStreamCopy" (to me). I think that cut is a keyframe level, then is better to setup a low keyframe (<10) to cut, because if you use a large kf, the cut will don't stay near :P

Maybe another better way ;) . I hope that it helps.

Bye.

westcam
13th July 2005, 18:43
how do you make low kf? what steps?

LocalH
13th July 2005, 19:43
Actually, when you're working with a .tp file (which seems like it's more or less a direct copy of the HDTV transport stream), you have no say over the keyframe spacing, since that's under control of the encoder. I recommend using a combination of VirtualDub(Mod) and Avisynth in order to get rid of the commercials and then encode to an AVI at whatever resolution you choose. Basically, you need to load the source up in VirtualDub (I recommend doing this through an Avisynth script, so that you can ensure that the frame values you see will be directly usable in your script). Go through and time out the show, something like this (numbers pulled out of my ass, assuming a three segment show at 30fps with two minute breaks):

Begin Len End
+-----+-----+-----+
Seg1 |00000|14400|14400|
CM 1 |14400|03600|18000|
Seg2 |18000|14400|32400|
CM 2 |32400|03600|36000|
Seg3 |36000|14400|50400|
CM 3 |50400|03600|54000|
+-----+-----+-----+

Then take and write an Avisynth script something along these lines (since I don't deal with HD sources, I'm not sure if you'd use mpeg2source or DirectShowSource, so this goes after that):

Trim(0,14400)++Trim(18000+32400)++Trim(36000,50400)

If you're going to resize it down, you'll want to put a resize filter after the trim, something like LanczosResize(640,352) if you're aiming for a 640-wide video. You also might have to tweak your frame numbers a tiny bit, if you have any flash frames from the commercial break. You probably won't have to do anything more than checking each segment (you can do that as a test by commenting out that line of code above and putting each Trim by itself, then if there are flash frames at the beginning or end you can easily change the frame numbers, and you won't have to change it more than maybe one frame on each end of a segment)..

westcam
14th July 2005, 04:55
LocalH: thanks for writing all those codes but i have no idea what are they and how to use it.

can this just be done with .avi file like.. i encode the whole tv show to an avi file then i cut out commercial-ads and rejoin it back. i think that make life easier.

please write the step how to cut .avi in VirtualDubMod.

THANKS!!

E-Male
14th July 2005, 05:10
it's better to cut before (or while) encoding for variouse reasons

familiarize yourself with avisynth and those "trim()" command will soon be very easy

westcam
17th July 2005, 08:29
Heheh.. i found this Cutting guide http://www.divx-digest.com/articles/cutavi.html yeh.. Thank you very much :D

:thanks:

stax76
17th July 2005, 09:09
imho it's not good cutting MPEG2 or AVI but cut while encoding meaning you simply don't encode what you want to be left out. You can achieve this with AviSynth, VirtualDub or VirtualDubMod.

I've done two applications that try to make this a little bit easier. AVSEdit cuts with AviSynth and DVX cuts with VirtualDubMod. Cutting is done in the the preview dialog in DVX and AVSEdit. Hope this helps.

westcam
18th July 2005, 02:44
imho it's not good cutting MPEG2 or AVI but cut while encoding meaning you simply don't encode what you want to be left out. You can achieve this with AviSynth, VirtualDub or VirtualDubMod.

I've done two applications that try to make this a little bit easier. AVSEdit cuts with AviSynth and DVX cuts with VirtualDubMod. Cutting is done in the the preview dialog in DVX and AVSEdit. Hope this helps.

:( Oh crap!! the link i posted earlier about cutting avi with VirtualDub was not working with the audio faster than video and their example of math calculation didn't work for me :(

stax: yeh i downloaded AVSEdit 1.1.0.0 I load the program then what do i do with it to be able cut the avi. i don't see any 'CUT' option in the menu :confused:

just say i wanna cut "TVshow.avi" into 5 parts then get rid off the commercial and join them back as one avi file.

i hope you can help me write the script for this :)

stax76
18th July 2005, 22:16
you cut with AVSEdit before you encode, AVI can be cuttet with VirtualDubMod

westcam
19th July 2005, 10:13
cut with AVSEdit but how?

i know that VirtualDubMod can cut avi but the cutted avi's audio doesn't match the video.