Sign in to follow this  
Followers 0

VLC (Media Player) UDF

44 posts in this topic

Posted (edited)

This UDF allows users to create and manipulate a VLC control within an AutoIT GUI.

This UDF is a continuation of the outdated work done by j_stam_84 back in 2006. Here is a link to his topic -> VLC Media Player. That UDF utilises an older version of the VLC ActiveX object that is no longer supported in versions of VLC greater than 0.8.5. My UDF works with the current version of VLC at the time of writing this topic (version 1.0.5).

There have been many attempts to create VLC controls for AutoIT, and have them embed successfully in AutoIT GUIs. The biggest issue has been that the VLC ActiveX object doesn't seem to work if created in an AutoIT GUI using the GUICtrlCreateObj function. The Help page on GUICtrlCreateObj also states "Not every (ActiveX) control can be embedded (inside an AutoIT GUI).".

So far j_stam_84 seems to have been the only person in the forums to go the path of creating the VLC ActiveX object within an embedded Webbrowser object. This approach works with AutoIT, and is the reason for the success of this UDF.

The main reason I created this UDF was to provide users with a free video playback solution for their AutoIT GUIs that supports the maximum number of codecs possible. VLC player has been well known for some time for it's support and compatibility with a wide range of video formats. Media Player Classic is also a popular choice of video player for the same reasons, though it unfortunately doesn't provide an ActiveX or COM object for use in an AutoIT GUI. Other media player UDFs exist, such as Windows Media Player UDFs, though I still favour the performance and better support of codecs that VLC player provides.

The example below also remembers the video that was playing when the example is closed, so that next time the script is run, the same video is automatically played.

REQUIREMENTS:

LIST OF FUNCTIONS:

_GUICtrlVLC_Create($left, $top, $width, $height)

_GUICtrlVLC_PlaylistAdd($vlc, $path)

_GUICtrlVLC_Play($vlc, $item)

_GUICtrlVLC_Pause($vlc)

_GUICtrlVLC_Stop($vlc)

_GUICtrlVLC_Clear($vlc)

_GUICtrlVLC_SeekRelative($vlc, $time)

_GUICtrlVLC_SeekAbsolute($vlc, $time)

_GUICtrlVLC_GetState($vlc)

_GUICtrlVLC_GetLength($vlc)

_GUICtrlVLC_GetMute($vlc)

_GUICtrlVLC_GetTime($vlc)

_GUICtrlVLC_GetVolume($vlc)

_GUICtrlVLC_SetMute($vlc, $toggle)

_GUICtrlVLC_SetVolume($vlc, $level)

_VLCErrorHandlerRegister($s_functionName = "__VLCInternalErrorHandler")

__VLCInternalErrorHandler()

EXAMPLE:

The following example demonstrates how the VLC UDF can be used to create an embedded video player in an AutoIT GUI. On running the script, the user may select a video to play, whereupon playback will commence immediately. Using the keyboard or GUI buttons, the user may skip forward and backward through the video (using the arrow keys), and pause and unpause playback (spacebar), all in realtime. Whilst the video is paused, the Rewind and FForward functions also work. A progress slider always indicates the playback position of the video, and the user may drag the slider anytime to a different location in the video. The video will automatically loop back to the start if it reaches the end.

VLC UDF Example.au3

DOWNLOAD:

Latest Version - v0.3 (17/05/10)

VLC.au3

Edited by seangriffin

Share this post


Link to post
Share on other sites



Posted (edited)

This first release of the VLC UDF (v0.1) has a clipping bug in it, whereby if the AutoIT GUI hosting the VLC control is obstructed in any way (ie. partially by other windows, or minimised and restored) it does not redraw/repaint the control/video. This is very frustrating. Though for my own purposes, the UDF suites by needs, because I'm mainly going to use it for video previews in other apps, and stopping and starting playback seems to be a good enough workaround for that.

If anyone knows how to fix this issue, or has any clues, could you please let me know?

The same sort of issue is documented here -> Embed RDP in GUI, and in other topics.

Cheers,

Sean.

Edited by seangriffin

Share this post


Link to post
Share on other sites

Posted

Version 0.2 is now available for download.

