VideoHelp Forum
+ Reply to Thread
Results 1 to 17 of 17
Thread
  1. Hi. I'd like to convert an mp4 file (AVC/AAC) and, at the same time, make the ending repeat a few times. Using MeGUI, this is the script I ended up with:
    LoadPlugin("E:\MeGUI\tools\lsmash\LSMASHSource.dll ")
    LSMASHVideoSource("E:\summer.mp4")
    Spline64Resize(648,360) # Spline64 (Sharp)
    Loop(3,1772,2245)

    I ended up with 2 'repeats', not 3. Can anyone suggest a reason why?

    More importantly, there was no audio on the repeats. After my first encode (for which, as you know, MeGUI doesn't produce a visible script for the audio) I did a second encode, this time loading the '...mp4.avs' created by File Indexer into the Audio Input section. It made no difference.

    How, then, do I use the Loop function so that I get audio for the main video and the 'repeats'?

    While I'm here, fairly soon I'll be looking to create a scene using MeGUI's AVS Cutter and also Loop a bit of that scene. I foresee problems in that that the frame numbers of the proposed loop will not be the same after the cut has been made. Has anyone been here before and know how to script that?

    Thank you.
    Quote Quote  
  2. Originally Posted by pooksahib View Post
    I ended up with 2 'repeats', not 3. Can anyone suggest a reason why?
    Because Loop includes the original sequence of frames, in addition to the two others you added. If you want it to repeat three times, then 4 is what you want. The Loop page even implies that you get one less in one of the examples it gives:

    Loop(10,20,29) # repeat frames 20 to 29 ten times before going on, actual clip duration increased by 90 frames

    More importantly, there was no audio on the repeats.
    There's no audio in your source, either.

    Has anyone been here before and know how to script that?
    How to script what? I just tested a script with audio and it loops fine, both video and audio. I don't use MeGUI, though. And since you know enough not to, I don't know why you do either.

    A=AVISource("Movie3.avi")
    B=WAVSource("Movie3 23976.wav")
    AudioDub(A,B)
    Loop(10,1000,2000)
    Quote Quote  
  3. Another way:

    Code:
    LoadPlugin("E:\MeGUI\tools\lsmash\LSMASHSource.dll ")
    v = LSMASHVideoSource("E:\summer.mp4")
    a = LSMASHAudioSource("E:\summer.mp4")
    AudioDub(v,a)
    Spline64Resize(648,360) # Spline64 (Sharp)
    rep = Trim(1772,2245)
    last++rep++rep
    Quote Quote  
  4. Originally Posted by manono View Post
    How to script what?
    I don't use MeGUI, though. And since you know enough not to, I don't know why you do either.
    Say the original film is 30 mins long and I want to make a shorter film comprising the section from 10m-20m. Then I want to have the last 30secs of the new section 'loop' a few times. That's what I'd like to know how to script because the problem I foresee is that the frame numbers of the 30sec 'loop' will be different once the edit has been made.

    I like MeGUI because the GUI makes it easy to set the CQ factor, cropping, audio bitrate etc. But, OK, I'll have a go doing it the pro way. Jagabo likes 'X264 CLI' – is that the general recommendation?

    Jagabo, your script worked perfectly, thank you so much.
    Quote Quote  
  5. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Pre-cut the loop section, referencing the original uncut:

    Example:
    "A" = all 30 min = 108,000 frames (at 60fps) or frames 1 - 108,000
    "B" = 10min section of "A" = frames 36,001 - 72,000
    "C" = last 30 second section of "A" = frames 70,201 - 72,000
    "D" = all but last 30 sec of "A" = frames 36,001 - 70,200
    "E" = Loop "C" x 5
    "F" = "D" ++ "E"

    Scott
    Quote Quote  
  6. Thanks, Scott, I'll give that a go when the time comes.
    Quote Quote  
  7. Anonymous344
    Guest
    Originally Posted by pooksahib View Post
    That's what I'd like to know how to script because the problem I foresee is that the frame numbers of the 30sec 'loop' will be different once the edit has been made.
    Another way to do this is to work backwards. Here's an example that's unconnected to your situation.

    Code:
    Loop(   9,  1549,     1449)
    Loop(   8,  1448,     1445)
    Loop(   3,  1123,     1111)
    Loop(   5,  1004,     1000)
    I ended up with 2 'repeats', not 3. Can anyone suggest a reason why?
    Manono gave you the correct explanation, but I confess that this did confuse me when I first began to use Loop(). I prefer to think of the first number as instances of the frame in question, so Loop(3, 10, 10) gives you three instances of frame 10, resulting in two repeats.
    Quote Quote  
  8. Thanks, Richard1485, although I confess I don't fully understand your example. Are the big spaces essential?
    I think anyone would agree that the 'official' definition of Loop is not quite right. My guess is the author wasn't concentrating...
    Quote Quote  
  9. Anonymous344
    Guest
    The big spaces are unnecessary. I cut and pasted a portion of a script I had been working on (and simplified it quickly), and I sometimes use tabs when writing big and complicated scripts.

    You mentioned that successive calls to Loop() (or whatever) change the frame-numbers. That's true, but if you work backwards, you can avoid that problem. You are scrubbing through a video and decide to loop the tenth frame.

    Code:
    AviSource()
    ShowFrameNumber(scroll=true)
    Loop(2,10,10)
    As you have called ShowFrameNumber() before Loop(), the numbers that you see will always refer to the original frames. If you decide that you then want to loop the frame that is labelled 45 (but is no longer the 45th frame of your video), you can call Loop() a second time but insert it before the first call.

    Code:
    AviSource()
    ShowFrameNumber(scroll=true)
    Loop(2,45,45)
    Loop(2,10,10)
    I think anyone would agree that the 'official' definition of Loop is not quite right.
    While it's initially counter-intuitive, I think that the official definition works. I quite often use Loop() to remove frames in a given range by specifying 0 instances of the frames in question. Insisting that Loop() should refer to the number of repeats would make this problematic.
    Quote Quote  
  10. Originally Posted by pooksahib View Post
    I think anyone would agree that the 'official' definition of Loop is not quite right. My guess is the author wasn't concentrating...
    I agree that the definition is screwy because when someone says 'repeat' they mean additional instances of whatever it is being repeated. However, I speculate on a different reason for this happening. And that is many of the AviSynth developers don't have English as their first language and didn't quite understand the proper meaning of the word. Or maybe there's a real reason Loop works as it does - an instance where the usage depends on needing to call for one more repeat than thought, as Richard1485 before me mentioned. However, that usage isn't really a necessary part of a Loop, and could equally easily be done with Trim or DeleteFrame or stickboy's JDL_DeleteRange.

    It doesn't really matter, though, once you understand what's going on. I've come across a similar problem with the Dissolve filter but once I discovered it the fix was easy - dissolve one more frame than one thinks should be necessary.
    Last edited by manono; 25th May 2016 at 17:28.
    Quote Quote  
  11. Anonymous344
    Guest
    Originally Posted by manono View Post
    However, I speculate on a different reason for this happening. And that is many of the AviSynth developers don't have English as their first language and didn't quite understand the proper meaning of the word.
    That's certainly plausible. I suppose another way to get one's head round the way Loop() works is to imagine the original frame as the first loop in a paper-chain. Adding one more results in two loops; adding two more results in three loops, and so on.

    However, that usage isn't really a necessary part of a Loop, and could equally easily be done with Trim or DeleteFrame or stickboy's JDL_DeleteRange.
    I find Loop() easier than DeleteFrame() for long sections because you don't have to type out all the frame-numbers; I'm sure DeleteRange() works well, but I always prefer to use functions internal to AviSynth as long as they give a result of the same quality. (It simplifies the explanations that often accompany sending someone else a script.) Trim() is certainly just as easy. I do like the fact that there are often different ways of doing the same thing in AviSynth.
    Quote Quote  
  12. Going back to post #4, does anyone have any views on the best way to use Avisynth without relying on MeGUI?
    Quote Quote  
  13. Originally Posted by pooksahib View Post
    Going back to post #4, does anyone have any views on the best way to use Avisynth without relying on MeGUI?
    There is no best way. Some use one, some another. Experiment with a few and choose the one that appeals to you. Many like doing it using the CLI directly, others like something between the script and the encoder. Some like Hybrid, others StaxRip, others RipBot264, others XviD4PSP, others Simple x264/x265 Launcher, etc. Try them out for yourself. Choose the one that has the features you want, the complexity or lack thereof you seek, the GUI you find the most intuitive, etc.
    Quote Quote  
  14. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Type & test with avspmod, vdub, then load the script in your AVISynth-supported encoder.

    Scott
    Quote Quote  
  15. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Originally Posted by Cornucopia View Post
    Type & test with avspmod, vdub, then load the script in your AVISynth-supported encoder.

    Scott
    On a related note, I like to test with Vdub also. The one thing that bites me in the backside from time to time,
    if you have the FFmpeg input plugin it takes control of the *.avs files instead of default Vdub input handler.
    Sometimes it's transparent and other times causes all kinds of problems..
    Is there a way to disassociate *.avs files with the FFmpeg input plugin? (I know you can temporarily rename it in the
    Virtualdub plugins32 folder, but I was hoping for something a little more elegant)
    Quote Quote  
  16. Back to the subject of looping, and my scenario of making a cut from the original movie, said cut to contain a loop. After some experimentation, it seems that I'm better off with Trim rather than Loop (thanks, jagabo). Here's a script which I've successfully tested and you can see it includes cropping, colour adjustment, deinterlacing, volume adjustment and a couple of scene repeats. While I'm chuffed that I've managed to do this, I'd welcome any comments on how the script might be tidied up or improved:

    global MeGUI_darx = 4
    global MeGUI_dary = 3
    LoadPlugin("E:\MeGUI\tools\avisynth_plugin\NicAudio.dll")
    LoadPlugin("E:\MeGUI\tools\dgindex\DGDecode.dll")
    LoadPlugin("E:\MeGUI\tools\avisynth_plugin\ColorMa trix.dll")
    a=DGDecode_mpeg2source("E:\HFpgc.d2v", info=3)
    a=a.ColorMatrix(hints=true, threads=0)
    b=NicAC3Source("E:\HFpgc1.ac3")
    audiodub(a,b)
    Amplify(0.15)
    DelayAudio(-96/1000.0)
    crop(6, 0, -12, 0)
    ColorYUV(off_u=26, off_v=-4)
    QTGMC()
    SRestore()
    c=trim(20570,21759)
    rep1 = Trim(20759,20959)
    rep2 = Trim(21309,21509)
    c++rep1++rep1++rep2++rep2

    This is just curiosity - when I was still trying to use 'Loop' I had this script:

    LoadPlugin("E:\MeGUI\tools\avisynth_plugin\NicAudi o.dll")
    LoadPlugin("E:\MeGUI\tools\dgindex\DGDecode.dll")
    a=DGDecode_mpeg2source("E:\zloop.d2v")
    b=NicAC3Source("E:\zloop T80 2_0ch 192Kbps DELAY -96ms.ac3")
    audiodub(a,b)
    Loop(2,2696,2904)

    It handled the loop OK (original length plus scene repeat) but the repeat was silent. Why would that be?

    Thanks to all for your interest.
    Quote Quote  
  17. Originally Posted by pooksahib View Post
    Going back to post #4, does anyone have any views on the best way to use Avisynth without relying on MeGUI?
    I don't mind relying on it a little, given I like being able to easily preview a script and while I could use VirtualDub or a AvsPmod etc, I've got to use something and I prefer MeGUI's preview. If MeGUI didn't make it easy to modify the scripts it creates it'd be a different story, but it does.

    I find AvsPmod a bit frustrating because unless the script is reasonably simple it seems to get bogged down fairly quickly.

    I use MPC-HC for previewing scripts quite a bit as I can drag the player over to the TV and preview the script full screen.... the same way I'd be watching the encoded version. After editing a script, Ctrl+E gets MPC-HC to reload it.

    Aside from it's preview, the main things I use MeGUI for are it's Script Creator for calculating resizing after cropping etc, otherwise I'd have to work it out myself, and it's not uncommon for me to have many jobs in the queue that'll each take a few hours to run.... and enough of them to keep the PC busy for several days. I don't know how others handle that sort of situation but I like a job queue I can start and stop or change the number of encodes running simultaneously according to how slow the filtering is.
    Last edited by hello_hello; 30th May 2016 at 03:38.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!