udp unicast streaming problem with libvlc

This forum is about all development around libVLC.
littleLan
New Cone
New Cone
Posts: 1
Joined: 12 Apr 2013 13:24

udp unicast streaming problem with libvlc

Postby littleLan » 12 Apr 2013 13:38

Hi, I can use the vlc to transmiss a udp unicast video stream, command lines below:

Code: Select all

vlc a.mpg --sout "#transcode{vcodec=mpeg4,acodec=mpga,vb=800,ab=128} :udp{dst=192.168.0.118,mux=ts}"
But, when I use libvlc to code,it cannot work well ... code below:

Code: Select all

#include<stdio.h> #include<vlc/vlc.h> int main() { libvlc_instance_t *instance; libvlc_media_t *media; libvlc_media_player_t *player; instance=libvlc_new(0,NULL); media=libvlc_media_new_path(instance, "v4l2://"); const char *option[]={ "--sout \"#transcode{vcodec=mpeg4,acodec=mpga,vb=800,ab=128} :udp{dst=192.168.0.118,mux=ts}\"" }; int i; for(i=0;i<sizeof(option)/sizeof(option[0]);++i) { libvlc_media_add_option(media,option[i]); } player=libvlc_media_player_new_from_media(media); int save=libvlc_media_save_meta(media); printf("meta:%d\n",save); libvlc_media_release(media); libvlc_media_player_play(player); while(1); libvlc_release(instance); return 0; }
Where did I make a mistake ? Thanks a lot:-)

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: udp unicast streaming problem with libvlc

Postby sherington » 13 Apr 2013 12:18

You can't just directly translate your command line to a single media option, some changes are needed.

Your media option should look something like this (this is a *general* example, but it shows you the necessary formatting for something that works):

Code: Select all

:sout=#transcode{acodec=mp3,channels=2,ab=192,samplerate=44100}:standard{access=file,mux=raw,dst=/home/audio/audio-stream.mp3
So there's no "--sout" at the start, and there's no spaces.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 26 guests