I'm trying to open an RTSP stream and get the images to OpenCV using LibVLC.
So far I'm able to open the stream, however the "-I dummy" argument is ignored and the VLC interface opens anyway.
I've tried passing it with various syntax: "-Idummy", "--intf=dummy", etc.. It still doesnt work.
Other arguments seems taken into account though.
Am I doing something wrong here?
Code: Select all
libvlc_instance_t* inst;
libvlc_media_t* m;
void* pUserData = 0;
VideoDataStruct dataStruct;
// VLC options:
char smem_options[1000];
sprintf(smem_options,
"#transcode{vcodec=h264}:smem{"
"video-prerender-callback=%lld,"
"video-postrender-callback=%lld,"
"video-data=%lld,"
"no-time-sync},",
(long long int)(intptr_t)(void*)&cbVideoPrerender,
(long long int)(intptr_t)(void*)&cbVideoPostrender,
(long long int)(intptr_t)(void*)&dataStruct);
const char* const vlc_args[] = {
"--network-caching=0" // No caching to reduce latency
"--intf=dummy", // No GUI (somehow doesnt work)
"--ignore-config", // Don't use VLC's config
"--extraintf=logger", // Log anything
"--verbose=2", // Be verbose
"--sout",
smem_options // Stream to memory
};
// We launch VLC
inst = libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args);
/* Create a new item */
m = libvlc_media_new_location(inst, "rtsp://localhost:8554/live.stream");
/* Create a media player playing environement */
mediaPlayer = libvlc_media_player_new_from_media(m);
/* libvlc_video_set_format(mediaPlayer, "h264", 1920, 1080, 1920 * 3); */
/* play the media_player */
libvlc_media_player_play(mediaPlayer);