# MeGui + AviSynth alternative

1. Hello all,

So I'm looking for an alternative encoder to MeGui for my AviSynth script. For some reason since my footage is 1440x1080 MeGui always outputs the encode as 4:3 instead of 16:9. I don't want any more quality loss due to another re-encode 1st to 1920x1080, so I'm looking for an alternative to it. My script if you can find something wrong with it is here:

Code:
global MeGUI_darx = 16
global MeGUI_dary = 9
FFvideosource("C:\Users\Denis\Desktop\encode\Sequence 01.mp4")
TextSub("C:\Users\Denis\Desktop\encode\text.ass")
2. force SAR in Megui, Config/Misc/Force SAR/4:3
3. I need it to force 16:9, the path you provided does not have 16:9 only 16:11 :/
4. Try the x264 cli encoder. You can drag/drop your AVS script onto a simple batch file.

Code:
x264 --preset=slow --crf=18 --sar=4:3 --output %1.mkv %1
5. SAR is not a width/height ratio, ... in case of SAR=4:3, your 1440 is going to be multiplied by 4/3=1.333, to get 1920 on screen, that is what you want

SAR 16:9 is a nonsense, 16:9 video has SAR=1:1, in that case videos are square pixel. Not anamorphic, and your video is anamorphic.
6. 1440 / 1080 * 4 / 3 = 1.777...
7. ok now I finally get SAR never did before. But still no matter what I force, the videos till comes out in 4:3.
8. Originally Posted by shorto
Hello all,

So I'm looking for an alternative encoder to MeGui for my AviSynth script. For some reason since my footage is 1440x1080 MeGui always outputs the encode as 4:3 instead of 16:9. I don't want any more quality loss due to another re-encode 1st to 1920x1080, so I'm looking for an alternative to it. My script if you can find something wrong with it is here:

Code:
global MeGUI_darx = 16
global MeGUI_dary = 9
FFvideosource("C:\Users\Denis\Desktop\encode\Sequence 01.mp4")
TextSub("C:\Users\Denis\Desktop\encode\text.ass")
To be honest it's more likely you're doing something you shouldn't than it is MeGUI is getting it wrong.

If the above script is the whole script, there's no reason why the output resolution shouldn't be the same as the input resolution and the output aspect ratio shouldn't be 16:9. You always leave anamorphic encoding enabled?

Don't force anything. The display aspect ratio in the script is 16:9 as it should be. MeGUI uses that display aspect ratio and the output video dimensions (after any cropping and resizing) to calculate and set the correct SAR (pixel aspect ratio) when encoding. If you've set the SAR in MeGUI's x264 encoder configuration, don't. Leave it at "default".

When you load a script for encoding and open the video preview, the correct display aspect ratio should be displayed at the bottom of the preview window (ie 1.777777). There's a checkbox which causes MeGUI to resize the preview to the correct display aspect ratio (as would happen when playing the encoded video). Is the aspect ratio being shown as 16:9 (1.7777777) in the preview?

Also..... there's a drop down box in the preview window (the one which opens after loading a script for encoding) which allows you to change the display aspect ratio. 99.9999999999999999999999999999999999999999% of the time the display aspect ratio will be correct and you shouldn't change it (unless you know you need to). Changing it there before adding the encoding job to the queue over-rides the display aspect ratio added to the script which in turn changes the SAR (pixel aspect ratio) MeGUI calculates when encoding. It's one way to over-ride the display aspect ratio but generally it's not something you'd need to do.

If none of the above helps...... try posting your MeGUI log file. That'll show the SAR (pixel aspect ratio) being set, which in your case should be 4:3 for the video to display as 16:9. If not, the log file should provide a clue as to why.

