1

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:

  1. 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.

  2. 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.

  3. 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.

9
  • Why not setup the projector in a way that it's just using that center space? Also make sure that Video > Always fit to Window isn't set.
    – Seth
    Jul 31, 2017 at 9:51
  • 1
    @Seth Can't, because it needs to use the other areas in some circumstances. Note that I asked cvlc specifically: there is no GUI, no clicky things. I would assume that that checkbox corresponds to --no-autoscale but there's no way to tell (apart from reading the source).
    – Thomas
    Jul 31, 2017 at 9:58
  • Have you tried to transcode the video to the projector? set something like --sout-transcode-maxwidth=<integer> and --sout-transcode-maxheight=<integer>, Transcoding will transfer the data to the device to the desired format
    – Jimmy_A
    Jul 31, 2017 at 10:41
  • @D.A I have tried those flags, but by themselves they do nothing. Do I need to add more flags to make them work?
    – Thomas
    Jul 31, 2017 at 10:45
  • I haven't used transcoder before. But what it does is that it decodes and re-encodes the video stream to a specified format. So I am assuming that you need to specify a video encoder as well. Check the transcode part in the documentation
    – Jimmy_A
    Jul 31, 2017 at 10:52

2 Answers 2

1

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 option


Zoom 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

3
  • Thanks a lot for your digging! I did find a bug where my auto-zoom-calculator script returned 0 rather than 0.649... because the target system uses python2 instead of python3. Yet, setting --zoom 0 on my own machine just results in an error, not a tiny video as my client reports on the target system.
    – Thomas
    Aug 1, 2017 at 6:36
  • @Jimmy_A I'm experimenting around the same problem, without any working solution so far. What version of VLC are you using ? Thanks
    – brunetton
    Jan 23, 2018 at 20:45
  • @brunetton I now have version 2.2.2. But keep in mind that the answer is 6 months old. I think 2.2.2 was introduced around August so I might had 2.1.2 at the time. However, I get the same results.
    – Jimmy_A
    Jan 25, 2018 at 10:21
0

I had the same issue and after a some trial and error found out that if I set --crop command line option to the aspect ratio of my display (in my case 4:3, and in your case 16:9, so cvlc --crop=16:9 video.mp4) the entire screen gets filled no matter what the resolution of the video is. Note that if you play 4:3 video file in this mode the top and bottom of the video will get cut off to fit on your 16:9 ratio display.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .