Video Converter. Step by step.

Let me explain what exactly happens when encoding job is triggered. These are major steps and they may be modified in the future. For now program works as single entity, but probably it will be much more efficient to break it down into two components: queue and conversion as separate console apps.

  • Initial Step includes parsing xml files that store application preferences.
  • Scanning Recorded TV folder for newly added files. We utilize LINQ queries to do the job. Files that are currently being recorded are ignored. These files do not contain complete metadata yet and that allows us to identify them first.
  • Extracting metadata from recorded WTV files and writing information into separate xml files with corresponding original file name. I will write separate post on how to get metadata from TV recordings.
  • Cleaning up orphaned metadata xml files. Some recordings may be already deleted.

These steps lead us to building our queue:

  • Parsing existing metadata xml files
  • Parse xml file called job.process.xml that contains names of the items that we want to convert. Concept is similar to Season Pass. We also include our preferences for final product like file format MKV/MP4 and encoding profile.
  • We use LINQ queries to identify recordings that were not processed yet. We can also specify some additional criteria here like channels that need to be excluded from processing.
  • Our findings are written to job.queue.xml file

Conversion steps:

  • Parsing queue xml file
  • Parsing encoding profiles.
  • Queue items should be sorted out based on defined priorities
  • Getting first item in a queue for processing
  • Converting WTV to DVR-MS using WTVConverter.exe
  • Converting DVR-MS to MPEG using FFMPEG
  • Converting MPEG to MKV/MP4 using either FFMPEG or Handbrake

Post-processing steps:

  • Renaming completed files and organizing them into proper folder structure. Separating movies and TV Series items.
  • Creating Kodi type nfo metadata files. Our priority is to use metadata that we already extracted from WTV files. However we will also add ability to retrieve metadata from services like thetvdb.com and themoviesdb.org

As a final step we should check queue to see if there is any additional pending item.

This is a rough idea what should be done when we want to convert a video recording. As you can see we have 3 parts:

  • Building queue
  • Conversion
  • Post-processing

If we combine all of them into single process we are risking some unexpected outcomes. For examples if something fails during post-processing, we may not be able to continue with converting another file in a queue. Therefore it may be better to separate these tasks. On the other hand it would make more sense to isolate building queue first and leave conversion and post-processing together.

Leave a Reply

Your email address will not be published. Required fields are marked *