Hi. I've only ever used avisynth as part of MeGUI but, due to a video that's giving me no end of A/V sync problems when I encode it, I want to see if I'd get better results using avisynth in its raw form. Unfortunately, I'm getting very little help from google. Can someone give me some pointers? Many thanks if so.
+ Reply to Thread
Results 1 to 30 of 32
-
-
Most of us create the script and test it in something like Virtualdub. But this seems so basic, I'm not sure if I misunderstood you
-
Instal Avisynth, preferably 32bit, you can choose avisynth 2.6 or Avisynth+. After installing Avisynth, Windows associates any file with avs extension as avisynth script. But otherwise nothing happens. You will not see any new icons on desktop. Any new software that you can run.
Click empty area (on desktop or in windows file browser) and choose new - avisynth script. Then you should create empty avs file. You write a script in notepad to it.
Or you just open something.txt and save it as something.avs
First you need to load your video in that script, there is many ways to do it depending what extension your file has. For example for avi extension:
AviSource("C:\ ....your path.....\video.avi")
You save the script, make sure it has avs extension. You just created avisynth script. Drop that file onto VirtualDub or MPC-HC and those aplication will treat that script as if it was video file. -
Thank you, davexnet and _Al_. Creating a script and then previewing it seems fairly straightforward. But to create a new file, you need to choose a container, a codec, a quality factor, conversion speed, audio format etc etc. Would you need some sort of app with a GUI to do that?
The reason I'm asking about using avisynth without the likes of MeGUI is because of comments I've seen in this forum from people who say they simply use 'command line' or 'batch files'. -
Yes you can use ffmpeg for example , which is often compiled with avisynth support. It's nice in that it can encode audio/video/mux at the same time, you can use commandline and batch. Or many GUI's accept avs input . But none of that necessarily deals with your A/V sync issue
I would try to be methodical and systematic when assessing A/V sync issues
If you include audio in the script, and it's in sync in MPCHC, then it's something wrong with megui or how you have it configured
If you describe the sync issues, that would help too .
Is source in sync ? What kind of source ? Is it VFR ?
Is sync progressively worsening, or a constant offset ?
Are you re-encoding the audio ?
Post your script -
It is also possible to feed manually a separate video encoder and a separate audio encoder with AviSynth output, and then multiplex the resulting streams manually into a new container. In this case you will control speed, quality, and sync with each of their separate command line parameter sets. Doing everything in ffmpeg may be slightly more convenient. There are only few differences left in special features between native multiplexers and ffmpeg.
-
Thanks, guys. The source file is a 1280x720 mp4 (AVC). I've used MeGUI on many such files with no problem (until now...). The source file plays in perfect sync on my PC (MPCHC). The same goes for my MeGUI encode of it. The problem comes when I transfer the new video to my Dune media player for viewing on the TV – it's out of sync by 0.1. I've transferred the source vid to the Dune and it plays fine which suggests to me that, although the MeGUI encode was successful, there's something about it the Dune doesn't like. And that's why I was wondering about doing an encode without MeGUI.
I've tried various Indexers with MeGUI, I've put the source file through toolnix and then encoded the toolnix file but there's always the same sync problem.
An edit and conversion to h265 using avidemux works fine but, ideally, I'd like to have some avisynth effects in the final vid.
Here's one of my scripts:
Code:LoadPlugin("E:\MeGUI\tools\ffms\ffms2.dll") a=FFVideoSource("E:\August.mp4", fpsnum=30000, fpsden=1001, threads=1) b=FFAudioSource("E:\August.mp4") audiodub(a,b) Spline64Resize(800,448)
-
Are you sure you need "fpsnum=30000, fpsden=1001" to force this frame rate? If the source already has it, it is probably superfluous, up to a point that it might skip or duplicate frames unnecessarily.
Apart from that ... which audio encoder do you use? In case of an AAC encoder: Some players compensate for a "decoder lag", others may not. -
Your sync problem won't be fixed by using avisynth outside of megui, as there should be no difference if using the same .AVS script with Megui and without Megui. What it really comes down to is the video decoder you use with difficult videos. Usually I have trouble with .TS sync and some decoders add extra frames at the beginning. I tend to get the best results from DSS2. It's works especially well with damaged .TS recordings and keeping the sync.
-
The easy way to use it is to just go into the script creator and create a new avisynth profile with DSS2 prefered. Then the next time you want to index a file, click the directshow instead of the other options. And it will use DSS2 instead of Directshow.
Example
Code:LoadPlugin("C:\Program Files (x86)\Haali\MatroskaSplitter\avss.dll") dss2("O:\To Be Encoded\Source.ts", fps=29.970, pixel_type="yv12").AssumeFPS(30000,1001)
There are some nuanced frame accuracy problems with it since it does not build an index. Mostly having to do with trying to watch the video backward, instead of forward. So if you are simply doing a script to play the video from start to end then there should be no problems.
In megui when the preview window pops up the first time, showing you the video after clicking "Directshow", just close that preview as it's glitched with DSS2 (to put simply). After closing that preview window get your script how you want it and press the preview button manually which should work better.
DSS2 uses Haali Media Splitter, which you might need to download and install. -
If ffms is giving you A/V sync errors try using LSmashVideoSource() and LSmashAudioSource() intead -- both part of the LSMASH source package.
http://avisynth.nl/index.php/LSMASHSource
I usually use the x264 CLI encoder and mux with the original audio afterward. I keep a batch file on the desktop so I can drag and drop AVS scripts onto it:
Code:start /b /low "x264" x264.exe --preset=slow --crf=18 --keyint=50 --sar=1:1 --colormatrix=smpte170m --output "%~1.mkv" "%~1"
Last edited by jagabo; 18th Dec 2017 at 07:12.
-
Please note: L-SMASH Works provides two sets of source functions with different splitters.
LSMASHVideoSource + LSMASHAudioSource use the L-SMASH splitter which supports only ISO Media container types (like MP4, MOV, 3GPP). It does not require indexing and relies on index chunks in the container.
The other set, LwLibavVideoSource + LwLibavAudioSource, uses libavformat and creates an index, usually as file. This set is supported by MeGUI's AVS Script Creator because it supports many more container formats.
__
If you noticed that the asynchronity only happens with specific audio formats, then it may be related to the "decoder lag" I previously mentioned. Some players counter a known format-dependent skew by delaying the opposite stream preemtively.Last edited by LigH.de; 18th Dec 2017 at 07:29.
-
If that script is not in-sync it is either a bug in ffms2 (please report on github) or your source wasn't in-sync to begin with.
But how much out-of-sync are we talking about? As has been said there is encoder delay that might differ between mp3 and ac3 but it isn't usually all that much. Are you encoding the audio through the AviSynth-script?
/edit:
nvm, I hadn't seen the part about 0.1 (seconds) and the Dune .... -
I have to assume that the problem is due to the Dune not liking mp3 with this particular vid. It's odd because the Dune has played many similar vids with no sync issues. If I've learnt one thing, it's that computers and software always have something new around the corner to p*** you off...
-
Sneaker is asking how exactly you mux it, with what program, and mux it into what container (.avi, .mp4 .mkv?).
-
Not a good solution after all. The sync was fine but, for some reason, the Dune box decided to stop playing audio about 70-80% into the video. Damndedest thing. Still, did I not say that technology will always find new ways to ruin your day...
The only other thing that I could think of was to ensure the avisynth'd vid had the same type of audio as the source vid. That was AAC(LC) which meant I had to install itunes and activate qaac within MeGUI but...... it works!! -
You did not have to install iTunes; it would have been sufficient to extract the CoreAudioToolbox DLL's (using makeportable.cmd) and copy them into the qaac directory.
Or you would just have multiplexed the original audio stream (using the HD Stream Extractor and the manual Multiplexer dialog). No conversion = no quality loss.Last edited by LigH.de; 21st Dec 2017 at 04:57.
-
Yes, I tried something like that when I read the megui wiki ("...or extract the AppleApplicationSupport.msi file from the iTunes installation exe and install that). Didn't work, though, so I just went for broke and installed the whole package. I wanted fades so using the original track wasn't an option.
-
That part of the Wiki may be severely outdated...
To extract the Apple AAC encoder files, you put the iTunes64Setup.exe from apple.com/itunes/download into the MeGUI\tools\qaac directory and run the makeportable.cmd; when it finished, it should leave two subdirectories QTfiles and QTfiles64; now you can delete the iTunes installer there.
You may even save a little space by replacing the huge original files with tiny icudt55 dummy DLL's; but it's not really necessary.Last edited by LigH.de; 21st Dec 2017 at 05:03.
-
Similar Threads
-
HELP:How to get GUI interface of "Eac3to and More GUI by Yraen V1.09 Beta 7
By anhlinhp4 in forum AudioReplies: 7Last Post: 3rd Aug 2017, 05:31 -
AVANTI - FFmpeg/Avisynth GUI (support thread).
By Chris K in forum Video ConversionReplies: 1189Last Post: 12th Jun 2017, 12:39 -
GUI for x265?
By kyrcy in forum Newbie / General discussionsReplies: 5Last Post: 5th Aug 2015, 02:27 -
avisynth - How to write avisynth script for rgba overlay
By moelover in forum EditingReplies: 3Last Post: 13th Apr 2014, 12:24 -
anyone know of any gui's that use vp9?
By deadrats in forum Video ConversionReplies: 28Last Post: 4th Aug 2013, 02:41