home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 42,414 of 42,547   
   Oliver to Herbert Kleebauer   
   Re: How do you display relative cursor X   
   17 Nov 24 19:44:25   
   
   XPost: alt.comp.os.windows-10, rec.photo.digital   
   From: ollie@invalid.net   
      
   On Mon, 18 Nov 2024 01:07:17 +0100, Herbert Kleebauer  wrote   
      
   >> I had to install Handbrake 1.8.2 which also required Net 8.0 on Windows.   
   >   
   > I don't understand why it is easier to install new software instead   
   > of using the already installed IrfanView.   
      
   DO NOT CLOSELY READ THIS POST - IT IS FOR REFERENCE - I WILL REWRITE IT!   
   (JUST NOTE THAT GETTING THE FRAME GRAB IN THE CLIPBOARD IS AN ISSUE.)   
   ONCE THE FRAMEGRAB IS IN THE CLIPBOARD, THEN YOUR BATCH FILE WORKS GREAT!   
      
   Thanks for bringing that up as the goal of every Usenet thread is also to   
   learn for the thousands of people who read this thread both now & forever.   
      
   Just to be super clear, I never said either way was easier, and in fact I   
   said I wanted a purely graphical "draw-the-box" solution, and as yet, we   
   haven't found that area-draw method (but it probably exists... somewhere as   
   it's a common need to want to draw an area box and then to want to crop the   
   entire video to that drawn area box.   
      
   In fact I had done the Handbrake method before I saw your Irfanview method.   
   The Handbrake method was "said" to be purely graphical - but it's not.   
   It's partly graphical. Much like the Irfanview method is (only different).   
      
   What is really needed is a video player that shows the cursor X:Y position.   
   I have to believe that already exists on Windows 10.   
      
   Just because the cursor position is so obvious a need. It must exist.   
   But where?   
      
   I think you're probably correct that this mystery program could be   
   Irfanview since I tried your method and I like the way you think.   
      
   > 1. Open the video in your player and copy one video frame   
   >     to the clipboard (for the Potplayer this is just a -C).   
   >     You can close the player then. You can also start the player   
   >     in the batch if you want.   
      
   Saving a video frame is easy so that's not going to be a problem.   
      
   The player most people use on Windows (AFAIK) is either MPC-BE or VLC.   
   When I open output.mp5 in MPC the "MPC: File > Properties" tells me:   
    Width: 1,920 pixels   
    Height: 1,080 pixels   
   But unfortunately I see no option to display the cursor X:Y location.   
   Likewise with the venerable VLC (as far as I can tell anyway).   
      
   In MPC-BE (which most people use) there doesn't seem to be a way to save   
   the frame to a file. A Windows print-screen would be all wrong.   
      
   Luckily in VLC (which most people also use) there is an option   
   VLC:Video > Take snapshot" which puts a single-frame grab into   
   C:\Users\you\Pictures\vlcsnap-2024-11-17-18h08m36s459.png   
      
   I'm not sure how to get that video frame into the clipboard though.   
      
   > 2. Execute this batch:   
   >    (I use the ini file in IrfanView, if you use the registry you have   
   >    to modify the batch. You also have to use the correct path to Irfanview).   
      
   I also use the ini file in Irfanview because I install into a custom   
   location and putting stuff in the registry is just asking for trouble.   
      
   I like the way you think.   
      
   >:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::   
   :::::::::::::::::::   
   >:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::   
   :::::::::::::::::::   
   > @echo off   
   >   
   > start /w "" D:\Programme\IrfanView\i_view32.exe /clippaste   
   >   
   > for %%k in (CustSelX CustSelY CustSelW CustSelH) do (   
   >    for /f "delims=." %%i in ('find "%%k=" ^    )   
   >   
   > echo  ffmpeg -i in.mp4 -vf "crop=%CustSelX%:%CustSelY%:%CustSe   
   W%:%CustSelH%" -c:a copy out.mp4   
   >   
   >:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::   
   :::::::::::::::::::   
   >:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::   
   :::::::::::::::::::   
      
   I like the way you think so I copied that and changed the path to Irfanview   
   64 ini file (there was no 32-bit ini file in the Irfanview directory).   
      
   Unfortunately a right-click-copy on that VLC frame grab didn't put it into   
   the clipboard (C:\Users\you\Pictures\vlcsnap-2024-11-17-18h08m36s459.png).   
      
   Neither did opening that PNG file in Irfanview already.   
   How can I get the single-frame PNG from VLC into the Windows clipboard?   
      
   Anyway, I can just open the VLC frame grab in Irfanview, can't I?   
      
   > After IrfanView is started and the video frame is displayed,   
   > use the left mouse button to select the the crop region. You can   
   > change the size with the left mouse button or move the region with   
   > the right mouse button. Then press -C and then "Save values and exit".   
   > Then close IrfanView. The batch then executes the ffmpeg command.   
      
   I think we're getting close even though I can't get the VLC framegrab into   
   the clipboard no matter how hard I tried to do it with all sorts of ways.   
      
   But I already have the VLC frame grab PNG in Irfanview so I'll start there.   
      
   When I open the VLC frame grab in Irfanview, I can leftmouse crop the   
   area I want to crop the entire video to as you suggest I do.   
      
   When I'm done drawing the crop rectangle of the VLC frame grab in   
   Irfanview, on top of Irfanview is displayed the coordinates of that crop.   
    XY:(953,1080) (850x1080 Pixels, 0.787)   
      
   I also accidentally noticed if I hit the F12 keyboard key while displaying   
   a VLC frame grab in Irfanview, the "Paint Dialog" that pops up has an icon   
   for "Measure Distance & Angles" which gives me the number of pixels any   
   line that I draw with my leftmouse on the image is.   
      
   All I need now is the X:Y coordinate of the starting point of that line.   
   Unfortunately, Irfanview doesn't give me the starting X:Y coordinates.   
      
   But there is a sneaky way to get them.   
   a. Open the VLC framegrab PNG in Irfanview   
   b. Press F12 to bring up the "Paint Dialog" menu   
   c. Click the "Rectangle" icon which will draw a rectangle   
   d. Draw the rectangle of the desired crop area on the image   
   e. Click on the "Measure Tool" icon which will measure line lengths   
   f. Measure from the left border to the top-left corner of the drawn box   
   g. Measure the bottom border to the bottom-right corner of the drawn box   
   h. Now you have the necessary X:Y locations in pixels from the borders   
      
   I just realized Irfanview can do a selection box which displays coordinates   
   where you can just draw a selection box inside of Irfanview to get the   
   coordinates displayed on the top of the Irfanview window as something like   
    (Zoom: 1796x1010) (Selection: 137,9;868x1002;0.866)   
      
   While I was documenting those steps for everyone to try out for themselves,   
   I realized Irfanview does have a save-to-clipboard command I can use!   
      
   a. Open the VLC framegrab PNG in Irfanview   
   b. Irfanview:Options > Capture Screenshot   
   c. Select "Foreground Window" & "Copy captured image to clipboard"   
      
   Unfortunately that doesn't directly put the image (without the borders)   
      
   [continued in next message]   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca