Using version libVLC 2.0.6 (x64 on Windows 7) to capture an RTSP camera stream and display it in a C# WPF app.
Goal is to play the video on the app while recording it to file and to put a custom marquee on the video.
If I uncomment the code for libvlc_media_add_option, then I get the video stream recorded to the file but I see no marquee.
Without the add_option I have no file (of course) but the marquee works as expected on the rendered stream.
So both functionalities work - just not together. I can see video rendered with the marquee OR I see video rendered and it's saved to file - but no marquee.
Here is a simple C Console Application version of the code made with Visual Studio.
Code: Select all
// Vlc_ConsoleApp.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <vlc/vlc.h>
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
libvlc_instance_t * inst;
libvlc_media_player_t *mp;
libvlc_media_t *m;
char* arguments[] = { "-I",
"dummy",
"--ignore-config",
"--no-video-title",
"--sub-filter=marq",
"--plugin-path=C:/Software_Development/Software_Libraries/VLC/vlc-2.0.6_x64/plugins"}; // you'll need to adjust this
// you may need to adjust the output path
char* duplicateStreamOption = ":sout=#stream_out_duplicate{dst=display,dst=std{access=file,sub-filter=marq,mux=ts,dst=c:/temp/test_go.mpg}}";
/* Load the VLC engine */
inst = libvlc_new (6, arguments);
/* Create a new item */
m = libvlc_media_new_location (inst, "rtsp://@192.168.2.168"); // you'll need to change this to some media you have
/* add option to record duplicate stream to file */
/* if I comment this out - then marquee works */
//libvlc_media_add_option(m, duplicateStreamOption);
/* Create a media player playing environement */
mp = libvlc_media_player_new_from_media (m);
/* No need to keep the media now */
libvlc_media_release (m);
/* play the media_player */
libvlc_media_player_play (mp);
Sleep (10000); /* Let it play for 10 seconds */
/* throw up a marquee */
libvlc_video_set_marquee_int(mp, libvlc_marquee_Enable, 1);
libvlc_video_set_marquee_string(mp, libvlc_marquee_Text, "Hello- Marquee");
libvlc_video_set_marquee_int(mp, libvlc_marquee_Opacity, 50);
libvlc_video_set_marquee_int(mp, libvlc_marquee_X, 10);
libvlc_video_set_marquee_int(mp, libvlc_marquee_Y, 10);
libvlc_video_set_marquee_int(mp, libvlc_marquee_Timeout, 4000); // 4 secs
libvlc_video_set_marquee_int(mp, libvlc_marquee_Size, 40);
libvlc_video_set_marquee_int(mp, libvlc_marquee_Color, 0xFF0000);
Sleep (10000); /* play some more */
/* Stop playing */
libvlc_media_player_stop (mp);
/* Free the media_player */
libvlc_media_player_release (mp);
libvlc_release (inst);
return 0;
}
With 32bit 2.0.6 the results were the same as described above.
With 2.2.0 (both 64 and 32 bit) there is no video rendered and an output file size 0 bytes is produced.
Has anyone tried to render a stream while overlaying it and simultaneously recording the stream?
Thanks