Changes include:

  • Changed _GUICtrlVLC_GetState to return 0 if no playlist items.
  • Changed _GUICtrlVLC_Pause to return 0 if no playlist items.
  • Changed _GUICtrlVLC_Stop to return 0 if no playlist items.
  • Changed _GUICtrlVLC_SeekRelative to return 0 if no playlist items.
  • Changed _GUICtrlVLC_SeekAbsolute to return 0 if no playlist items.
  • Added error handling to all functions.
  • Added the function _VLCErrorHandlerRegister.
  • Added the function __VLCInternalErrorHandler.

Share this post


Link to post
Share on other sites

Posted

Looks promising.

Can you add function for taking capture snapshot from (paused) video (or from given time).

Share this post


Link to post
Share on other sites

Posted

I think its superb, Ive never been able to get compressed video to play in a gui.

Cheers.

Share this post


Link to post
Share on other sites

Posted

Looks promising.

Can you add function for taking capture snapshot from (paused) video (or from given time).

The VLC ActiveX object which I use in the UDF unfortunately doesn't seem to support snapshots. Here is a link to the page that describes the ActiveX object -> WebPlugin. I can't find any reference to "snapshot" here.

However, the other interfaces into VLC, such as the MediaControlAPI, the HTTP Interface and Command Line Interface, all support snapshots. The MediaControlAPI seems to be a C++ interface, so probably can't be interfaced directly from AutoIT. The HTTP Interface maybe. Haven't explored these. But the ActiveX object unfortunately doesn't seem to support it. Sorry.

Share this post


Link to post
Share on other sites

Posted

Version 0.3 is now available for download.

Changes include:

  • Added the function _GUICtrlVLC_GetVolume.
  • Added the function _GUICtrlVLC_SetVolume.
  • Added the function _GUICtrlVLC_GetMute.
  • Added the function _GUICtrlVLC_SetMute.

Share this post


Link to post
Share on other sites

Posted (edited)

The VLC ActiveX object which I use in the UDF unfortunately doesn't seem to support snapshots. Here is a link to the page that describes the ActiveX object -> WebPlugin. I can't find any reference to "snapshot" here.

However, the other interfaces into VLC, such as the MediaControlAPI, the HTTP Interface and Command Line Interface, all support snapshots. The MediaControlAPI seems to be a C++ interface, so probably can't be interfaced directly from AutoIT. The HTTP Interface maybe. Haven't explored these. But the ActiveX object unfortunately doesn't seem to support it. Sorry.

Actually, the free video converter FFmpeg (www.ffmpeg.org) has the screenshot capability, and it just so happens that I've only recently put both FFmpeg and the VLC UDF together into one app called Rapid Video Converter. I haven't added a screenshot function to RVC yet. Would you like me to Zedna? Edited by seangriffin

Share this post


Link to post
Share on other sites

Posted

Just a quick note to let everyone know that if you are interested in seeing another application/example of the VLC UDF, then have a look at my Rapid Video Converter. The latest version incorporates the embedded VLC player for previewing of videos, before and after conversion.

Share this post


Link to post
Share on other sites

Posted (edited)

Actually, the free video converter FFmpeg (www.ffmpeg.org) has the screenshot capability, and it just so happens that I've only recently put both FFmpeg and the VLC UDF together into one app called Rapid Video Converter. I haven't added a screenshot function to RVC yet. Would you like me to Zedna?

Yes.

I like your RVC. I need this function to be added if posible:

- for (list of) video files to be possible to generate JPEG picture (preview) containing given number of screenshots from video inside it, for example 8 or 16, number could be configurable. Times of screenshots inside picture must be calculated according to video length. It's a picture preview of video file.

Something similar to AAA thumbnailer

http://www.autoitscript.com/forum/index.php?showtopic=97279

Edited by Zedna

Share this post


Link to post
Share on other sites

Posted

Yes.

I like your RVC. I need this function to be added if posible:

- for (list of) video files to be possible to generate JPEG picture (preview) containing given number of screenshots from video inside it, for example 8 or 16, number could be configurable. Times of screenshots inside picture must be calculated according to video length. It's a picture preview of video file.

Something similar to AAA thumbnailer

http://www.autoitscript.com/forum/index.php?showtopic=97279

