Hi,
I'm trying to use a lazarus project to call ffmpeg using ShellExecuteExW and pass it a widestring with the parameters, including several filenames.
The problem I'm having is that sometimes the filenames might contain unicode characters, and those get all mangled up.
I also send the same string to ShowMessage() and the unicode characters display correctly, likewise if I set the Text of an edit control with it, it not only displays correctly but I can also copy it and invoke ffmpeg from a command prompt by pasting the copied text and it works. It only seems to mangle the characters when I use it in the ShellExecuteExW call.
Here's the procedure I'm using for the call.
Thanks.
procedure TForm1.Button4Click(Sender: TObject);
begin
params := '-report -i "' + VideoFilename + '" -i "' + AudioFilename + '" -c copy "' + OutputFilename + '"';
ExecuteFile:='c:\ffmpeg\bin\ffmpeg.exe';
FillChar(SEInfo, SizeOf(SEInfo), 0) ;
SEInfo.cbSize := SizeOf(TShellExecuteInfo) ;
with SEInfo do begin
fMask := SEE_MASK_NOCLOSEPROCESS;
Wnd := Handle;
lpFile := PWideChar(ExecuteFile) ;
lpParameters := PWideChar(params) ;
nShow := 1;
end;
if ShellExecuteExW(@SEInfo) then begin
ShowMessage(params) ;
end
else ShowMessage('Error starting ffmpeg!') ;
end;