AutoCropper plugin (2 Viewers)

ziphnor

Retired Team Member
  • Premium Supporter
  • August 4, 2005
    755
    13
    Copenhagen
    Home Country
    Denmark Denmark
    LOL :) Thank you for the support.

    I wont be able to work on the filter this weekend, and im on a conference the following one, so dont expect this right away ;) However, as i got the cropping working in the filter directly its definetly on its way.

    The first version will probably just be the filter 'always on', which can be added to MP using the the new post processing configuration. After that i will add some real config and additionally allow a configuration where you press a key to get a bounding box which stays until you click again.

    Im also going to add DS thread priority control to the filter, so that the filter can be instructed to raise or lower the priority of the main DirectShow thread, this could be used to raise the priority of live TV abit, and with the cropping off could be used in the conversion filters to lower priority etc.
     

    dfbb

    Portal Pro
    January 27, 2005
    68
    0
    Gelderland
    Home Country
    Netherlands Netherlands
    I have also been following this thread for some time, since this is a feature I wanted for a long time. I really wanted this feature, because I was used to having it in DScaler (maybe you can even have a look at the DScaler code since it is open source).

    Anyway, thanks for the effort!
     

    ziphnor

    Retired Team Member
  • Premium Supporter
  • August 4, 2005
    755
    13
    Copenhagen
    Home Country
    Denmark Denmark
    Interesting, i do vaguely remember that DScaler had something like that, but it was a bit 'jumpy' for my tastes.

    Contrary to my plan, i added support for finding the bounds on request instead of continously since its so easy to do. I think im going to play around a bit with adding the filter in MP and see if i can setup an action/button to call the request method on the filter. The first version will probably be completely manual, ie you press a key and it makes a guess over the next X frames and leaves it there.
     

    ziphnor

    Retired Team Member
  • Premium Supporter
  • August 4, 2005
    755
    13
    Copenhagen
    Home Country
    Denmark Denmark
    I got the C# -> Native DirectShow filter communication working. To get a better test platform i made a quick and dirty integration into MediaPortal as follows:

    I added my AutoCrop filter as a post proc. filter , and added code in the Video player (i dont have any TV recordings on my development machine) to store the interface to the AutoCrop filter when it was added, and then added code to handle a crop action in fullscreen tv and fullscreen video, by showing a 'Cropping Black bars' message and requesting the crop from the AutoCrop filter. Finally i bound this action to the q key(the c key is taken ;)

    I made a little screen capture video showing it in action(okay, so its not that interesting, but still ;)

    http://s16.quicksharing.com/v/7291108/1crop.mp4.html

    The video shows playback of an MPEG-2 video clip from a TV broadcast of 'Interview with the Vampire' in My Videos. ~12 seconds into the video(in a frame with the subtitles shown) i click 'q' on the keyboard and the video is cropped after a small delay of 20 sampled frames. The aspect ratio is set to 'stretch' so since the windows shown is 4:3 people get stretched :)

    The white lines shown briefly is the cropping bounds found, and the green lines show what was sampled. The lines are of course only there for testing/debugging ;)

    Btw, the video is crappy and stuttering only because it was captured using a screen grabbing tool and then mutilated into a decent size MPEG-4 file, there is no stuttering or anything going on in the playback in MP(manual mode will have little to no effect on CPU usage, since its only copying a buffer except when asked to crop).

    I wouldnt mind some input on how the controls should be in MP btw. I was thinking one key finds new bounds in manual mode, while another key switches between 'off', 'auto' and 'on-request'(ie manual) mode.
     

    jawbroken

    Portal Pro
    August 13, 2005
    706
    0
    Home Country
    Afghanistan Afghanistan
    Looking good.

    The controls in MediaPortal sound fine the way you described them. Off, Auto and Manual modes, and a button to set bounds when in manual mode. It is pretty much the only nice way of doing it that I can think of.
     

    dfbb

    Portal Pro
    January 27, 2005
    68
    0
    Gelderland
    Home Country
    Netherlands Netherlands
    It is indeed looking good. I suppose the best way to integrate this function in MP is the way you proposed: On/off/manual.

    Will you put this code into the SVN-builds?
     

    ziphnor

    Retired Team Member
  • Premium Supporter
  • August 4, 2005
    755
    13
    Copenhagen
    Home Country
    Denmark Denmark
    Will you put this code into the SVN-builds?

    Yes, but not right now, the integration into MP is just a temporary hack, there is a bit more work to be done there, and the filter itself needs some cleanup, as well as support for RGB modes(it currently only accepts YUY2) and some more YUV style color spaces.

    Im travelling the next ~2 weeks so i wont be working on it there, but it shouldnt be that long before a version supporting the manual operating mode should be ready.

    If no problems are encountered it will definetly be ready before christmas.
     

    ziphnor

    Retired Team Member
  • Premium Supporter
  • August 4, 2005
    755
    13
    Copenhagen
    Home Country
    Denmark Denmark
    Yes im back, a bit busy though :)

    And yes i do mean christmas this year ;)
     

    ziphnor

    Retired Team Member
  • Premium Supporter
  • August 4, 2005
    755
    13
    Copenhagen
    Home Country
    Denmark Denmark
    In case anyone is interested, here is a (rather boring) status update:

    I had previously copied Microsofts CTransformFilter class source into my filter because i ran into some problems deriving from it, i have cleared that out of the way now, which is good since there would probably be some license/copyright problems with that. Now its a straightforward derivation of CTransformFilter.

    The filter now accepts both VIDEOINFOHEADER and VIDEOINFOHEADER2 media types and im working right now to add YV12 support.

    After that im going to add RGB support(probably by converting the scanned lines to YUV so i wont have to write the analyze code twice), and furthermore make sure the filter can accept all media types, but just disables its crop functionality when used on incompatible data types.
     

    Users who are viewing this thread

    Top Bottom