c# for all the really advanced video searches

Extending the video search

The basic idea I show you here is how to write a script in C# that determines if a video matches your search criteria or not and put the matching videos in a custom Bin.

You will learn by a simple step by step example how to write a script that goes through all videos in you catalog and puts all short videos(the critera we have as an example) in a bin.

After you have this skill you can expand your skill and continue to experiment.

About the native video search

Fast video cataloger has a very powerful, fast and simple search engine. The text below show how easy you can extend it even more with advanced custom video search in C#.

Our simple user interface make searching in Fast video cataloger straight forward for everyone. However, we do not provide a SQL interface for search so there are searches you can simply not express given our user interface. With the scripting interface you can do basically anything.

AI For example… What if you want to search with facial recognition or object detection or the next big thing in AI and video?

You an do all this and more by leveraging the scripting capabilities in Fast video cataloger

step by step breakdown on the Video search script in c#

Run(…) in the code below, is the entry function where the execution of the script starts.

    static public void Run(IScripting scripting, string argument)
    {
        FilterToBin instance = new FilterToBin(scripting);
        instance.SetBinTarget("short videos");
        instance.Filter();
        scripting.GetGUI().Refresh("");
    }

I have encapsulated all functionality in a class called “FilterToBin” that has two functions.

SetBinTarget() let you set the name of the Bin that will be used for search results. Please note that this Bin will be cleared every time you run the search.

Filter() does the actual filtering of videos.

    private void Filter()
    {
        var catalog = m_Scripting.GetVideoCatalogService();

        VideoQuery query = new VideoQuery();
        VideoFileEntry[] videos = catalog.SearchVideos(query);

        long bin_id = CreateBin();

        foreach (VideoFileEntry entry in videos)
        {
            if (IsVideoPassingFilter(entry))
                catalog.AddVideoToBin(entry.ID, bin_id);
        }
    }

The Filter() function first does a search to get all videos. In this example we pass in en empty VideoQuery object. That will give us all videos in the catalog. You can of course leverage the search here and first do a high level search to get a subset of your videos and then apply a more advanced search on that subset.

We then call CreateBin() to ensure we have a bin to put our results in. If we look closer in the FilterToBin class the CreateBin member function has some logic to create a Bin if its not already created and clear it from videos if it already exists.

Finally we iterate over all videos and call the IsVideoPassingFilter() function on each video. Videos that pass the test are put in the result Bin.

    private bool IsVideoPassingFilter( VideoFileEntry entry )
    {
        if ( entry.LengthSeconds < 60)
            return true;
        return false;
    }

If you want to change the filter criteria this is the only function you need to edit. In this example we only check if the video length property is smaller than 60s.

To run this script you copy paste it or type it (or load it) into the script window and then click the Run button.

Go the Bin window and select the "short videos" to see the result (if the bin is not there go into the edit bin to refresh the window, this is needed on older versions of Fast video cataloger).

Edit button in bin window

Edit button in bin window

Full source code in C#

using VideoCataloger;
using VideoCataloger.RemoteCatalogService;

public class FilterToBin
{
    IScripting m_Scripting;
    string m_BinLabel;

    FilterToBin(IScripting scripting)
    {
        m_Scripting = scripting;
    }

    private void SetBinTarget(string bin_label)
    {
        m_BinLabel = bin_label;
    }

    private void Filter()
    {
        var catalog = m_Scripting.GetVideoCatalogService();

        VideoQuery query = new VideoQuery();
        VideoFileEntry[] videos = catalog.SearchVideos(query);

        long bin_id = CreateBin();

        foreach (VideoFileEntry entry in videos)
        {
            if (IsVideoPassingFilter(entry))
                catalog.AddVideoToBin(entry.ID, bin_id);
        }
    }

    private bool IsVideoPassingFilter( VideoFileEntry entry )
    {
        if ( entry.LengthSeconds < 60)
            return true;
        return false;
    }

