Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: -mirror option #350

Open
stefano-px opened this issue May 2, 2015 · 25 comments
Open

Feature request: -mirror option #350

stefano-px opened this issue May 2, 2015 · 25 comments

Comments

@stefano-px
Copy link

Hello. I would like a -mirror option which make omxplayer play the video "mirrored". Is it possible?

Thanks.

@popcornmix
Copy link
Owner

In theory it's possible. See m_transform in OMXVideo.cpp.
Can you explain when this is useful?

@stefano-px
Copy link
Author

Thanks for reply. Even I if I'll look in that file, I don't think I will be able to implement -mirror option (or -flip in mplayer). This is useful when you use a Fresnel lens in front of monitor screen to projet images to a wall (I mean cheap DIY projector).

Thanks.

@popcornmix
Copy link
Owner

Are you able to build omxplayer from source? I could suggest what to edit.

@stefano-px
Copy link
Author

Yes, I'm able. Thanks for help.

@FlachyJoe
Copy link

Can be use to project throw a translucent screen too.

@popcornmix
Copy link
Owner

Transform options supported are:
https://github.com/raspberrypi/firmware/blob/master/opt/vc/include/IL/OMX_Broadcom.h#L204

You probably want OMX_DISPLAY_MIRROR_ROT0.

As a test try changing this line:
https://github.com/popcornmix/omxplayer/blob/master/OMXVideo.cpp#L221

to be:
configDisplay.transform = OMX_DISPLAY_MIRROR_ROT0;

@stefano-px
Copy link
Author

Hi.
Yes! That works perfectly! Hope we'll have an option -flip or -mirror in next release.

Thanks a lot!

@stefano-px
Copy link
Author

Oops, I spoke too early. The Fresnell lens mirror and and turn upside down the image, so I still need --orientation that does not work. I had to give you this info. But the most is done. FFmpeg was compiled. I will see at the transform option. Thanks a lot for help.

@popcornmix
Copy link
Owner

Does configDisplay.transform = OMX_DISPLAY_MIRROR_ROT180; work?

@stefano-px
Copy link
Author

YES! Great! A big thank you!

@Ruffio
Copy link

Ruffio commented Jun 9, 2015

@popcornmix is this going to be implemented as an option? Perhaps -flipvertical and -fliphoritonzal. If not, this feature request should be closed.

@Ruffio
Copy link

Ruffio commented Jun 17, 2015

As I remember, you can set a config on RiP to flip the output both vertically and horizontally, I think...

@stefano-px
Copy link
Author

@ Ruffio Thanks. Last time I checked rotate_disply=value those options were not present, only 90,180,270. I see now there are 0x10000 and 0x20000. It's good to know, even I would still prefer an option in omxplayer because it's much comfortable than editing config.txt and reboot any time I need to flip screen. Thanks again.

@popcornmix
Copy link
Owner

My main objection is adding another two command line options that almost no one uses just makes it harder for a user to find tthe genuinely useful options.

I'm willing to add a secret option. There is already an option --orientation n for the 4 orientations. It looks straightforward to abuse that slightly. @stefano-px can you test this patch:

diff --git a/OMXVideo.cpp b/OMXVideo.cpp
index 4e48d48..8cc7d9d 100644
--- a/OMXVideo.cpp
+++ b/OMXVideo.cpp
@@ -640,6 +640,18 @@ bool COMXVideo::Open(OMXClock *clock, const OMXVideoConfig &config)
     case 270:
       m_transform = OMX_DISPLAY_ROT270;
       break;
+    case 1:
+      m_transform = OMX_DISPLAY_MIRROR_ROT0;
+      break;
+    case 91:
+      m_transform = OMX_DISPLAY_MIRROR_ROT90;
+      break;
+    case 181:
+      m_transform = OMX_DISPLAY_MIRROR_ROT180;
+      break;
+    case 271:
+      m_transform = OMX_DISPLAY_MIRROR_ROT270;
+      break;
     default:
       m_transform = OMX_DISPLAY_ROT0;
       break;

Now run with --orientation 1 or --orientation 181 to get the two flip options (basically add one to orientation and it includes a mirror in the transform).

@stefano-px
Copy link
Author

Hi
Just compiled and tested. It works very well. I tested 1, 91, 181, 271 with no problems. Fortunately I still have the ffmpeg already compiled and I had just to rebuild omxplayer.Thanks for the patch. I agree with you: --orientation is the right option to use.

@popcornmix
Copy link
Owner

I've pushed that patch. I'm leaving it out of the normal help text as I think it's useful to very few users. It should be something that the few users who need it can find by searching.

@stefano-px
Copy link
Author

Well. Thanks.

@tvjon
Copy link

tvjon commented Jun 20, 2015

What a coincidence! I've been trying to work out where & how I might achieve a mirror display over the last couple of days.

During the search, today I too discovered the "display_rotate=0x10000", so of course tried that briefly, but it took a minute or so to realise the cursor wasn't obeying the new right to left display, so I had to guess where the menus would have been on the left hand side! I then remembered I'm using jamesH' HW cursor, & sure enough disabling that restored cursor operation, so I'll post that to James' thread next.

My use for mirroring is to mirror either the hdmi, or Gert's VGA666 add-on board, specifically currently for omxplayer, but it could be handy in other applications too.

Popcornmix, I can understand your reticence at including such extras, but such can save a lot of time & effort trying to achieve by convoluted means, so IMHO a relatively small addtion as this appears to be, may turn out more useful than at first apparent...

So, thank you for implementing it. I'll see if I can build omxplayer on my RPi2 now, as I've just checked sconde.net & it's not appeared yet.

@popcornmix
Copy link
Owner

Ping @skgsergio.

@skgsergio
Copy link

Pong!

I'm currently away (returning indeed), tomorrow morning (european time) I'll upload it:
-rw-r--r-- 1 rpibuild rpibuild 3,4M jun 18 02:54 /home/rpibuild/omxplayer_0.3.6git20150618fe66e57_armhf.deb

@popcornmix
Copy link
Owner

@skgsergio no problem.

@towolf
Copy link

towolf commented Jun 24, 2015

My main objection is adding another two command line options that almost no one uses just makes it harder for a user to find the genuinely useful options.

It’s often fallacious to make assumptions about what uses one’s software will see. Especially for Raspberry Pi where funky projects are the norm.

In other bugs you stated that looping videos is out of scope of omxplayer. Yet, many people want to loop videos, and omxplayer is the "default" video player.

There are already many options of omxplayer that seem obscure, I wouldn’t regard mirrored playback as one. Many setups may require mirrored playback. If it involves projection or an actual glass mirror (think periscope or projection into the bore of an FMRI scanner) then pre-mirroring is often necessary.

If the options list eventually becomes too long, consider --help and --full-help.

@tvjon
Copy link

tvjon commented Jun 28, 2015

Hello.

Although I've obviously raised "issues" on Github, it's only ever been
to an existing list, & I'm unsure how to inform about something like
this, as no "Issues" tab appears alongside the popcornmix/userland
files so I hope you don't mind this obscure way of letting you know?

I've been using:

userland/host_applications/linux/apps/hello_pi/hello_video_simple/video.c
(thank you, very useful!)

but displaying several window'd videos, noticed one seemed to be in the
wrong place.

I think just a typo,

shouldn't line 183,

dest_rect.y_offset = atoi(argv[1])

actually be

dest_rect.y_offset = atoi(argv[2]) ?

john

@popcornmix
Copy link
Owner

You are correct. Should be fixed now.

@mylodavidt
Copy link

I just found the "secret" option. Thanks for adding that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants