My goal is to set the position of the ffplay window to some specific coordinates (e.g. 200 x 400).
Initially, I tried using ffplay command line arguments, but I only found how to set window width and height, not position.
Then I tried opening the process in a specific position with C#, but this didn't seem to affect the position of FFPlay
Any suggestions will be appreciated
Here is my code:
static void Main(string[] args)
{
Process proccess = new Process();
proccess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
proccess.StartInfo.FileName = "C:\\ffmpeg\\x64\\ffplay.exe";
proccess.StartInfo.Arguments = "udp://@127.0.0.1:5004?pkt_size=1316";
proccess.Start();
Thread.Sleep(100);
IntPtr id = proccess.MainWindowHandle;
Console.Write(id);
Program.MoveWindow(proccess.MainWindowHandle, 0, 0, 500, 500, true);
}
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
CodePudding user response:
On the command line you can use the options:
-left nnn
and
-top nnn
which position the top-left corner of the output - space providing, depending on your screen size.