    private long CreateBin()
    {
        var catalog = m_Scripting.GetVideoCatalogService();
        Bin[] all_bins = catalog.GetAllBins();
        foreach (Bin bin in all_bins)
        {
            if (bin.Label == m_BinLabel)
            {
                VideoFileEntry[] videos = catalog.GetVideosInBin(bin.BinID);
                foreach (VideoFileEntry entry in videos)
                {
                    catalog.RemoveVideoFromBin( bin.BinID, entry.ID );
                }

                return bin.BinID;
            }
        }

        Bin target_bin = catalog.CreateBin(m_BinLabel, -1, 0xffffff);
        return target_bin.BinID;
    }

    static public void Run(IScripting scripting, string argument)
    {
        FilterToBin instance = new FilterToBin(scripting);
        instance.SetBinTarget("short videos");
        instance.Filter();
        scripting.GetGUI().Refresh("");
    }
}

Managing photos and video images for your video files

Images and video files

Fast video cataloger lets you manage any type of photos together with your video files.

In Fast video cataloger, everything starts with a video. Fast video catalog is far from a traditional photo viewer program.

For photos, this means that you link photos to videos and that photos are filtered for the video.

We call photos stored in Fast video cataloger for companion images.

Companion images can be any type of digital image in jpeg or png file format.

What companion images you want in your catalog depend on the application. If you have a catalog of normal play films, like a movie you would find at imdb. Then, typical companion images are probably cover images, posters, pictures from the release party.

If you use Fast video cataloger for your company. Then, the companion images could be images shot at meetings and presentations, photos of a whiteboard, people in the meeting and so on. For these applications remember that you can also add extended video properties. In that way, it is possible to link other file types to your videos.

Type of images that fast video cataloger can handle

A companion image is any type of image set to a video. A companion image can be set as cover a front or back cover for a video. We also have the concept of Actor portrait image and Actor companion image.

How to add photos to your catalog

The easiest way to add images to a catalog is to add them automatically when you add a video to your catalog. You can control if and how companion images are added from the preferences. The program can automatically add companion images that are stored in the same folder or subfolder relative to the video file.

The companion image browser has a button to rescan a folder structure. Use this if to add companion images to a video that was scanned without images.

You can also go into the repair function and do a scan to find companion images in a subfolder to videos that are not in the catalog.

Add companion images by dragging the image files to the companion image window.

Video companion images

Browsing photos for a videos

The “companion image browser” window displays thumbnails of the companion images for the selected video. The “preview image” window shows the selected image (and you can zoom with the mouse wheel).

The “Cover” window only shows the front and back cover image for the video.

The “Companion & Cover image” is a more compact window that combines the above three windows into one. It shows a scrollable list of thumbnails. When you move the cursor to the bottom of the window it lists all companion images. The currently selected image is displayed in the same window.

In the “Attract cover images” window you can see a slideshow of random cover images for all videos in your collection. There is also a setting in the preferences, “Include Companion images”. When this is checked you will get all companion images for all videos, not just covers.

Attract window

Nice things with companion images

If you have companion images setup for a video you can move it in the file organizer and the companion images will move with the video files.
Right-click in the “companion …” window you can select to use a cover image as the image to represent a video in the video catalog (for example a cover).

How to work faster with videos in Fast video cataloger

Work faster with keyboard shortcuts

Using just a few keyboard shortcuts can get you a lot more efficient with Fast video cataloger. Here are the shortcuts I use regularly in Fast video cataloger.

Use the interactive smart search

Press CTRL – I to bring up the interactive smart search input field in the top bar. Type your search terms, and press “Enter” to search, then CTRL-I again to hide the window and go back to shortcut use. If you know your catalog this is by far the fastest way to filter a video collection. You can use the smart search to search keyword as well as other properties like for example the path. You can also use several search terms to quickly narrow down your search. If you for example type: c:\tmp\ 2019 you would find any videos in the c:\tmp folder or subfolders tagged with 2019.
Look in the documentation for how the smart interactive search works, if you are not using it you are missing out on one of the most powerful features in the software.

yse the interactive video search

Iteractive video search lets you quickly drill down in huge video collections

Jump through the filtered video list

The ALT – o/l shortcut will let you go to the previous or next video in the current filtered list. It will work regardless of the video catalog window is visible or not.
Scrub through the selected video
Use ALT – j/l to jump to the next thumbnail in the currently selected video. This will let you quickly scrub through a video.
Use CTRL – “+” / “-“ to change the size of video thumbnails quickly. This can be very useful if you have lots of screens from a video and to see more of the video without using the mouse for scrolling.

And find the preferences

Press CTRL – p to instantly bring up the preferences.

Layouts are important

Setup a few ones and quickly switch between them with F1-F8. Layouts let you use the screen estate efficiently for your current tasks. Take the time to configure your own layouts.

Actions can have shortcuts

Did you know that you can assign custom shortcuts to actions and that actions can run external programs or fast video cataloger scripts?

And last….

All the shortcuts mentioned in this text are the default ones. You can reassign them if you would like to.

Check when you can use the Shift key. Some of the functions in the program have different meanings if the shift key is held down when the menu is selected. For example, the “Add to playlist” will work differently when the shift key is pressed.

Video Wall in Fast Video Cataloger

The Videowall is meant to provide a massive preview of your entire catalog at once. It loops through all your video scenes in all your videos from start to end, all in the same window if it fits.

The Videowall is a great tool for quick overviews and can be used to get a first grasp of the content of the catalog holds for content or if you are looking for something special among lots of videos. For example, if you have over a hundred of long surveillance videos you might want to look at them all at once just to figure which ones to really look into.

Once you find something interesting simply double click to get all the video scenes(Video scenes or thumbnails are shortcuts to time in a video) for that video. From the Video Scenes window, you can start playing directly from each scene that you find interesting, just by clicking them.

https://www.youtube.com/channel/UCbaNFbkNebLPQb3No57eZ6w

Using madVR for high-quality video playback

How to get the highest-quality video playback

This article will show you how to get the high-quality video playback on your Windows PC. I will show you how to use madVR, a very popular high-quality DirectShow video renderer that uses the power of your graphics card to provide fast and very high-quality video playback.

DirectShow

DirectShow is a software component system from Microsoft. With DirectShow, a developer can create a video player that supports all video formats on the market. This is possible without having to implement all the video formats. Players can also support new video formats without doing any update to the video player software. So pretty awesome, let’s dig more into how DirectShow works.

How DirectShow works

A DirectShow filter is a piece of software packaged in a file with the .ax extension. Filters are registered in the windows registry. Video players then query the Windows registry for filters. The application can then build a filter graph to transform frames from a video into pixels on the screen.

Let us break down the simplest type of DirectShow filter in an application.

First, the application uses an input filter to read the video file. The input filter sends the data to a decoder filter. The decoder filter decodes the video stream and sends it to a render filter. The render filer puts the pixels on the screen.

The reader filters are typically installed by default in Windows. Some older decoder filters are installed with Windows and you download more yourself and install them. These type of video decoder filters are often called codecs. Then there are standard render filters installed with Windows, you can also download and install your own render filters. These custom render filters usually do different types of filtering to reduce artifacts caused by the compression in the video files.

The naïve way to build a filter graph is to let directshow automatically connect the pins. Unfortunately, this simple approach often does not work very well due to filter incompatibilities. More advanced video software has lots of code to reliably manually construct the filter graph.

High quality video rendering

madVR is a very popular high-quality DirectShow video renderer that uses the power of your graphics card to provide fast and very high-quality video output.

Key madVR Features according to their homepage:

  • MadVR does High bitdepth processing (32bit per component)
  • It has high quality algorithms for scaling, sharpening, debanding, dithering etc.
  • It does Smooth motion playback without 3:2 pulldown judder even at 60Hz
  • Using forced film mode it turns 60i movies into perfect 24p
  • It has a very reliable playback using automatic fullscreen exclusive mode

To summarize, you will get better video playback quality with madVR. The improved quality is especially evident when you play older low-quality videos. To do its magic MadVR needs several decoded video frames. Because of this, it will take a few more moments until you see the first rendered image compared to using more basic renderers. If you are after high-quality video output madVR is the way to go.

How to install MadVR

Download the madVR zip file from their homepage and unpack it. Make sure to unpack to a folder where you can keep the files. Since madVR does not come with a normal windows installer the software will be installed to where you unpack the zip file.
Go to the unpacked folder, right-click on the install.bat file and select “Run as administrator”. This will register the madVR Directshow filter (madVR.ax) in your computer’s registry so that programs can find it.

Selecting to use MadVR for high-quality video playback

The integrated video player in Fast video cataloger, https://videocataloger.com/download natively supports MadVR. However, it is but it is not selected by default.
Start Fast video cataloger, open the preferences and go to the “Video Player” tab.
From the “Video player to use” dropdown menu select “Direct + madVR”. This will tell Fast video cataloger to use special code to build a filter graph using the madVR high-quality renderer.

madvr selected for high-quality video playback

Using the madVR renderer

Fast Video Cataloger 6.1 released with virtual video editing and extended thumbnail properties

I am more than happy to announce that Fast video cataloger 6.1 is now available for download.

Download the latest version from the download page

Virtual video editing

In version 6.1 it is now possible to create virtual videos by combining sections from videos in your collection. It is basically an advanced playlist maker that allows you to create playlists of whole video clips or just a part of a video. You can use this to make a quick early draft before doing video editing or just play like a normal video. The playlists are not altering video files in any way and you can make playlists of videos in different formats and resolutions instantly without doing any type of re-encoding that would lead to quality loss. It is also super quick.

Video playlist window

Create a new virtual video playlist from the playlist window and then select a current playlist. There are three basic ways to populate your video playlist.

  • Add whole video clips to the playlist by right-clicking a video and selecting “add to playlist”.
  • Add a video segment by right-clicking a thumbnail and selecting “Add to playlist”. Doing that will att the segment from the time of the selected thumbnail to the next one. If you hold down shift while selecting add to playlist you simply add a short segment (you can select the length from preferences) from the time of the thumbnail to the playlist.
  • Right-click the camera icon in the video player to add a clip from the time where the video player is currently in the playing video.

You can re-order your clips with drag n drop after they have been added.

Extended thumbnail properties

Another new function in version 6.1 is the ability to add extended properties to thumbnails and to use that in searches. You could, for example, add a description to each thumbnail explaining the scene in words. Access this functionality from the video details window.

We have extended the scripting interface so you can leverage these new functions in your own custom solutions and we have added some more samples to give you a good start when doing your own video solutions based on fast video cataloger.

.webm video format is now a recognized video format

webm video files are recognized as standard video files

We have today released Fast video cataloger 6.02 with webm supported as a standard video file format. In the past it was possible to add webm either by adding the file specifially or setting webm as a custom video format in preferences. You can always do it that way with rare video formats. Fast video cataloger supports directshow filters so it supports rare formats and formats we have never even tested or are aware of as long as there is a directshow filter. Webm is becomming more common so we added it to the list of default extensions. When you add a folder it will treat your webm files just like it does with all other video files.

Docking framework updated

We have updated the docking framework that lets you configure your user interface across one or more displays. The update fixes a number of probolems where docking in some configurations did not work as expected. Remember that you can always reset your layout to the default if you want to start over with your layout. And if you are not using layouts you really should try it now.

Shortcuts to custom actions

You can now assign shortcuts to custom actions. You can, as before, crete custom action to launch external tools, access web resources or run custom scripts. By using custom actions you can integrate Fast video cataloger with your other software and workflows.

Imporved capture of wmv files

We have improved capture of wmv files. When you captured some type of bad wmv files the program could timeout when the video files were read from slow devices or over network.

Download the latest version of Fast video cataloger from videocataloger.com/download/