libvlc API

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
Erwan100
Blank Cone
Blank Cone
Posts: 14
Joined: 05 Sep 2008 20:04

libvlc API

Postby Erwan100 » 05 Sep 2008 21:04

Hello,

I have been rewriting a C++ program I made that integrated the libvlc API so that I can use it with the latest VLC0.9.1 release.

Everything is ok except for two things:

1- snapshot
When using libvlc_video_take_snapshot, I keep getting an empty file (file is created with size = 0)

2- record
I used the function VLC_VariableSet ( object_id , "key-pressed" , param ); with param representing CRTL+SHIFT+R which worked perfectly with older versions of vlc.0.9.
This function seems not to be available any more.
Any idea as to how to program recording through the API ?

As an enhancement to the API, wouldn't it be great to add a function dedicated to triggering recording. Also, this function should accept a filename as a parameter in order to manage the resulting file.

I hope this forum is a right place for such a post. Any help will be much appreciated.

Erwan

Erwan100
Blank Cone
Blank Cone
Posts: 14
Joined: 05 Sep 2008 20:04

Re: libvlc API

Postby Erwan100 » 11 Sep 2008 17:08

Hello,

My previous post didn't get much attention. Anyway, ...

My initial purpose was to write a C++ program in order to watch TV (DVB-T) on a Linux PC. One of the key function was to be able to toggle recording any incoming TS feed at will. VLC already did most of the work since there is the "--access_filter record" option.

My two main gripes were :

- the output file name is hardcoded in modules/access_filter/record.c and we end up with a file name like "Unknown + a formatted date" with several unfriendly spaces !
- there is no way to trigger recording through the official VLC APIs.

Well, I have ended up :
1- adding in modules/access_filter/record.c :
var_Create( p_input, "record-filename", VLC_VAR_STRING );
and a few lines to take the filename into account
2 - adding to the libvlc API:
VLC_PUBLIC_API void libvlc_toggle_record ( libvlc_media_player_t *, char *, libvlc_exception_t * );
3 - coding this function with libvlc_video_take_snapshot as an example.


And it works perfectly. And to my amazement with so few lines of code ..... BTW, the internal structure of VLC seems great and quite self-explanatory to me.

If my code is of interest or if you VLC folks are willing to have it integrated into the VLC product, I can send the modified files.

Regards

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Re: libvlc API

Postby dionoea » 13 Sep 2008 00:57

Glad you could sort it out yourself :) Patches are of course welcome on vlc-devel@videolan.org . Note that the record system changed in Git master (1.0.0 and up) to allow recording streams other than ts.
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

corvusvideo
Blank Cone
Blank Cone
Posts: 29
Joined: 03 Mar 2008 16:14

libvlc_video_take_snapshot

Postby corvusvideo » 30 Sep 2008 14:36

I have observed the same behavior with "libvlc_video_take_snapshot". No exception is raised, and a file is created, but the file is always 0 bytes in size and (obviously) does not contain an image.

I tried this with 0.9.2, 0.9.3, and the current nightly 0.9.4 and still have not had any luck. I have tried both with video paused and playing.

Did you ever get "libvlc_video_take_snapshot" to create an output file? If so could you post a code snippet showing how you did it? I am sure I am just missing some dumb but I have run out of variations to try.

Thank you.

Erwan100
Blank Cone
Blank Cone
Posts: 14
Joined: 05 Sep 2008 20:04

Re: libvlc API

Postby Erwan100 » 02 Oct 2008 22:36

Hello,

To whom It may be of interest

I eventually worked out the snapshot problem (file created with size = 0)

I had forgotten the --enable-swscale option when I compiled and installed the ffmpeg contrib. Doing so solved the problem !

Regards
Erwan

rarao
Blank Cone
Blank Cone
Posts: 11
Joined: 18 Apr 2009 09:18

Re: libvlc API

Postby rarao » 04 Jun 2009 11:46

i have the 0 byte file size issue when capturing a snapshot using libvlc_video_take-snapshot(...) method just like everyone seems to be having. I am using v0.9.9a version of vlc dlls (libvlc.dll and libvlccore.dll ) and using C#.

I read the message from erwan...of using "--enable-swscale" while compiling. Can anyone explain how and where to use this switch ...is it something i need to use before compiling the to get the dlls or while creating the vlc instance in the code... just like "--plugin-path=.\\plugins"

thanks in advance for the help.

regards
Rao

Georgeqi
New Cone
New Cone
Posts: 1
Joined: 14 Oct 2009 19:56

Re: libvlc API

Postby Georgeqi » 14 Oct 2009 20:01

I use 1.0.0 with libvlc_video_take_snapshot and I got the image correctly, I just need to add delay before taking the snap shot so that video is stable, which is pure try and error.

I am investigating the ways to set the delay more intelligently. Any idea?

George


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 9 guests