banner



How To Add Tags To Video Files

Video tags and keywords

I will show you how to write tags to video files so they can be searched from Windows file explorer.

In Fast video cataloger, you can assign tags (keywords) to videos as well as to specific points in time inside of the video files. You can quickly search across all your videos fifty-fifty if the video files are archived away and not accessible. Keywords in Fast video cataloger are stored in the itemize and non in the video files. If you lot want to be able to employ Windows search and have the same tags as in Fast video cataloger y'all need to transfer the tags to the bodily video files. Fortunately, this can exist easily exist done with the integrated script support in Fast video cataloger.

NOTE: In Fast Video Cataloger Version 7 and afterward y'all can store tags in the Windows metadata section for video formats that back up this. You discover this selection in preferences on the metadata tab.

Setting tags to video files

If yous don't care about the details simply copy the script at the bottom of this text into the script window in Fast video cataloger. Select the videos you want to transfer tags to and run the script.

Tags on files in Windows

When you lot practise a search in Windows yous search on metadata stored inside files. Windows tin can build and maintain an index of all this metadata to brand searching a bit quicker and so that it does not have to access all files every fourth dimension you lot search. What metadata you can add to a file depends on the file format. It is not the same for all files and for some file formats it is actually quite express. For example, not all video file formats support tags. To meet what tags are set up to a video file, click properties in Explorer and go to the Details tab.

Tags in video file details

Video detail property page

You tin can besides become to the backdrop from within Fast video cataloger, simply right-click the video in the catalog list and select File/Backdrop.

If you see a Tags line in the property canvas then the format back up Tags. You lot will also observe a rating, championship, and a comments field. If the tags field is not at that place for the file format, that format simply does non back up tags. If the format does not back up tags so this script will fail when trying to assign tags to it. This is also 1 of the reasons why Fast video cataloger does not shop tags within of the video files by default.

C# code walkthrough

WindowsAPICodePack

We will use the "Microsoft.WindowsAPICodePack.Shell" package to write the tags to files. To be able to use that package we need to add a reference to information technology from our project. If you are copying this lawmaking for a normal C# projection, i.e. not a Fast video cataloger script you can add the reference in the Visual studio solution (look in references). For a script in Fast video cataloger we don't take a solution, the way we need to do this is with a special comment. The beginning line in the script adds that reference: //css_ref Microsoft.WindowsAPICodePack;. Then we also need to add the using lines to bring in the library to the file: using Microsoft.WindowsAPICodePack.Beat out;. At present that we accept solved the actress dependencies we can utilize this library to write our tags to the videos.

The lawmaking

The get-go of this script is very similar to most other Fast video cataloger sample scripts. We get the id of the selected video(s) and then employ that id to the path to the file.

The ConvertToLocalPath(...) is needed in example your itemize has used special folders and will catechumen these special folders into an absolute path. If the path is already absolute this will exercise null.

And so we demand to go a beat reference to the file with ShellFile.FromFilePath. In the Windows shell not all entries are files. The trounce API references entries in the shell using pidl and not normal file paths. This API call simply gets the path in the shell to the file.

The side by side footstep is to go the function to write to the property folio of the trounce object. file.Properties.GetPropertyWriter(); give us the interface we need and and then we just need to call WriteProperty(..) to write property values of the file. For the calls to succeed the property needs to be supported by the file format as mentioned before and the file needs to be writable.

External references

As all other samples this sample is available on the Fast video cataloger github repository.

Documentation on properties for Windows files tin be institute here

C# code – Tag to video file

                      //css_ref Microsoft.WindowsAPICodePack; using Microsoft.WindowsAPICodePack.Crush; using Microsoft.WindowsAPICodePack.Trounce.PropertySystem; using System.Collections.Generic; using System.Runtime; using System; using VideoCataloger;  namespace VideoCataloger {   public class WriteTags   {     static public void Run(IScripting scripting, string statement)     {         scripting.GetConsole().Clear();         var catalog = scripting.GetVideoCatalogService();         ISelection selection = scripting.GetSelection();         List selected = selection.GetSelectedVideos();         foreach (long video in selected)         {           try           {             var entry = catalog.GetVideoFileEntry(video);              IUtilities utilities = scripting.GetUtilities();             var selected_path = utilities.ConvertToLocalPath(entry.FilePath);              var file = ShellFile.FromFilePath(selected_path );              var selected_videos = new long[1];             selected_videos[0] = video;             var TagInstances = itemize.GetTagsForVideos(selected_videos);             List tag_list = new Listing();             foreach (var tag in TagInstances)             {               tag_list.Add( tag.Name );             }              scripting.GetConsole().Write( "Tagging : " + selected_path + " ..." );             ShellPropertyWriter propertyWriter =  file.Properties.GetPropertyWriter();             propertyWriter.WriteProperty(SystemProperties.Organization.Keywords, tag_list.ToArray() );             int Rating = 0;             if (entry.Rating==1)               Rating = one;             if (entry.Rating==2)               Rating = 25;             if (entry.Rating==iii)               Rating = 50;             if (entry.Rating==4)               Rating = 75;             if (entry.Rating==5)               Rating = 99;             propertyWriter.WriteProperty(SystemProperties.Organisation.Rating, Rating );             propertyWriter.WriteProperty(SystemProperties.Organisation.Comment, entry.Description );             propertyWriter.Close();              scripting.GetConsole().WriteLine( "Done " );           }           catch (Exception ex)                     {             scripting.GetConsole().WriteLine( ex.Message );           }         }            }   } }                  

How To Add Tags To Video Files,

Source: https://videocataloger.com/setting-tags-to-video-files/

Posted by: palmerrecance.blogspot.com

0 Response to "How To Add Tags To Video Files"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel