2

When I run this program in Python 3 it is working but the video is in full-screen.

from subprocess import run
videoPath = "/home/pi/video_3.h264"
omx = run(["omxplayer",videoPath])

As soon as I add arguments to run the video in windowed nothing happens:

from subprocess import run
videoPath = "/home/pi/video_3.h264"
omx = run(["omxplayer","--win 1,1,500,400",videoPath])

I tried omxplayer --win 1,1,500,400 /home/pi/video_3.h264in terminal and it is working. Is my Python syntax wrong?

  • I have the same problem. Have you try with only one hyphon? – Fco Coll Jan 12 at 13:21
3

Arguments given to Python's subprocess and friends are generally not allowed to have spaces.

omx = run(["omxplayer", '--win', '1,1,500,400', videoPath])

The above should work. In this instance, single or double quotes don't matter. Make sure to have '--win' and the geometry specification next to each other in the correct order.

-3

try

omx = run(["omxplayer", --win '1,1,500,400',videoPath])
  • 3
    It's best if the answer contains some explanation as to why it's the correct answer. This not only helps the one who asked, but also others in the future. For instance, why do the single-quotes matter? That seems to be the only change between what the OP had an error with and what you have. – NomadMaker Jul 24 '18 at 5:56
  • Are you sure you typed this correctly, cctv? --win in the Python code would just give a syntax error as it's not wrapped in a string of any sort. Did you perhaps mean to wrap the whole thing in double quotes, then have the single quotes as well? – Aurora0001 Jul 24 '18 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.