FIXED: Invoking VLC from a script

*nix specific usage questions
xyz000
Blank Cone
Blank Cone
Posts: 27
Joined: 08 Jun 2009 09:33

FIXED: Invoking VLC from a script

Postby xyz000 » 08 Jun 2009 11:02

Hello,

First I confess to being relatively new to Linux so please accept my apoligies if the answer to this question is trivial.

VLC version: 0.9.8a
System: Centos 5 on x86

I'm trying to invoke a VLC stream from a bash script. I've figured out the command I want to use and have proved that the following command (typed in at the "$" prompt) does exactly what I want:

Code: Select all

cvlc "source.mp3" --sout '#duplicate{dst=std{access=udp,dst=192.168.0.2:1235}}'
Next I put this into a script:

Code: Select all

#!/bin/bash cvlc "source.mp3" --sout '#duplicate{dst=std{access=udp,dst=192.168.0.2:1235}}'
This works too. So far so good. Then I tried this script:

Code: Select all

#!/bin/bash VLCCMD="cvlc \"source.mp3\" --sout '#duplicate{dst=std{access=udp,dst=192.168.0.2:1235}}'" echo VLC Command:$VLCCMD $VLCCMD
All I've tried to do here is assign the VLC command to a script variable called "$VLCCMD". To assign to the variable I've enclosed the entire command in double-quotes which means I had to escape the double-quotes around the MP3 filename. This is the output I get :

Code: Select all

VLC Command:cvlc "source.mp3" --sout '#duplicate{dst=std{access=udp,dst=192.168.0.2:1235}}' VLC media player 0.9.8a Grishenko [00000001] main libvlc debug: VLC media player - version 0.9.8a Grishenko - (c) 1996-2008 the VideoLAN team [00000001] main libvlc debug: libvlc was configured with ./configure '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--disable-rpath' '--disable-static' '--with-PIC' '--enable-release' '--enable-aa' '--enable-alsa' '--enable-arts' '--enable-caca' '--enable-cddax' '--enable-dirac' '--enable-dvbpsi' '--enable-dvdread' '--enable-esd' '--enable-faad' '--enable-fbosd' '--enable-ffmpeg' '--with-ffmpeg-tree=ffmpeg-20080225' '--with-ffmpeg-a52' '--with-ffmpeg-faac' '--with-ffmpeg-mp3lame' '--enable-libamr-nb' '--enable-libamr-wb' '--with-ffmpeg-ogg' '--with-ffmpeg-theora' '--with-ffmpeg-vorbis' '--with--ffmpeg-zlib' '--enable-flac' '--enable-galaktos' '--enable-gnomevfs' '--enable-lirc' '--enable-live555' '--with-live555-tree=/dar/build/vlc-0.9.8a/live' '--enable-loader' '--enable-musicbrainz' '--enable-ncurses' '--enable-opencv' '--enable-pulse' '--enable-pvr' '--enable-real' '--enable-realrtsp' '--enable-shout' '--enable-snapshot' '--enable-svg' '--enable-svgalib' '--enable-switcher' '--enable-twolame' '--enable-upnp' '--enable-v4l' '--enable-xosd' '--enable-xvmc' 'build_alias=i686-redhat-linux-gnu' 'host_alias=i686-redhat-linux-gnu' 'target_alias=i386-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables' 'LDFLAGS=-L/usr/X11R6/lib' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables' 'PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig' [00000001] main libvlc debug: translation test: code is "C" [00000413] inhibit interface error: Failed to connect to the D-Bus session daemon: Failed to execute dbus-launch to autolaunch D-Bus session [00000413] main interface error: no suitable interface module [00000001] main libvlc error: interface "inhibit,none" initialization failed [00000419] dummy interface: using the dummy interface module... [00000430] stream_out_standard stream out error: no access _and_ no muxer (fatal error) [00000429] main stream output error: stream chain failed for `standard{mux="",access="",dst="'#duplicate{dst=std{access=udp,dst=192.168.0.2:1235}}'"}' [00000428] main input error: cannot start stream output instance, aborting
To tidy this up a little...the only differences between the console output when I use a script variable and when I do not use a script variable is as follows:

Code: Select all

VLC Command:cvlc "source.mp3" --sout '#duplicate{dst=std{access=udp,dst=192.168.0.2:1235}}' (...identical output removed here...) [00000430] stream_out_standard stream out error: no access _and_ no muxer (fatal error) [00000429] main stream output error: stream chain failed for `standard{mux="",access="",dst="'#duplicate{dst=std{access=udp,dst=192.168.0.2:1235}}'"}' [00000428] main input error: cannot start stream output instance, aborting
Any ideas what I'm doing wrong?

Thanks!
Last edited by xyz000 on 23 Jun 2009 11:29, edited 1 time in total.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Invoking VLC from a script

Postby Jean-Baptiste Kempf » 08 Jun 2009 11:08

Try remove the quotes around source.mp3 in your script.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

xyz000
Blank Cone
Blank Cone
Posts: 27
Joined: 08 Jun 2009 09:33

Re: Invoking VLC from a script

Postby xyz000 » 08 Jun 2009 11:23

Hi j-b ... thanks for such a quick response.
Try remove the quotes around source.mp3 in your script.
I'm sorry to say I get exectly the same sypmtom (and I first proved that removing the quotes in the script version that doesn't use $VLCCMD correctly plays the file).

Any other ideas? I've tried adding the -vvv option for ultra-verbose output but I didn't spot anything obvious.

xyz000
Blank Cone
Blank Cone
Posts: 27
Joined: 08 Jun 2009 09:33

Re: Invoking VLC from a script

Postby xyz000 » 08 Jun 2009 11:49

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

Code: Select all

#!/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
If anybody can explain why this works then I'd be grateful...I thought the script interpreter would see the double-quote immediately before the #duplicate as the terminating quote for the VLCCMD variable assignment. Still, it works so I'm happy.


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 1 guest