View Full Version : Vapoursynth
feisty2
20th May 2017, 12:21
Readability? No, especially with your style of C++.
what? why? I think the readability of my c++ style is nice! I'm just making it like "python with pointers" as much as possible..
maybe ur just not that used to the new c++ standards..?
edit:
anyways, I just added support for constant pointers as well since getReadPtr returns const uint8 *
#include <iostream>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
constexpr auto operator""_size(unsigned long long Value) {
return static_cast<std::size_t>(Value);
}
template<typename T>
struct FramePointer final {
T *Pointer = nullptr;
decltype(0_size) Width = 0;
FramePointer(const void *Pointer, std::size_t Width) {
auto Evil = const_cast<void *>(Pointer);
this->Pointer = reinterpret_cast<T *>(Evil);
this->Width = Width;
}
FramePointer(FramePointer &&) = default;
FramePointer(const FramePointer &) = default;
auto operator=(FramePointer &&)->FramePointer & = default;
auto operator=(const FramePointer &)->FramePointer & = default;
~FramePointer() = default;
auto operator[](std::ptrdiff_t Row) {
return Pointer + Row * Width;
}
auto operator[](std::ptrdiff_t Row) const {
return const_cast<const T *>(Pointer + Row * Width);
}
};
auto main()->int {
auto Width = 1920_size, Height = 1080_size;
auto RawFramePointer = new double[Width * Height];
auto getReadPtr = [&]() {
auto Evil = reinterpret_cast<std::uint8_t *>(RawFramePointer);
return const_cast<const std::uint8_t *>(Evil);
};
auto getWritePtr = [&]() {
return reinterpret_cast<std::uint8_t *>(RawFramePointer);
};
auto ActualPointer = FramePointer<double>{ getWritePtr(), Width };
const auto ConstantPointer = FramePointer<double>{ getReadPtr(), Width };
ActualPointer[2][34] = 2.718;
//ConstantPointer[2][34] = 3.142; ERROR!
std::cout << ConstantPointer[2][34] << std::endl;
delete[] RawFramePointer;
system("pause");
}
jackoneill
20th May 2017, 13:44
what? why? I think the readability of my c++ style is nice! I'm just making it like "python with pointers" as much as possible..
maybe ur just not that used to the new c++ standards..?
But C++, old or new, is not Python with pointers.
Let's take this line:
auto operator=(FramePointer &&)->FramePointer & = default;
I hate to invoke tradition, but there are literally decades' worth of C/C++ code that is not written like this. This is not what programmers expect to see, hence it takes a bit more effort to read. There is also no reason to do this. What is the point of "auto" in such a context? You write "auto" so you don't have to write the name of the actual type. Maybe the name is very long, maybe it has many capital letters. Whatever the case, maybe "auto" is easier to write. But then you go ahead and write the name of the type anyway, in addition to "auto". It makes no sense to use "auto" here.
decltype(0ull) Width = 0;
And what's the reason for not writing the type name here? "unsigned long long" too long? There are shorter alternatives: "size_t", "ptrdiff_t", "uint64_t".
feisty2
20th May 2017, 14:06
But C++, old or new, is not Python with pointers.
Let's take this line:
auto operator=(FramePointer &&)->FramePointer & = default;
I hate to invoke tradition, but there are literally decades' worth of C/C++ code that is not written like this. This is not what programmers expect to see, hence it takes a bit more effort to read. There is also no reason to do this. What is the point of "auto" in such a context? You write "auto" so you don't have to write the name of the actual type. Maybe the name is very long, maybe it has many capital letters. Whatever the case, maybe "auto" is easier to write. But then you go ahead and write the name of the type anyway, in addition to "auto". It makes no sense to use "auto" here.
because you no longer have to specify the return type for most functions and function-like stuff (lambdas or whatever) since c++14 but there're a few exceptions like "main()" or the default assignment operator or virtual functions, to unify the coding style throughout the entire program, I decided to start all functions, exception or not, with "auto", and if it's one of those exceptions that you HAVE TO specify the return type, I'll make it a trailing return type so it would fit the unified coding style, and trailing return types are not that rare actually, it's extremely common in languages like swift and... stuff
feisty2
20th May 2017, 14:25
decltype(0ull) Width = 0;
And what's the reason for not writing the type name here? "unsigned long long" too long? There are shorter alternatives: "size_t", "ptrdiff_t", "uint64_t".
again for the same reason here, I still couldn't understand why "auto" is not allowed for non-static class members (I mean auto is allowed even for template parameters since c++17) and until "auto" is allowed there someday, maybe, "decltype" is the closest thing to "auto" and it's the only choice I got if I want the unified coding style,,, maybe a bit of macro will do the magic and "allow 'auto' for non-static class members"
I'm not using any "decltype" stuff in the function parameter list cuz I want function overloads to be explicit and clear, but I don't give a fuck about the types of members in a class.
Does that also work with a lot less swearing? Don't make it look like a Tourette project, please... :o
videoh
20th May 2017, 21:06
Does that also work with a lot less swearing? Don't make it look like a Tourette project, please... :o Plus 1.
Myrsloik
22nd May 2017, 15:40
please check again if it works with the latest gcc now,,, and pick -std=c++17 instead of c++14, I'm using the c++17 syntax and c++14 might fail if some structured bindings and stuff wanna get in the party
Get your own thread.
VS_Fan
24th May 2017, 03:12
I was trying BoxBlur as a way to prepare the input for mv.DepanAnalyse. I tried different values for hradius, wihout any evident problem.
But any value for vradius will crash vseditor and vspipe, after showing the message: “Attempted to read key 'clip' from a map with error set: Transpose: Clip must have same subsampling in both dimensions”.
That made me try changing chroma subsampling to 420 and 444 without any success.
Also: After a successful BoxBlur with hradius > 0, there seems to be a change in the chroma subsampling: using std.Transpose immediately after, will raise the error: “vapoursynth.Error: Transpose: Clip must have same subsampling in both dimensions”, but without crashing. If I reset the chroma subsampling (fmtc.resample(css="420")) after BoxBlur and before std.Transpose, there will be no error.
Myrsloik
29th May 2017, 12:47
I was trying BoxBlur as a way to prepare the input for mv.DepanAnalyse. I tried different values for hradius, wihout any evident problem.
But any value for vradius will crash vseditor and vspipe, after showing the message: “Attempted to read key 'clip' from a map with error set: Transpose: Clip must have same subsampling in both dimensions”.
That made me try changing chroma subsampling to 420 and 444 without any success.
Also: After a successful BoxBlur with hradius > 0, there seems to be a change in the chroma subsampling: using std.Transpose immediately after, will raise the error: “vapoursynth.Error: Transpose: Clip must have same subsampling in both dimensions”, but without crashing. If I reset the chroma subsampling (fmtc.resample(css="420")) after BoxBlur and before std.Transpose, there will be no error.
Here's R38-RC2 (https://dl.dropboxusercontent.com/u/73468194/VapourSynth-R38-RC2.exe). It should fix this issue. This build will be released unless serious regressions are found.
Boulder
31st May 2017, 16:53
Is there a possibility to enhance VDecimate so that it would support dropping more than one frame per cycle? I once again have a silly Blu-ray which needs some special decimation as the cycle is lengthy and the decimation pattern is not 100% constant. The override file only drops the first marked frame inside the cycle.
Myrsloik
31st May 2017, 16:59
Is there a possibility to enhance VDecimate so that it would support dropping more than one frame per cycle? I once again have a silly Blu-ray which needs some special decimation as the cycle is lengthy and the decimation pattern is not 100% constant. The override file only drops the first marked frame inside the cycle.
Do you mean M in N decimation or something even weirder? How long is the cycle? What's the pattern? Can I have a small sample in case I'm inspired?
Boulder
31st May 2017, 17:17
The cycle is veeery long I'm afraid, looks like it's tens of frames with 5 normal frames followed by 1 dupe, then 6 normal frames followed by 1 dupe and then the cycle restarts. As this is a concert video, there are a lot of cuts to confuse you. I wonder if mode 2 from TIVTC would actually suit this one better.. This issue is probably caused by the "shot at 25 fps, then butchered to 29.97 fps" approach.
Anyway, here's a sample which contains one cycle: https://drive.google.com/open?id=0BzeF_1syecQwbzh0cWJVSnRpOGM
Myrsloik
31st May 2017, 17:32
The cycle is veeery long I'm afraid, looks like it's tens of frames with 5 normal frames followed by 1 dupe, then 6 normal frames followed by 1 dupe and then the cycle restarts. As this is a concert video, there are a lot of cuts to confuse you. I wonder if mode 2 from TIVTC would actually suit this one better.. This issue is probably caused by the "shot at 25 fps, then butchered to 29.97 fps" approach.
Anyway, here's a sample which contains one cycle: https://drive.google.com/open?id=0BzeF_1syecQwbzh0cWJVSnRpOGM
A two pass solution is probably what you really need then. I'm not sure how else to get good results in a video like that. Definitely not a priority for me right now.
videoh
31st May 2017, 18:31
TDecimate() handles long cycles, up to the number of frames in the video! DGDecodeNV has a DGDecimate() function implemented with CUDA that supports N-in-M with cycles of up to 40 frames.
Myrsloik
31st May 2017, 18:44
I'm wondering about why VS_FRAME_POOL is only defined under VS_TARGET_OS_WINDOWS in vscore.h. Why can't non-windows systems make use of the frame pool?
This has to do with how memory allocation works in different operating systems. If you benchmark it on linux it is just as fast (or possibly even faster) without it defined. That's why it isn't defined.
It was added because on windows memory allocation generally works like this:
For small allocations a very fast sub-allocator is used. You get awesome speedz!
For larger allocations it basically just passes on the call to VirtualAlloc. VirtualAlloc is slow as fuck. It has to zero all allocated memory for security reasons and a pile of other fun stuff (if I'm not mistaken).
The small allocation size limit is around a few MB, or more exactly between 1080p and 4k. This makes VS exceptionally slow at processing higher resolutions. The pool is simply there as a workaround to remove most of the negative performance effects in windows (it's still a lazy implementation with a global mutex). Before this solution I used tcmalloc which handles it even better.
Myrsloik
5th June 2017, 21:45
R38 is released.
The usual post (http://www.vapoursynth.com/2017/06/r38-boxblur-is-best-blur/)
lansing
8th June 2017, 16:07
What is the Virtualdub filter plugin on the priority list now?
There's a new Virtualdub version that supports more colorspace/higher bit depth input and output now:
https://forum.doom9.org/showthread.php?t=172021
Myrsloik
8th June 2017, 16:22
What is the Virtualdub filter plugin on the priority list now?
There's a new Virtualdub version that supports more colorspace/higher bit depth input and output now:
https://forum.doom9.org/showthread.php?t=172021
I don't understand the question. You want vdub plugin support? I've already added several additional output formats that vdub filtermod can use.
lansing
8th June 2017, 16:34
I don't understand the question. You want vdub plugin support? I've already added several additional output formats that vdub filtermod can use.
I'm talking about a Vapoursynth plugin that can load in Virtualdub filters.
I have a few vd filters that I wanted to load into the script. I was hesitant to use them before because it requires colorspace conversion in between on the original VD.
lansing
11th June 2017, 06:46
I don't know if this is a bug, when I pass a 32 bit video script to the encoder, I'll get this error even though I set the encoder to 10 bit output. I have to change the bit depth in the script to 16 or less in order to not crash.
The Vapoursynth process terminated abnormally. This means Vapoursynth or one of your Vapoursynth-Plugin's just crashed.
feisty2
24th June 2017, 10:13
@Myrsloik
can you add Plum (https://forum.doom9.org/showthread.php?t=173775) to the plugin list?
it's now complete.
Myrsloik
24th June 2017, 18:04
@Myrsloik
can you add Plum (https://forum.doom9.org/showthread.php?t=173775) to the plugin list?
it's now complete.
Will do
stax76
4th July 2017, 12:47
It's a issue for me that ffmpeg and mpv don't support vapoursynth under windows. How is avisynth support implemented in mpv/ffmpeg/x264, do all tools get avisynth support via libavformat and how is it implemented, directly or via vfw or DiectShow? I will definitely at least make a feature request, the more people request it the better the chances that it will happen.
I believe x264 (and ffmpeg probably too) uses the AviSynth API, not VfW. And certainly not DirectShow, which would need a VfW wrapper...
TheFluff
4th July 2017, 15:07
Yes, both x264 and libavformat interact with the Avisynth API directly. mpv uses the VS API to implement realtime playback filtering with VS but I dunno if it supports VS input that way.
It's a issue for me that ffmpeg and mpv don't support vapoursynth under windows. How is avisynth support implemented in mpv/ffmpeg/x264, do all tools get avisynth support via libavformat and how is it implemented, directly or via vfw or DiectShow? I will definitely at least make a feature request, the more people request it the better the chances that it will happen.
What exactly is an issue? Do you need seeking?
stax76
4th July 2017, 16:11
I mostly want to improve staxrip, if there is no native vapoursynth support then you have to use a batch file with piping and then you cannot use unicode or ascii above 137 in Windows 7 because this is broken in Windows 7. For Englisch speaking countries it's not a issue but for my country and many others it is, there are other issues like usability. I need a player for staxrip that can read avs/vpy and can take a delay and audio/subtitle stream ID via command line and is High DPI ware, such a player don't exist yet, I'm now working on it.
TheFluff
4th July 2017, 16:33
I'm somewhat skeptical of that claim but I'll take your word for it. However, I can think of at least three ways to work around that issue just off the top of my head and there are surely more - in fact, I have no idea why you're even involving a batch file. Some random ideas:
- Powershell script file instead of .bat file, if you insist on doing it in an awkward way
- CreateProcessW cmd.exe /c "your command here" (or, again, PowerShell)
- Create a named pipe, then CreateProcessW twice (once for vspipe, once for the consumer application)
stax76
4th July 2017, 16:47
I can try with powershell since I already use powershell for extensibility, staxrip is hosting the powershell engine for that but for powershell.exe as host scripts might only work if the user changes security settings, by default script execution is disabled. There might be ways, probably there are but Windows 7 isn't top priority for me I have to admit, I'm focused at the playback issue atm.
edit:
about the text encoding issue in Win 7, I'm not the first to notice, here is a thread at stackoverflow:
https://stackoverflow.com/questions/388490/unicode-characters-in-windows-command-line-how
TheFluff
4th July 2017, 16:58
That's about trying to use UTF-8, as far as I can tell, and that's not bound to work out well on Windows. I assume you've tried UTF-16 too, but I have no idea why that wouldn't work and it's extremely weird if it doesn't. vspipe.exe at least expects a UTF-16 command line on Windows, just like everything else. I'm not at my Windows box at the moment or I'd just try it.
stax76
4th July 2017, 21:28
I'm always getting a crash:
Problemsignatur:
Problemereignisname: BEX64
Anwendungsname: StaxRip.exe
Anwendungsversion: 1.5.1.8
Anwendungszeitstempel: 595bf0e3
Fehlermodulname: StackHash_1dc2
Fehlermodulversion: 0.0.0.0
Fehlermodulzeitstempel: 00000000
Ausnahmeoffset: 0000000000000000
Ausnahmecode: c0000005
Ausnahmedaten: 0000000000000008
Betriebsystemversion: 6.1.7601.2.1.0.768.3
Gebietsschema-ID: 1031
Zusatzinformation 1: 1dc2
Zusatzinformation 2: 1dc22fb1de37d348f27e54dbb5278e7d
Zusatzinformation 3: cbc5
Zusatzinformation 4: cbc5ec6970b2af35927ad67117ca57e2
https://answers.microsoft.com/en-us/windows/forum/windows_7-performance/can-anyone-help-me-to-solve-the-appcrash-problem/6c2bfd74-5eb4-4c5f-92c6-90818086d964
This happens on Win 7 inside vmware, it's my test system only used for testing staxrip on win 7, it has nothing installed except things needed to run staxrip so avisynth, vapoursynth, python, vc++ runtimes and .NET, newest version of all this software. I can't tell when it started because I test vs on win 7 only occasionally.
jackoneill
5th July 2017, 12:49
I'm always getting a crash:
Problemsignatur:
Problemereignisname: BEX64
Anwendungsname: StaxRip.exe
Anwendungsversion: 1.5.1.8
Anwendungszeitstempel: 595bf0e3
Fehlermodulname: StackHash_1dc2
Fehlermodulversion: 0.0.0.0
Fehlermodulzeitstempel: 00000000
Ausnahmeoffset: 0000000000000000
Ausnahmecode: c0000005
Ausnahmedaten: 0000000000000008
Betriebsystemversion: 6.1.7601.2.1.0.768.3
Gebietsschema-ID: 1031
Zusatzinformation 1: 1dc2
Zusatzinformation 2: 1dc22fb1de37d348f27e54dbb5278e7d
Zusatzinformation 3: cbc5
Zusatzinformation 4: cbc5ec6970b2af35927ad67117ca57e2
https://answers.microsoft.com/en-us/windows/forum/windows_7-performance/can-anyone-help-me-to-solve-the-appcrash-problem/6c2bfd74-5eb4-4c5f-92c6-90818086d964
This happens on Win 7 inside vmware, it's my test system only used for testing staxrip on win 7, it has nothing installed except things needed to run staxrip so avisynth, vapoursynth, python, vc++ runtimes and .NET, newest version of all this software. I can't tell when it started because I test vs on win 7 only occasionally.
Hi. This is the VapourSynth support forum. Please report crashes in StaxRip.exe at the StaxRip.exe support forum.
@jackoneill:
In case you did not know - stax76 is the author of StaxRip, and he is trying to integrate VapourSynth support into StaxRip. And fails due to reasons he is unable to discover.
Myrsloik
5th July 2017, 12:58
@jackoneill:
In case you did not know - stax76 is the author of StaxRip, and he is trying to integrate VapourSynth support into StaxRip. And fails due to reasons he is unable to discover.
No wonder he can't discover the cause when no debugger was used to gather information...
stax76
5th July 2017, 13:03
@jackoneill
Do you have a idea how many times native modules have crashed staxrip in the past? I had a huge fight (which I regret) with DG because of this and paid a avisynth dev to fix asm code in order to have qtgmc running in staxrip. I'll figure this out shortly.
Myrsloik
5th July 2017, 13:06
@jackoneill
Do you have a idea how many times native modules have crashed staxrip in the past? I had a huge fight (which I regret) with DG because of this and paid a avisynth dev to fix asm code in order to have qtgmc running in staxrip. I'll figure this out shortly.
Having a huge fight with DG is easy. Just disagree on any trivial topic and that happens. The failure to include a stack trace ensures that none of us can do anything except troll all day long, but that's fine.
videoh
5th July 2017, 16:30
Do you have a idea how many times native modules have crashed staxrip in the past? I had a huge fight (which I regret) with DG because of this and paid a avisynth dev to fix asm code in order to have qtgmc running in staxrip. Is this the huge fight you are talking about?
http://rationalqm.us/board/viewtopic.php?f=8&t=490
That is the only topic you have participated in at the DG forum that I can find.
All I see there is DG trying his best to help debug some issues, which turned out to be caused by an antivirus and a bad Avisynth version. Yes, there was also a problem of DG not supporting more than 32 audio streams in an MKV, but DG fixed it for you right away. I don't see any fighting. Also, you are a Distinguished Member at DG's forum and you and DG have always worked well together.
stax76
5th July 2017, 19:10
I'm not looking back, he's done a lot for me unless MPC devs which is zero I believe but that's fine too.
videoh
5th July 2017, 20:45
he's done a lot for me unless MPC devs which is zero I believe Can you clarify that? DG has always worked closely with 3rd-party app authors: staxrip, megui, bd rebuilder, etc. What's the story about MPC? And where is this huge fight you mentioned?
stax76
5th July 2017, 21:24
Like I said DG always helped me and I'm sure he did the same for the other authors and the community. Story about MPC is frustration growing since a decade, maybe they helped me in the past but I cannot remember, doesn't matter, there are many other players that deserve recognition and I can also code something myself. I'm a total idiot that I struggled 10 years with MediaMonkey's poor high DPI support until I finally migrated to MusicBee, since then I'm trying to test and learn more new and alternative apps I might have overlooked instead of continuing with old habits forever. Sorry for being OT again and for the poor initial bug report and always not doing enough for Win 7, with an idea from TheFluff I've sorted a long standing text encoding issue out on Win 7 in my next built and I'll be definitively looking into the issue with VS, maybe one day hello_hello and Manolito will migrate to Win 7 and everybody will be happy.
videoh
5th July 2017, 21:50
I hear you, buddy. Theory and practice -- never the twain shall meet.
manolito
6th July 2017, 00:13
maybe one day hello_hello and Manolito will migrate to Win 7 and everybody will be happy.
In case you didn't know, I do use Win7 on my laptop simply because my old WinXP desktop does not handle HD movies. And because I do use both OS in parallel all the time, I think that I am qualified to judge them, and I still prefer WinXP by a huge margin...
BTW even on my Win7 computer I use StaxRip 1.1.9.0. I did try the current 64-bit incarnations of StaxRip, but they were unusable for me simply because I absolutely need some old 32-bit plugins for my workflow (like some VDub plugins). This old version of StaxRip has some rough edges for sure, I try to keep most helper software up to date, still I could use some help sometimes. But I really do not dare to bother you with questions about this old version, mostly for fear of being chastized... :devil:
Alright, totally OT for this thread, I apologize...
Cheers
manolito
stax76
6th July 2017, 11:52
@videoh
Never heard that saying before, last TV shows (The Americans!!! and The 100) I watched in original audio so there is small hope that my english improves.
@manolito
I know about four regulars that they talk about XP a lot but not in detail. Two of my principles in regard of staxrip development are listen to users and move forward, if there are enough people asking for a 32-bit built I'll do it, technically it's not a big thing I believe, it's just against the move forward principle which gives me time to work on things like VapourSynth and AV1 support.
@Myrsloik
I've tried to open a script with VD which also crashes, do you need anything else, any tips what to try next? If nobody has a better idea I'll install Visual Studio next.
https://pastebin.com/wysNw2W7
https://postimg.org/image/m9i3vcvfp
Myrsloik
6th July 2017, 18:30
Use visual studio already. I've never managed to get useful information from the vdub stuff.
stax76
7th July 2017, 15:25
Oh man, Visual Studio setup was freezing, I noticed then a sign in the tray telling about updates, after installing 185 important updates it runs fine, this system had auto update never enabled and I totally forgot about it, I'm using it only for testing staxrip's Win 7 and 96 DPI compatibility. I'm sorry guys.
george84
10th July 2017, 13:40
Does anybody know how to replace the external avisynth filter zoom as described in https://forum.doom9.org/showthread.php?t=49429
?
lansing
7th August 2017, 20:50
I'm trying to append two clips with different resolution, but I'm getting nothing shown in the Vapoursynth editor preview, but there's no error message
clip = core.std.Splice([clip, clip2], mismatch=1)
Also how do I use the mismatch function in the operator method?
clip + clip2
blaze077
7th August 2017, 21:35
Make sure zoom's not on fixed ratio in VSEdit.
lansing
7th August 2017, 22:32
Make sure zoom's not on fixed ratio in VSEdit.
Thanks my first problem was solved
lansing
8th August 2017, 08:20
Where do I find the list of properties of a frame? For example, I want to get the frame number of a frame. There nothing written in the documentation about this.
blaze077
8th August 2017, 08:51
It's all there in the documentation:
FrameNum (http://www.vapoursynth.com/doc/functions/framenum.html) | FrameProps (http://www.vapoursynth.com/doc/functions/frameprops.html) | SetFrameProp (http://www.vapoursynth.com/doc/functions/setframeprop.html)
A frame's properties can be accessed by using the get_frame function along with the props attribute. Like so:
src.get_frame(num).props.someFrameProperty = someValue
Reference (http://www.vapoursynth.com/doc/pythonreference.html#classes-and-functions).
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.