Blog Archives

microsoft expressions split clips into multiple files

open expressions (select transcode project)

file->new job

import file

select all your encoding video/audio settings

set your clips (click on location in timeline then on the “insert edit at playhead button”)

at this point you may have assumed clips would have encoded into separate files but this is not how expressions works inherently

save your job in case you make a mistake

right click on the job file in the media window at the bottom left and select duplicate

all of your video/audio encoding settings and clips you set will be duplicated

you can now duplicate as many times for as many clips as you have and remove the excess clips, using the clips tab (window->clips) to make sure you don’t make mistakes by referencing the start/stop times

click encode and watch as many files are queued!



c# .net split strings with math divrem using lambda linq

Recently I came across a nice alternative to loops using linq for evenly splitting a string using Math.DivRem.

The following example illustrates how this can be used to parse a sequence of numbers based on a time series which may give variable results in a custom messaging protocol.

(inspired by R. Prestol)

//not the complete classes but satisfies the below example
class message {
string series {get;set;}

  string[] series = message.series.Split(' '); //will NOT throw an exception if series string is empty
            int Rem = 0;
            int d = Math.DivRem(name.Length, 2, out Rem); //hardcoded two for simplicity in this example
//valueB will contain the same value as valueA if there is no second value in the sequence
            string valueA = string.Join(" ", sentence.Take(Math.Max(d, 1)).ToArray());
            string valueB = string.Join(" ", sentence.Skip(d).Take(d + Rem).ToArray());

int average = (Convert.ToInt32(valueA) + Convert.ToInt32(valueB)) / 2; //2 would also need to be dynamic here


//potential input
//100 101

//output for average
//first input: 100
//second input: 100

A significant figure is lost (.5) on first input since valueA and valueB are converted to int. Conversion to decimal, double etc would of course maintain this detail depending on the rounding you are looking for.