Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

rtmpdump.exe über PHP-Skript starten

Empfohlene Antworten

Veröffentlicht

Hallo Leute,

der Titel sagt eigentlich schon alles. Ich möchte aus einem PHP-Skript heraus die rtmpdump.exe aufrufen und so einen Stream auf dem Server speichern.

Dieser Code erzeugt mir eine funktionierenden rtmpdump-Aufruf:


$RtmpCMD = 'rtmpdump.exe -r "' .
rawurldecode($this->XML->{"playlist"}->{"videos"}->{"video"}->attributes()->{"connectionurl"}) .
'" --tcUrl="' . rawurldecode($this->XML->{"playlist"}->{"videos"}->{"video"}->attributes()->{"connectionurl"}) .
'" --swfVfy="' . rawurldecode($this->XML->{"playlist"}->{"videos"}->{"video"}->attributes()->{"path"}) . 'player/mingR13y/ming.swf' .
'" --pageUrl="' . $this->GetVideoWeblink() . '" --playpath="' .
rawurldecode($this->XML->{"playlist"}->{"videos"}->{"video"}->attributes()->{"source"}) .
'" -o "test.flv"';

$RtmpCMD = str_replace("rtmpe", "rtmp", $RtmpCMD);
[/PHP]

Den schreibe ich dann in eine Batch-Datei:

[PHP]
$handle = fopen("rtmp.bat", "c");
fwrite ($handle, $RtmpCMD);
fclose($handle);

Im Anschluss rufe ich die Batch-Datei auf:


passthru("cmd /C rtmp.bat");
[/PHP]

Nur leider wird der Stream nicht heruntergeladen. Zum Test habe ich in die Batch-Datei einfach mal ein "mkdir aaa" vor dem rtmpdump-Befehl eingetragen, um zu sehen, ob passthru() die Batch überhaupt ausführt. Und tatsächlich - das Verzeichnis "aaa" wird erstellt.

Wie bereits oben angedeutet, funktioniert der rtmpdump-Befehl aber, denn wenn ich die Batch im Windows-Explorer aufrufe, funktioniert es alles genau wie gedacht...

Das Problem scheint also irgendwie bei dem Aufruf über PHP zu liegen.

Hat jemand eine Idee, woran das liegen könnte?

Vielen Dank schonmal!

LG Luk

Wird der Befehl rtmpdump.exe beim Aufruf über das Skript gefunden? Absoluten Pfad angeben?

PHP-Skripte dürfen nur eine bestimmte Zeit laufen, bevor sie automatisch beendet werden. Das ggf. bei den weiteren Schritten bedenken.

  • Autor

Hallo lupo49! Erst mal vielen Dank für deine Antwort!

Ich rufe nicht über den absoluten Pfad auf, was - soweit ich weiß - keine Probleme machen dürfte, denn ich habe die rtmpdump.exe in system32 abgelegt.

An die Skriptlaufzeit habe ich auch schon gedacht, aber trifft die nur für das PHP-Skript selbst zu oder auch für alle Prozesse, die daraus gestartet werden?

Das Problem ist, dass man von rtmpdump irgendwie die Ausgabe nicht abfangen kann. -.-

  • Autor

Habe jetzt eben mal die php.ini verändert und natürlich den Apache-Dienst neugestartet.


max_execution_time=120     ; Maximum execution time of each script, in seconds

max_input_time=120 ; Maximum amount of time each script may spend parsing request data

memory_limit=-1      ; Maximum amount of memory a script may consume (128MB)

Habe den Dienst sogar mit einem Admin-Konto anmelden lassen.

Es passiert einfach nichts -.-

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.