Unable to specify parameters to cvlc in a script

5,431

The thread Invoking VLC from a script has this funny answer at its end:

OK I've fixed it. Experimentation showed me that the answer is:

#!/bin/bash
VLCCMD="cvlc source.mp3 --sout "#duplicate{dst=std{access=udp,dst=192.168.0.2:1235}}""
echo VLC Command:$VLCCMD
$VLCCMD

There are two changes to my original script:

  • remove the double quotes from the MP3 filename
  • change the single-quote around the #duplicate to a double-quote
Share:
5,431

Related videos on Youtube

VxJasonxV
Author by

VxJasonxV

"The best protagonists rarely say anything."

Updated on September 17, 2022

Comments

  • VxJasonxV
    VxJasonxV over 1 year

    I'm creating a script that issues a few curl commands in order to access a time-protected mms stream link, then set up a relay using cvlc (vlc's command line interface) for my own use on an unencumbered player.

    The curl aspect of this is working, as I can run as a browser and curl side by side and get the same access url. (It's time locked meaning the stream will work forever, but you have to connect quickly or the URL will time out.)

    The very end of the script prints the command I will run, which is then followed up by "exec $CMD".

    When I echo $CMD I get:
    cvlc --sout '#standard{access=http,mux=asf,dst=0.0.0.0:58194}' mms://[...]

    Manually Copy/Pasting this command in, verbatim, works perfectly fine, but as part of a script, the cvlc execution output says:

    [0x9743d0] main interface error: no suitable interface module
    [0x962120] main libvlc error: interface "globalhotkeys,none" initialization failed
    [0x9743d0] dummy interface: using the dummy interface module...
    [0xb16e30] stream_out_standard stream out error: no mux specified or found by extension
    [0xb16ad0] main stream output error: stream chain failed for `standard{mux="",access="",dst="'#standard{access=http,mux=asf,dst=0.0.0.0:58194}'"}'
    [0xb11cd0] main input error: cannot start stream output instance, aborting
    [0xb11f70] signals interface error: Caught Interrupt signal, exiting...

    Why is --sout behaving one way in a script (non-interactive shell?) vs. another way in the foreground (interactive shell) ?

  • VxJasonxV
    VxJasonxV over 13 years
    Hmmm. But those inner double-quotes are unescaped...
  • VxJasonxV
    VxJasonxV over 13 years
    HOLY CRAP IT WORKS. ... HOLY CRAP........ why does it work? O_o. The bounty is all yours.......... in 18 hours.
  • harrymc
    harrymc over 13 years
    This is probably a bug in the parameter-parsing of cvlc. You could report it in the VideoLAN Forums.