I am trying to stream my desktop first from the VLC application on my mac and then using libvlc. It was successful when I tried VLC app, but with my libvlc program crashes everytime I try to start the stream.
Here is the VLC.app command:
/Applications/VLC.app/Contents/MacOS/vlc -vvv -I dummy screen:// --screen-fps=25 --live-caching=10 sout-rtp-caching=0 --network-caching=10 --sout-mux-caching=0 --dash-buffersize=0 --rtsp-frame-buffer-size=0 –clock-jitter=5 --rtsp-tcp --sout-x264-preset ultrafast --sout-x264-tune zerolatency --sout-x264-intra-refresh --sout-x264-vbv-bufsize 250 --sout-x264-vbv-maxrate 6600 --sout='#transcode{vcodec=h264,venc=x264{keyint=10,profile=main,nobframes,--nal-hrd cbr},height=720, width=1280, fps=25, scale=0.5,acodec=none}:http{mux=ffmpeg{mux=flv}, dst=:8080/live}'
And here is corresponding libvlc code:
char sout_options[1000];
sprintf(sout_options,
"#transcode{vcodec=h264,venc=x264{keyint=10,profile=main,nobframes,--nal-hrd cbr},height=720, width=1280, fps=25, scale=0.5,acodec=none}:http{mux=ffmpeg{mux=flv}, dst=:8080/live}");
char * const args[] = { "-vvv",
"-I", "dummy", // Don't use any interface
"--ignore-config", // Don't use VLC's config
"--verbose=3", // Be verbose
"--extraintf=logger",
"--sout", sout_options, // Audio Off
};
vlc_ins = libvlc_new(sizeof(args)/sizeof(*args), args);
vlc_media = libvlc_media_new_location( vlc_ins, "screen://" );
libvlc_media_add_option(vlc_media, "screen-fps=25");
libvlc_media_add_option(vlc_media, "live-caching=10");
libvlc_media_add_option(vlc_media, "sout-rtp-caching=0");
libvlc_media_add_option(vlc_media, "sout-mux-caching=0");
libvlc_media_add_option(vlc_media, "dash-buffersize=0");
libvlc_media_add_option(vlc_media, "rtsp-frame-buffer-size=0");
libvlc_media_add_option(vlc_media, "clock-jitter=5");
libvlc_media_add_option(vlc_media, "rtsp-tcp");
libvlc_media_add_option(vlc_media, "sout-x264-preset=ultrafast");
libvlc_media_add_option(vlc_media, "sout-x264-tune=zerolatency");
libvlc_media_add_option(vlc_media, "sout-x264-vbv-bufsize=250");
libvlc_media_add_option(vlc_media, "sout-x264-vbv-maxrate=6600");
vlc_mplayer = libvlc_media_player_new_from_media( vlc_media );
libvlc_media_release( vlc_media );
libvlc_media_player_play( vlc_mplayer );
I am not sure how VLC invokes libvlc from the command line parameters, but this what I came up with from the api. Everytime I try to stream from another device, it crashes. WIll appreciate any insight into this.