Are you sure it's the display aspect ratio not being set correctly when encoding rather than it being ignored on playback for some reason?
9. Originally Posted by _Al_
force SAR in Megui, Config/Misc/Force SAR/4:3
Originally Posted by shorto
I need it to force 16:9, the path you provided does not have 16:9 only 16:11 :/
In your case 4:3 would be correct but the x264 encoder configuration only lets you set a few pre-defined SARs (pixel aspect ratios) anyway. Mostly it's better to leave it set to "default", enable anamorphic encoding if you don't want to resize to square pixels, crop and resize as you normally would (if need be) and let MeGUI take care of the SAR.
10. Originally Posted by shorto
ok now I finally get SAR never did before. But still no matter what I force, the videos till comes out in 4:3.
Some players don't respect SAR or DAR flags. Some players have settings that allow to to ignore them and play at the original frame size. Check your players.
11. Originally Posted by jagabo
Originally Posted by shorto
ok now I finally get SAR never did before. But still no matter what I force, the videos till comes out in 4:3.
Some players don't respect SAR or DAR flags. Some players have settings that allow to to ignore them and play at the original frame size. Check your players.
Wow. Takes me back to the good ol' days with the old DivX "compatible" players and the AVI square pixel assumption.

Some players, but not all - but always good times regardless!
12. Hum mkay I have BSPlayer, MPC, VLC, QuickTime and Normal Windows Media Player installed, the only one that shows the aspect ratio I want is VLC.

Is there any ways for me to force the encode to be 1920x1080 not 1440x1080 with MeGui?
13. MPC, MPCHC, VLC, WMP, KMPlayer, PotPlayer, SMPlayer all support h.264 SAR flags. Many of those players can be set to use internal or external readers, splitters, and codecs. It might be that you have them configured to use an external reader/splitter and that reader/splitter isn't passing the SAR flag along. MPC(HC) can show you the list of filters that are used to play the video. Right click on the window while playing and hover over Filters to see the list. Select any of them to see their properties and any internal settings.

Also, aspect ratio information can be embedded in the video stream as well as flagged at the container level. Some players may use one or the other. I don't know if MeGUI sets both the embeded flags and the container flags.
14. Originally Posted by shorto
Hum mkay I have BSPlayer, MPC, VLC, QuickTime and Normal Windows Media Player installed, the only one that shows the aspect ratio I want is VLC.
So if you open the encoded video with MPC-HC and use the File/Properties menu, do you see this:

If you do and it's not displaying the correct aspect ratio, you should try resetting MPC-HC (under Options/Miscellaneous). If you don't, the aspect ratio isn't being set correctly when encoding.

Originally Posted by shorto
Is there any ways for me to force the encode to be 1920x1080 not 1440x1080 with MeGui?
When using the script creator to create the script, don't enable anamorphic encoding. Click on the Config button next to the Avisynth Profile drop down box. In there you'll find a checkbox to allow "upsizing". Once it's checked, you can enable resizing in the script creator and it'll let you resize to 1920x1080. Or create a script and paste this at the end of it (before loading the script for encoding):

Spline36Resize(1920,1080)
15. Originally Posted by jagabo
Also, aspect ratio information can be embedded in the video stream as well as flagged at the container level. Some players may use one or the other. I don't know if MeGUI sets both the embeded flags and the container flags.
It does. The pic in my previous post was from a MeGUI encode. I'm pretty sure the aspect ratio I highlighted is the container aspect ratio.
By default, that's the one MPC-HC uses.
16. What are those two variables in that Megui's Avisynth script for?
Code:
global MeGUI_darx = 16
global MeGUI_dary = 9
I'd take those two lines away and set SAR 4:3, this should be standard procedure to encode anamorphic video.
17. Originally Posted by _Al_
What are those two variables in that Megui's Avisynth script for?
Code:
global MeGUI_darx = 16
global MeGUI_dary = 9
I'd take those two lines away and set SAR 4:3, this should be standard procedure to encode anamorphic video.
MeGUI adds them based on the input display aspect ratio (if anamorphic encoding is enabled), and uses them, along with the output resolution, to calculate the correct SAR.
If you crop when creating a script, MeGUI will adjust those values accordingly so the SAR, and therefore output display aspect ratio, should always be correct. The system works fine, so why it appears not to be in this case, I'm not really sure. I had the impression shorto had already tried setting the SAR to 4:3 in MeGUIs encoder configuration and it didn't help, so maybe it's a playback problem.

I assume he's using the x264 encoder and not Xvid...... although MeGUI will encode anamorphically using either.
18. This is the first time to learn MeGUI_2507 step by step but which point I will start with
With all my love for all and Thanks for your Hard work