2

I have this command that is using a unix pipe

 system("curl " . escapeshellarg($flv['dl']) . " | ffmpeg -f flv -i - -f mp3 -ab 320k pipe:1");

what could I do to make the same thing happen in windows?

Thanks

4
  • The system() call implies you're executing this shell statement from some other language... the . suggests perl. Even the Windows command prompt supports pipes, so if you change the above to simply print the commandline, you can try executing the same thing manually from the Windows command prompt. Your real issue may well be getting curl and ffmpeg installed and their paths added to your PATH environment variable, without needing to a UNIX-style shell. Commented Jun 10, 2011 at 5:04
  • Hello @Jim Garrison, Why would you remove cygwin tag ? Commented Jun 11, 2011 at 4:57
  • @Tony - escapeshellarg() is a PHP function Commented Jun 15, 2011 at 6:19
  • @lunixbochs: thanks for the insight. A super-quick skim of the PHP docs suggests PHP's system also just passes the instruction through to the OS's default command interpreter without internally handling the pipe, so it still seems to be a matter of getting curl and ffmpeg installed and in the PATH, without any change to the PHP code necessary.... Commented Jun 15, 2011 at 7:14

2 Answers 2

4

If you are not concerned with performance, the easiest way to port a unix script to windows is by installing cygwin.

It's a Unix API emulation layer over Windows likewise Wine emulates win32 on linux.


You could also download windows version of each command line tools

  • see Curl download provide several windows version binary ( don t take the cygwin version.
  • Note that ffmpeg is only available as nightly build for windows. No stable release compiled.

This approach requires to find specific download url for each tool and sometimes even leads you to compile binary from source code ! It is still reasonable when you only need 2 or 3 tools. But otherwise, it is so uncertain and time consuming that you should only consider when performance or low dependancy deployment is an issue.

Sign up to request clarification or add additional context in comments.

1 Comment

But note that Wine runs unmodified windows binaries, whereas Cygwin requires that you recompile your code.
0

Sending the file downloaded by curl to ffmpeg by pipe is the best way, I think.

curl "http://domain.com/file.flv" | ffmpeg -f flv -i - -f mp3 -ab 320k pipe:1

curl & ffmpeg are available for windows.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.