I have a video that's 1232×800 pixels in size, to be played on a projector with 1280×800 resolution, but constrained to a box of 800×800 in the middle of the screen, maintaining aspect ratio. So the actual video size would be about 800×519, i.e. scaled to about 65%; black bars are to be added on all sides:
+---------screen---------+
| |
| +----video-----+ |
| | | |
8 5 | |
0 1 | |
0 9 | |
| | | |
| +------800-----+ |
| |
+----------1280----------+
I could alter the video file to include the black bars, but would rather avoid the inevitable quality loss (and codec hassles) from transcoding. Moreover, we'd like this to be easily adaptable to other resolutions in the future.
So how to achieve this during playback using cvlc
(i.e. just command line options)?
Things I tried:
-
cvlc --fullscreen --vout glx --no-autoscale --scale 0.65 video.mp4
This is what the documentation (
--help
) of--autoscale
and--scale
would suggest. But it seems that--scale
is just ignored. -
cvlc --fullscreen --vout glx --width 800 --height 519 video.mp4
This doesn't seem to do anything. The video is still scaled to fit the screen.
-
cvlc --fullscreen --vout glx --no-autoscale --zoom 0.6493506493506493 video.mp4
This works on my machine (VLC 2.2.6) but reportedly results in a tiny video on the production system.
I'm using VLC 2.2.2 on Ubuntu 16.04 LTS, so I cannot easily upgrade.
Best Answer
Your question made me curious all day. I've been playing around on an Ubuntu VM for the past hour and did a little digging.
The first two set of options you are using:
cvlc --fullscreen --vout glx --no-autoscale --scale 0.65 video.mp4
and
cvlc --fullscreen --vout glx --width 800 --height 519 video.mp4
are targeting window scaling. If you remove
--fullscreen
from your command, you will see that the window opening is the exact size as you specify, but once you enable fullscreen, the video plays in the original size.I have tried every single option that includes the word width/height in the official VLC command-line help and the result is the same.
Your third command is your best case. The third command is the only one that affects the video stream and not the window. So you have to find the best percentage that will play your video exactly as you want to.
The suggestions I made in the comments for Devilspie2 and kpie are affecting the size of the window as well, so they may not seem appropriate in your case.
Right now, your best shot is to find the ideal number for the
--zoom
optionZoom will not give you the exact size that you are looking for since there is no way to specify width and height with
--zoom
. If you are willing to give transcoding a shot, then you might get the expected results