VideoHelp Forum




+ Reply to Thread
Results 1 to 8 of 8
  1. Member
    Join Date
    Dec 2004
    Location
    Malaysia
    Search Comp PM
    I am developing a media player that plays multiple file types like mpeg,asf,avi and many more using Visual Basic 6 SP6.

    I would like to know how to add a screenshot function in my media player using VB6 code.Example is like when the user wants to take a screenshots of the movie while playing and the user just have to press the screenshot function and it will take a snapshots of the movie and it will prompt user to save the image in the directory.

    Please anyone can tell me how to do this function?I am still a newbie in VB6.Maybe you can e-mail if you know the code.Thanks.
    Best Regards,
    ^_Ck_^,
    ~|Be Cool Always|~
    Quote Quote  
  2. Renegade gll99's Avatar
    Join Date
    May 2002
    Location
    Canadian Tundra
    Search Comp PM
    I haven't found a way to do it using the mswebdvd control.
    The easiest player to write in VB uses the ms media player component. You can make the control invisible and progam it so that it is virtually impossible to detect that you are using the plugin. The beauty is that it plays almost all sources and it is easy to write a capture small screen capture function. You can even capture snapshots from a dvd that way. I have an unfinished project using media player 10 that I occasionaly add a bit of code to.
    Just drop a media player component on a form (my frmmain) along with a common dialogue box and a button (I named it Fileget)
    Sample access code:

    Private Sub Fileget_Click()
    On Error Resume Next
    frmmain.dlgCommonDialog.DialogTitle = "Open DVD Files"
    frmmain.dlgCommonDialog.Filter = "DVD Files (*.IFO,*.VOB)|.VOB;*.IFO|Video Files(*.AVI,*.MPG,*.MPEG,*.DAT|*.AVI;*.MPG;*.MPEG; *.DAT|MP3 File (*.MP3)|*.mp3|WAV File (*.WAV)|*.wav|WMA File (*.WMA)|*.WMA)|MIDI File (*.MID,*.MIDI,*.KAR)|*.MID;*.MIDI;*.KAR|All Files (*.*)|*.*"
    frmmain.dlgCommonDialog.ShowOpen
    If frmmain.dlgCommonDialog.FileTitle <> "" Then
    frmcontrols.Txtcliploc.Text = frmmain.dlgCommonDialog.FileName
    frmmain.WindowsMediaPlayer1.Url = frmcontrols.Txtcliploc.Text
    frmmain.WindowsMediaPlayer1.Visible = True
    End If

    End Sub
    I use the text box to save the path and filename for another use.
    As far as the capture function is concerned you will see that it is not an issue with this prog. Just look for some code that captures the screen or any selected part of the screen to make a custom app.
    I am working on this feature right now but temporarily just set the focus to the player's form and Alt/printscreen, then use this code to save in a picture box. Put this code on a button click.
    frmcontrols.snapImage1.Picture = Clipboard.GetData(vbCFBitmap)
    frmcontrols is the name of my form which contains an imagebox

    To save the image (I use image box instead of a picturebox ..stretch prop)
    SavePicture frmcontrols.snapImage1.Picture, App.Path & "/" & "SomenamePic.bmp"
    Right now you can set the player to fill the form and set the player control property to "hide" that way when you set focus on the form and then hit (or send) alt printscreen you will only get the video portion.

    I am writing and using a better version of the screen cap code to select a portion of the screen so you just get the video and do multi caps. The code is not ready for release yet but the code will still not work with the mswebdvd control all you will get is a blank screen where the video should be but it works with the player control.

    btw) the sample file open is not my final product. Many more options can be set on the file open... ie filename, auto open and start, ini, reg or form level presets etc...
    Quote Quote  
  3. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    All you need (once your vb app is setup to display an image on screen, is
    the HDC number of the control (bitmap image i.e., image control) and you
    point to another routine that will extract the bitmap contents (screen
    image) into the clipboard or another container of your creation.
    I've done this so many times in Delphi. Its similar in VB as well.
    .
    The code snip (Delphi) escapes me at the moment, but I do have my mass
    libriary of delphi apps (code snips) I wrote near by, but I'm all soo
    lazy to look through it

    -vhelp
    Quote Quote  
  4. Renegade gll99's Avatar
    Join Date
    May 2002
    Location
    Canadian Tundra
    Search Comp PM
    Originally Posted by vhelp
    All you need (once your vb app is setup to display an image on screen, is
    the HDC number of the control (bitmap image i.e., image control) and you
    point to another routine that will extract the bitmap contents (screen
    image) into the clipboard or another container of your creation.
    I've done this so many times in Delphi. Its similar in VB as well.
    .
    The code snip (Delphi) escapes me at the moment, but I do have my mass
    libriary of delphi apps (code snips) I wrote near by, but I'm all soo
    lazy to look through it

    -vhelp
    vhelp
    The problem is that with DVD video most screen capture apps can't capture the video layer. You end up with a blank frame. The same problem happens with most screen capture programs.
    I can extract avi and mpeg streams in vb and copy them to pic boxes for manipulation or saving to file but with dvd I haven't yet found code that works within vb. The user posted for the first time here (not an advanced programming forum) so it seems unlikely that he can parse the video to extract the streams. Using the The msplayer object in VB let's you easily make a non blank snapshot to a picturebox. I've used it with a timer control to replicate a rough streaming video capture just for fun.

    btw) If you find vb code that will capture an image from a dvd to a picbox or the clipboard and is not using the media player I would love to have it. I found dvd parsers but they all written in C and I'm too lazy to spend time learning. Thanks
    Quote Quote  
  5. Usually DVDs are encrypted.
    I don't think that someone would officially post a source code in an open forum or somthing like it on how to break the DVD protection (CSS, even if the code in C is very known) ...
    Quote Quote  
  6. Renegade gll99's Avatar
    Join Date
    May 2002
    Location
    Canadian Tundra
    Search Comp PM
    Originally Posted by borax
    Usually DVDs are encrypted.
    I don't think that someone would officially post a source code in an open forum or somthing like it on how to break the DVD protection (CSS, even if the code in C is very known) ...
    I know this is old but I've been away and this is a slower moving forum anyway.

    This isn't about css protection. It's as I said before... being able to screen capture the video layer.

    The ms media player and plugin let you control the layer settings. In vb or other language you use the player plugin, disable the video overlay then use some simple code to emulate a screen cap and then restore the overlay if you wish.

    If you want to do the same thing manually then with the media player (tools, options, performance, advanced) uncheck the video layer options and use the (alt) print screen key.

    All you need for dvd access with the player is a free mpeg2 decoder available here in the tools section if you don't have one.
    Quote Quote  
  7. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    But, fwiw.., do you know exactly what you would be capturing ??

    From my understanding, it captures the YUV format, not RGB. I think
    that PDVD captures it as YUV, but converts then to RGB, but using the
    16-235 range, not the 0-255 range.
    .
    But, lets say that you find a way to capture (or take snap-shot pic)
    of this YUV image, you still have to convert it back to RGB.., and
    which will you choose.., the 16-235 or 0-255 range ??
    .
    For PC viewing, I would use 0-255 range. Even tv viewing, I'd covert
    as 0-255 range. I think that the 16-235 range is nonsense, and just
    makes things look a bit washed out. Heck, I think that 0-255 range
    should always be used, period. Anyways.

    The pic below demonstrates 0-255 (left side) vs. 16-235 range (right side)



    Image Spec:
    * saved as jpeg format
    * quality 15

    so far, I haven't found any source code to capture the OVERLAY area.

    FWIW.. There are other reasons to capture OVERLAY. For instance, when
    your window is from a TV source, and you want to capture it (for whatever
    the reason) ..or, when your source came from a dvd recorder, and you
    are playing it in PDVD, and for on-the-fly reasons, you want to take
    a snap shot. Not everything has to be CSS related (or debunked issued)
    for DVD capturing, etc

    -vhelp 3247
    Quote Quote  
  8. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Another thing to consider in this equation of capturing the video
    window during play. Some video player apps, (even capture apps like
    another of my favorites, RsDvCap app) do not have a snap-shot button.
    With RsDvCap, my current driver setup allows me to screen capture the
    window, using an external delphi screen copy/capture app I made, to
    capture the video's window (which works well) but I want to be able
    to capture the window w/ better precision. To do that, I need to
    know the windows' DC name. That, I do not have, thats to my limited
    knowledge (at the moment) to do so through delphi/pascal code. But,
    if I could find out the RsDvCap's windows' DC name (number) I could
    spot-on capture its video window, no matter where the window opens
    up during startup.

    For instance, the image below is a screen copy of my dv captures's
    full window. I could capture just the video, but most of the time,
    the window is not at the same X,Y position. The image below is
    the exact representation of what I see, color for color, because
    it is not using an OVERLAY surface.
    .
    My ADVC-100 was used in this scenario, and considering the source
    (antenna) its not too bad, though there is noticable ghosting, but
    that's antenna for ya, right. Anyways.



    Image Spec:
    * saved as jpeg format
    * quality 15

    My next step in this equation, is to figure out how to obtain
    the windows DC number, so that I can lock onto it, and have better
    control of the video video for capturing or taking pictures from.
    If I can figure this out through code, I'll post the source up
    here, for others to use, (or convert to other C++/C#/VB etc)

    -vhelp 3248
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!