Merhabalar,
Bu kodlarla bir videoyu rtmp gönderirken:
Masaüstü veya Pencere rtmp gönderemiyorum:
Konu hakkında yardımlarınızı rica ederim.
Bu kodlarla bir videoyu rtmp gönderirken:
procedure TForm1.Button1Click(Sender: TObject);
var
FFmpegPath: string;
Params: string;
SI: TStartupInfo;
PI: TProcessInformation;
CmdLine: string;
VideoPath: string;
begin
FFmpegPath := 'C:\ffmpeg\ffmpeg.exe'; // FFmpeg tam yolu
VideoPath := 'C:\ffmpeg\input.mp4'; // video dosyasının yolu
if not FileExists(FFmpegPath) then
begin
ShowMessage('FFmpeg.exe bulunamadı! Yolu kontrol edin.');
Exit;
end;
if not FileExists(VideoPath) then
begin
ShowMessage('Video dosyası bulunamadı: ' + VideoPath);
Exit;
end;
Params := '-re -i "' + VideoPath + '" ' + // -re ile gerçek zamanlı okuma
'-c:v libx264 -preset ultrafast -tune zerolatency ' +
'-pix_fmt yuv420p -g 60 -b:v 2500k ' +
'-f flv "rtmp **************************"';
ZeroMemory(@SI, SizeOf(SI));
ZeroMemory(@PI, SizeOf(PI));
SI.cb := SizeOf(SI);
SI.dwFlags := STARTF_USESHOWWINDOW;
SI.wShowWindow := SW_SHOW; // Konsol penceresi görünsün
CmdLine := '"' + FFmpegPath + '" ' + Params;
if not CreateProcess(nil, PChar(CmdLine), nil, nil, False, CREATE_NEW_CONSOLE, nil, nil, SI, PI) then
begin
ShowMessage('FFmpeg başlatılamadı: ' + SysErrorMessage(GetLastError));
Exit;
end;
CloseHandle(PI.hProcess);
CloseHandle(PI.hThread);
ShowMessage('FFmpeg penceresini kapatmayın.');
end;
Masaüstü veya Pencere rtmp gönderemiyorum:
procedure TMainForm.Button1Click(Sender: TObject);
var
FFmpegPath: string;
Params: string;
SI: TStartupInfo;
PI: TProcessInformation;
CmdLine: string;
WindowTitle: string;
begin
FFmpegPath := 'C:\ffmpeg\ffmpeg.exe';
WindowTitle := 'Form1'; // Yakalamak istediğin pencerenin tam başlığı
if not FileExists(FFmpegPath) then
begin
ShowMessage('FFmpeg.exe bulunamadı! Yolu kontrol edin.');
Exit;
end;
// ffmpeg parametreleri: pencere yakala, bitrate yeterli, RTMP yayın
Params := Format(
'-f gdigrab -framerate 10 -i title="%s" -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" ' +
'-c:v libx264 -preset ultrafast -tune zerolatency -pix_fmt yuv420p -g 60 -b:v 2500k ' +
'-f flv "rtmp**********************"',
[WindowTitle]);
ZeroMemory(@SI, SizeOf(SI));
ZeroMemory(@PI, SizeOf(PI));
SI.cb := SizeOf(SI);
SI.dwFlags := STARTF_USESHOWWINDOW;
SI.wShowWindow := SW_SHOW;
CmdLine := '"' + FFmpegPath + '" ' + Params;
if not CreateProcess(nil, PChar(CmdLine), nil, nil, False, CREATE_NEW_CONSOLE, nil, nil, SI, PI) then
begin
ShowMessage('FFmpeg başlatılamadı: ' + SysErrorMessage(GetLastError));
Exit;
end;
CloseHandle(PI.hProcess);
CloseHandle(PI.hThread);
ShowMessage('FFmpeg penceresini kapatmayın.');
end;
Konu hakkında yardımlarınızı rica ederim.

