Trimming in Avisynth

This forum is for questions and discussion of all the aspects of handling and cleaning up your footage with Avisynth.
Locked
blaze077
Joined: Sat Feb 27, 2016 2:29 pm
Org Profile

Trimming in Avisynth

Post by blaze077 » Tue Apr 19, 2016 11:48 pm

I tried trimming a video and returning it but the script just gives me an error: "Invalid arguments to function Trim."
vid="C:\Users\Naval Wing\Desktop\memeless.m2ts"
aud="C:\Users\Naval Wing\Desktop\memeless.m2ts"
ep=FFIndex(vid) AudioDub(FFVideoSource(vid), FFAudioSource(vid)).tDecimate()
a=ep.Trim(0, 100)
a
When I tried the same thing except this time with DSS, the script worked fine.
Can someone help me?

User avatar
l33tmeatwad
Joined: Wed Feb 16, 2005 3:22 pm
Location: Christiansburg, VA
Contact:
Org Profile

Re: Trimming in Avisynth

Post by l33tmeatwad » Wed Apr 20, 2016 8:48 am

In your script AviSynth reads FFIndex(vid), sees the space, then ignores everything after that and passes FFIndex(vid) into ep. Since FFIndex(vid) is not a clip it cannot be trimmed. This would be a better layout for your script:

Code: Select all

vid="C:\Users\Naval Wing\Desktop\memeless.m2ts"
FFIndex(vid)
ep=AudioDub(FFVideoSource(vid), FFAudioSource(vid)).tDecimate()
ep.Trim(0, 100)
Note: I took out the aud value because it wasn't needed. I also took out the whole bit with a because that wasn't needed as well as you could either simply do ep.Trim(0,100) or return ep.Trim(0,100).

I have to ask, why are you using tdecimate()? It doesn't appear that you are removing interlacing and if the clip is 29.97fps progressive then removing frames would make it choppy.
Software & Guides: AMVpack | AMV 101 | AviSynth 101 | VapourSynth 101
PixelBlended Studios: Website | Twitter | YouTube

blaze077
Joined: Sat Feb 27, 2016 2:29 pm
Org Profile

Re: Trimming in Avisynth

Post by blaze077 » Wed Apr 20, 2016 10:44 am

l33tmeatwad wrote:In your script AviSynth reads FFIndex(vid), sees the space, then ignores everything after that and passes FFIndex(vid) into ep. Since FFIndex(vid) is not a clip it cannot be trimmed. This would be a better layout for your script:

Code: Select all

vid="C:\Users\Naval Wing\Desktop\memeless.m2ts"
FFIndex(vid)
ep=AudioDub(FFVideoSource(vid), FFAudioSource(vid)).tDecimate()
ep.Trim(0, 100)
Note: I took out the aud value because it wasn't needed. I also took out the whole bit with a because that wasn't needed as well as you could either simply do ep.Trim(0,100) or return ep.Trim(0,100).

I have to ask, why are you using tdecimate()? It doesn't appear that you are removing interlacing and if the clip is 29.97fps progressive then removing frames would make it choppy.
Thank you for the answer. I understand now. :) And sorry for the confusion. I was trying out lots of things so I didn't add tfm() as I simply wanted to try and trim first. Thank you again.

blaze077
Joined: Sat Feb 27, 2016 2:29 pm
Org Profile

Re: Trimming in Avisynth

Post by blaze077 » Wed Apr 20, 2016 10:55 am

It is indeed interlaced 29.97 FPS and I just need to IVTC. Sorry for the double posts.

User avatar
l33tmeatwad
Joined: Wed Feb 16, 2005 3:22 pm
Location: Christiansburg, VA
Contact:
Org Profile

Re: Trimming in Avisynth

Post by l33tmeatwad » Wed Apr 20, 2016 12:11 pm

Is this Blu-ray or TV stream? h.264 or MPEG-2?
Software & Guides: AMVpack | AMV 101 | AviSynth 101 | VapourSynth 101
PixelBlended Studios: Website | Twitter | YouTube

blaze077
Joined: Sat Feb 27, 2016 2:29 pm
Org Profile

Re: Trimming in Avisynth

Post by blaze077 » Thu Apr 21, 2016 12:01 am

l33tmeatwad wrote:Is this Blu-ray or TV stream? h.264 or MPEG-2?
It is a TV Stream. I think it is MPEG-2 (or just "MPEG")? Well, I know that it something that was originally progressive and was telecined for TV Broadcast.
Spoiler :
Video
ID : 273 (0x111)
Menu ID : 23608 (0x5C38)
Format : MPEG Video
Format version : Version 2
Format profile : Main@High
Format settings, BVOP : Yes
Format settings, Matrix : Custom
Format settings, GOP : M=3, N=15
Format settings, picture st : Frame
Codec ID : 2
Duration : 29mn 51s
Bit rate mode : Variable
Maximum bit rate : 20.0 Mbps
Width : 1 440 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 29.970 (30000/1001) fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Compression mode : Lossy
Time code of first frame : 15:51:36:01
Time code source : Group of pictures header
GOP, Open/Closed : Open
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

Audio
ID : 274 (0x112)
Menu ID : 23608 (0x5C38)
Format : AAC
Format/Info : Advanced Audio Codec
Format version : Version 2
Format profile : LC
Muxing mode : ADTS
Codec ID : 15
Duration : 29mn 51s
Bit rate mode : Variable
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Frame rate : 46.875 fps (1024 spf)
Compression mode : Lossy
Delay relative to video : -315ms
I tried it out by doing what you did and now it works great. Thank you. :D

User avatar
l33tmeatwad
Joined: Wed Feb 16, 2005 3:22 pm
Location: Christiansburg, VA
Contact:
Org Profile

Re: Trimming in Avisynth

Post by l33tmeatwad » Thu Apr 21, 2016 7:21 am

Why not just use DGIndex on it to make a d2v?
Software & Guides: AMVpack | AMV 101 | AviSynth 101 | VapourSynth 101
PixelBlended Studios: Website | Twitter | YouTube

blaze077
Joined: Sat Feb 27, 2016 2:29 pm
Org Profile

Re: Trimming in Avisynth

Post by blaze077 » Sat May 14, 2016 11:32 pm

l33tmeatwad wrote:Why not just use DGIndex on it to make a d2v?
Sorry, I hadn't been able to learn more and use this site for a while due to work. I just made my first encode from a DVD source yesterday so I used DGIndex for the first time too and it's very easy to use and provides great info on the video. I'll definitely use it from now on. Thank you for the help with the script.

Locked

Return to “AviSynth Help”