I'll have a look when I get time (which isn't much at the moment), but I'd like to help all the same.

Share this post


Link to post
Share on other sites

Posted (edited)

I'll have a look when I get time (which isn't much at the moment), but I'd like to help all the same.

Thanks for the time given I appreciate it!

I looked at other free software for creating "video thumbnails" and I like the simplicity of solution in free "Media Player Classic" in its "Save as thumnails" command. There you only give 1) number of rows 2) number of columns 3) width of picture and it will generate all snapshots to one summary video thumbnail.

See this webpage:

How to make sequential thumbnails of a video using free tools

http://www.dotcomunderground.com/blogs/2...-thumbnails-of-a-video-using-free-tools/

But this MPC solution has some disadvantages:

- lack of batch processing

- dependent on installed system video codecs (while VLC has its own)

- slow

Edited by Zedna

Share this post


Link to post
Share on other sites

Posted (edited)

See this webpage:

How to make sequential thumbnails of a video using free tools

http://www.dotcomunderground.com/blogs/2...-thumbnails-of-a-video-using-free-tools/

Strange but when I visit that link above I get a webpage with garbled text.

But this MPC solution has some disadvantages:

- lack of batch processing

- dependent on installed system video codecs (while VLC has its own)

- slow

My RVC uses FFmpeg as the conversion engine underneath. I would be implementing the snapshot function through FFmpeg. FFmpeg also depends on installed system video codecs, like MPC. It may also be as slow as MPC. I guess I could implement a batch snapshot function, but I haven't got much time these days, so might not happen for a while. Maybe my solution is not what you are after then?

Edited by seangriffin

Share this post


Link to post
Share on other sites

Posted (edited)

I think its worth mentioning that, the same as vlc player this example can also handle and play compressed rar files. (assuming the content is media which is playable)

And I also noticed that the resizing of the window from minimize or fullscreen does not always cause the player to lose its picture 2/10 attempts for me left the picture in tact, just drawing the borderes white.

Edited by JohnOne

Share this post


Link to post
Share on other sites

Posted

Hello, I'm in France, sorry for the vocabulary!

Congratulations on your UDF "VLC.au3" I use it to make a small program for my son educatiff.

The program contains lots of small videos, but I am very annoyed because the beginning of each video title is displayed in white!

In the original program VLC I can disable this option: Tools / Preferences / Subtitles & OSD.

I can not disable this option with your udf.

Can you help me?

Can you make an update to your udf that contains this option?

Share this post


Link to post
Share on other sites

Posted

OK I'm sorry, the problem is resolut!

I download the latest version of VLC (1.1.4), I play with 1.0.2

The title is no longer displayed!

Thank you

Share this post


Link to post
Share on other sites

Posted (edited)

i was trying to implement this into one of my scripts but i am just getting an error i notice that you use

http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab

that URL in the VLC.au3

just wondering if there is a fix or a work around any help would be appreciated

-Pyro

Edited by PYRODOG

Share this post


Link to post
Share on other sites

Posted

i was trying to implement this into one of my scripts but i am just getting an error i notice that you use

http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab

that URL in the VLC.au3

just wondering if there is a fix or a work around any help would be appreciated

-Pyro

Im pretty sure you cannot have a fix for an error that you dont tell about.

You will have to do a little better than "i am just getting an error", if anyone is to help.

Share this post


Link to post
Share on other sites

Posted

Im pretty sure you cannot have a fix for an error that you dont tell about.

You will have to do a little better than "i am just getting an error", if anyone is to help.

Ok sorry i just figured if you would run the script yourself sorry for assuming logic problem solving i recivece the first error in the script...

"The most likely cause is that you don't have VLC installed. Make sure VLC, and the ActiveX component, is installed."

so i tried to work around it and i took the error checking part out of the VLC.au3 and then ran the script i received a black screen

hope that helps a little bit if you use the script and it works fine please tell and let me know what your versions your running and os

thanks

Pyro

Share this post


Link to post
Share on other sites

Posted

I just redownloaded both the udf and example from 1st post.

The example worked straight out of the box, but of course I have vlc installed including the activex.

Ps, you did not post a script to run anyway.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.