View Full Version : VapourSynth QTGMC ignoring PAR
squillful
28th December 2024, 15:01
Hi Folks. I'm new to VapourSynth so apologies if this is an obvious issue. As some initial background, I'm using VapourSynth on an M2 Apple Silicon Mac. Getting things working was a bit of effort, but got there eventually following some of the guidance in https://forum.doom9.org/showthread.php?t=185901 and trial and error
I'm using QTGMC to deinterlace a DV file. This file has a PAR of 1.067 according to the `mediainfo` CLI. However, after running the script below the PAR of the output file is 1.0 and the display dimensions are different. Is this expected and what's the best way to handle this? I would like my script to automatically handle different PAR values.
I'm running the script below like so to produce a final file:
vspipe -c y4m -p first.vpy - | ffmpeg \
-i pipe:0 \
-i /Users/home/DV/tape1_proper.dv \
-map 0:v:0 \
-map 1:a:0 \
-c:v hevc \
-tag:v hvc1 \
-crf 18 \
-preset slow \
-pix_fmt yuv420p \
-movflags +faststart \
-c:a aac \
-b:a 256k \
-write_tmcd 0 \
tape1_encoded.mov
first.vpy
from vapoursynth import core
import havsfunc as haf
clip = core.ffms2.Source('/Users/home/DV/tape1_proper.dv')
clip = haf.QTGMC(clip, Preset="Faster", TFF=False, opencl=True)
clip.set_output()
As an aside, is there any way to use VapourSynth in Hybrid on macOS on Apple Silicon Macs (I suspect it may handle issues like this automatically)? I've installed an older version of Hybrid (from VideoHelp (https://www.videohelp.com/software/VapourSynth/old-versions)) but it doesn't appear to detect that VapourSynth is installed.
Selur
28th December 2024, 15:55
Piping with vspipe to ffmpeg does not signal PAR info.
You need to set "-aspect XXX" (see: https://ffmpeg.org/ffmpeg.html#Video-Options) to the correct display aspect ratio (not PAR, so for 1.067 PAR you probably want '-aspect "4:3"').
As an aside, is there any way to use VapourSynth in Hybrid on macOS on Apple Silicon Macs (I suspect it may handle issues like this automatically)?
No, there is no Hybrid for Apple Silicon Macs or newer Mac versions.
Mainly because:
a. quite a few Vapoursynth filters are available for Apple Silicon (some filters only work on x86)
b. it's a pain to compile and bundle all the tools Hybrid uses (I don't have the time for that)
On Intel Macs https://forum.selur.net/thread-1279.html listed how to install and use Vapoursynth with Hybrid.
Current Hybrid does compile on Silicon Macs, but due to missing tools and no time to look into packaging&patching all the tools Hybrid uses, I haven't released an Apple Silicon version.
(My current version does work with via homebrew installed Vapoursynth)
Cu Selur
squillful
28th December 2024, 16:15
Thanks for the quick reply Selur! I've a couple of follow-on questions below:
Piping with vspipe to ffmpeg does not signal PAR info.
You need to set "-aspect XXX" (see: https://ffmpeg.org/ffmpeg.html#Video-Options) to the correct display aspect ratio (not PAR, so for 1.067 PAR you probably want '-aspect "4:3"').
Makes sense, I got similar recommendations through some Googling and ChatGPT.
Is piping to ffmpeg the right/best thing to do here? This was the easiest way I could fine to retain the audio from the original file. Perhaps there's a better way?
No, there is no Hybrid for Apple Silicon Macs or newer Mac versions.
Mainly because:
a. quite a few Vapoursynth filters are available for Apple Silicon (some filters only work on x86)
b. it's a pain to compile and bundle all the tools Hybrid uses (I don't have the time for that)
On Intel Macs https://forum.selur.net/thread-1279.html listed how to install and use Vapoursynth with Hybrid.
Current Hybrid does compile on Silicon Macs, but due to missing tools and no time to look into packaging&patching all the tools Hybrid uses, I haven't released an Apple Silicon version.
(My current version does work with via homebrew installed Vapoursynth)
Cu Selur
Makes sense. I can get Hybrid to run on my Apple Silicon Mac (I believe it's running via rosetta2), it's more that the VapourSynth options aren't showing. Is there any way to force Hybrid to see my VapourSynth installation? Totally understand that you have limited time to support things and that many plugins are not yet compiled for Apple Silicon, but I'd be happy to play around and see what I can get working if I can just get Hybrid to see my VapourSynth install! (My current version is working relatively well via homebrew install, vsrepo plugin installs, and https://github.com/yuygfgg/Macos_vapoursynth_plugins)
poisondeathray
28th December 2024, 16:38
Is piping to ffmpeg the right/best thing to do here?
If you're using vapoursynth with ffmpeg, the other option is direct vpy input if you're using ffmpeg compiled with the ffmpeg vapoursynth demuxer
But there is no big benefit in that case; The ffmpeg vapoursynth demuxer(s) (direct .vpy input to ffmpeg) does not convey that aspect ratio information either. It's a "shame" because the ffmpeg avisynth demuxer can convey SAR information; yet frameprops began in vapoursynth years before avisynth
This was the easiest way I could fine to retain the audio from the original file.
-c:a aac means re-encode the audio from the original file
Selur
28th December 2024, 17:29
(My current version is working relatively well via homebrew install, vsrepo plugin installs, and https://github.com/yuygfgg/Macos_vapoursynth_plugins)
got those too, but things like tfm, tdecimate, d2vwitch, mpeg2source and soem others are still missing.
If you want to play with it: Hybrid Silicon dev (https://drive.filejump.com/drive/s/bnpTlmVQfzt5wm0jExW088pqYQ3ZdF)
Is there any way to force Hybrid to see my VapourSynth installation?
Problem is that the old vsViewer will not work with the installed Vapoursynth install, other than that configuring the paths through the misc.ini should work. (totally untested)
Cu Selur
squillful
24th February 2025, 03:22
If you're using vapoursynth with ffmpeg, the other option is direct vpy input if you're using ffmpeg compiled with the ffmpeg vapoursynth demuxer
But there is no big benefit in that case; The ffmpeg vapoursynth demuxer(s) (direct .vpy input to ffmpeg) does not convey that aspect ratio information either. It's a "shame" because the ffmpeg avisynth demuxer can convey SAR information; yet frameprops began in vapoursynth years before avisynth
Sorry for the slow reply here.
This makes sense, thank you. I'm not using ffmpeg with vapoursynth, and sounds like there's no a huge benefit so I'll stick with my current approach of calling out to ffmpeg from my vapoursynth scripts. I'll shell out to `mediainfo` or `ffprobe` to get the PAR of the original file and pass (correctly converted) as `-aspect` to ffmpeg. That seems to work to retain the PAR.
-c:a aac means re-encode the audio from the original file
Yep that was my intention here, but thanks for pointing this out.
squillful
24th February 2025, 03:25
got those too, but things like tfm, tdecimate, d2vwitch, mpeg2source and soem others are still missing.
If you want to play with it: Hybrid Silicon dev (https://drive.filejump.com/drive/s/bnpTlmVQfzt5wm0jExW088pqYQ3ZdF)
Problem is that the old vsViewer will not work with the installed Vapoursynth install, other than that configuring the paths through the misc.ini should work. (totally untested)
Cu Selur
This link didn't work for me Selur :(
Any other pointers? I note with interest that someone appears to have gotten Hybrid with Vapoursynth working on an M4 Mac - https://www.digitalfaq.com/forum/news/14952-dv-firewire-capture.html#post101552
The Vapoursynth options do not appear for me at all in my Hybrid install. How does Hybrid detect an available vapoursynth install? I'm wondering if I need to set `PATH` or some other variables when I launch. Maybe there's also a way for me to point to my install in misc.ini? No worries that it's untested, I'm happy to do some of that testing.
Selur
24th February 2025, 05:04
I deleted the link a while ago. The user over at digitialfaq uses the old abandoned 2022 version. For that old version, https://forum.selur.net/thread-1279.html might help. (yes, misc.ini needs to be adjusted)
I posted the last link over at https://forum.selur.net/thread-3937.html.
Cu Selur
yuygfgg
24th February 2025, 13:51
I see apple socs again...
Though I'm encoding with it everyday and (used to) have a binary repo holding plugins, I think we need to do something to change.
Obviously, the binary repo is a bad idea since we are not statically linking everything.
A good start might be homebrew formulas for plugins? But then we have to handle tens of patches -- modify the code to use sse2neon or even simde for performance or simply make it work, modify meson.build to install to right path, and where should we hold the patches? Inside .rb files? Or fork the plugins and try to catchup the upstream? Or throw tens of PRs to the no-longer maintaining repos and hope it will be merged?
And to what extend should patches go? Should we let everything with C code use it without porting simd part? Or we should fully utilize the performance, using libraries and even hand-written neon code?
Even worse, although claiming to be cross-platform, VS itself (and probably some plugins and tools) is not fully prepared for arm platform. VS's std.Expr for example misbehaviors on non-x86 platforms, and also faces performance issue. Vsmlrt requires a different version of onnxruntime than what homebrew is distributing... Let's stop here.
Sorry I'm just throwing questions that nobody may answer. But before all the questions are answered, using vapoursynth on macos will not be easy. :stupid: :mad: :mad: :mad:
WolframRhodium
24th February 2025, 14:59
vs-mlrt is using an ancient onnxruntime merely for compatibility with TensorRT on the cuDNN dependency. Other platforms can freely use later versions.
yuygfgg
24th February 2025, 15:23
vs-mlrt is using an ancient onnxruntime merely for compatibility with TensorRT on the cuDNN dependency. Other platforms can freely use later versions.
Well for some reason Coreml isn't included in homebrew version as I mentioned here.
https://github.com/AmusementClub/vs-mlrt/pull/106#issuecomment-2334317688
Downloading from the github release fixes the issue.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.