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.
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 17 of 17
Thread
-
-
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.
Has anyone been here before and know how to script that?
A=AVISource("Movie3.avi")
B=WAVSource("Movie3 23976.wav")
AudioDub(A,B)
Loop(10,1000,2000) -
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
-
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. -
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 -
Anonymous344Guest
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? -
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... -
Anonymous344Guest
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)
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. -
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.
-
Anonymous344Guest
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. -
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.
-
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) -
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. -
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.
Similar Threads
-
Using avisynth's 'amplify' function
By pooksahib in forum Video ConversionReplies: 53Last Post: 25th May 2016, 02:23 -
Video player w/ loop function for music performances
By metaflux in forum Software PlayingReplies: 6Last Post: 31st Jan 2016, 03:02 -
AviSynth - Loop is Throwing Off Frame Count
By lomaidala in forum EditingReplies: 7Last Post: 17th Oct 2015, 12:47 -
crop function for avisynth
By vhelp in forum EditingReplies: 5Last Post: 14th Oct 2013, 23:43 -
AVISynth function to darken an area
By kinglerch in forum EditingReplies: 13Last Post: 9th Apr 2012, 17:26