Another gotcha I have come across is having the sout argument wrapped in single quotes so that vlc sees those quotes:
Wrong:
Code: Select all
DB<3> x @cmd_line
0 'cvlc'
1 'http://localhost:8000/4164'
2 'vlc://quit'
3 '--sout'
4 '\'#transcode{venc=x264{keyint=60,aud,profile=baseline, ...
Correct:
Code: Select all
DB<7> x @cmd_line
0 'cvlc'
1 'http://localhost:8000/4164'
2 'vlc://quit'
3 '--sout'
4 '#transcode{venc=x264{keyint=60,aud,profile=baseline ...
When you invoke vlc from a unix shell, then the single quotes are needed to protect all the special characters in the --sout command line from the shell.
If you invoke vlc as a sub process of another program or scripting environment such as perl then in
some situations the shell is bypassed and vlc is invoked directly. In those situations you should not be wrapping arguments in quotes as vlc won't like them. In other situations the program will invoke the shell as an intermediate step and in those situations you will need to protect arguments with quotes.
You should check the docs for the programing language or calling program you are using.
If you are programing in perl, then the short answer is that if you pass a single string to system, exec or any of the library routines under IPC::*, then perl will pass that string to the shell for processing, but if you pass an array to those routines, then perl will assume that the first element in the array is the program name, and subsequent elements are the arguments. It will not involve the shell, and will start he program directly.
A further complication to be aware of is the quoting and escaping rules for the language you are using, your editor and your debugger. The string you type may not match the string that is stored internally or what you see in trace output from your debugger, but if you have followed me so far, then this part should be easy.