I may have some insight into this, although not currently a proper solution.
First of all, not every portrait video has this problem. As far as I can tell, it is only videos with "Bottom right" orientation. I've attached a portrait mode video that won't do it.
Bottom Right's got some interesting properties. For reasons beyond my own understanding, Bottom Right orientation has to be handled specially in anything that uses the size of a video. Width and Height have to be swapped.
I've been told this is not a bug, that it is intended behavior that Size gives the wrong coordinates for just this one rotation and that it is an intentional part of VLC's design that anything that uses Size has to handle this by checking the rotation and swapping the x and y axes if it is Bottom Right. This is... confusing to me, but I guess it is just how VLC is. I'm sure there's a good reason for it.
However, because this quirk is not very well known, and because everything that uses Size has to implement the Width/Height swap itself (there's isn't a standard SizeWithBottomRightFixed() function you can use, as far as I know) it's very easy for this to be overlooked, or even implemented incorrectly.
I would bet money that this is what has happened here. Either Bottom Right orientation is not getting its coordinates swapped at all, in the snapshot function, or perhaps some time long ago somebody working on the snapshot function noticed that Bottom Right needed a workaround but didn't handle the swap quite right, and that's how we wound up with rotated snapshots instead of squashed and stretched snapshots.
Not particularly. Besides the normal top-left, the special ones are left-bottom and right-top.
For reasons beyond my own understanding, Bottom Right orientation has to be handled specially in anything that uses the size of a video.
Width and Height have to be swapped.
That is of course completely false. Bottom-right, a.k.a. 180 degrees rotation a.k.a. flipped both vertically and horizontally does not change the resolution in any way.
Left-bottom and right-top do that. As do left-top and right-bottom in fact, but those two are hardly used ever.
If the snapshot is of original physical orientation, and target format does not store rotation that can't work.
Would you care to explain why that would be? Snapshots are in any case taken from decoded pictures, so it should actually be easy to apply the transform to top-left orientation before encoding and saving the image file.
If the snapshot is saving image after physical transformation, then that does save wrong info.
That sounds like a bug. Either you don't apply the transform and write it in the meta-data (this is possible for JPEG in the EXIF header for sure - I don't know about PNG). Or you do apply the transform and you do adjust the resolution. I don't think it is even possible not to adjust the resolution without getting a totally corrupt unusable file.
I don't see what's "not that easy" here. It looks rather trivial, except for the fact that (perhaps) nobody cared to implement in the picture export code.