Skip to content

Instantly share code, notes, and snippets.

View Casey-Bateman's full-sized avatar

Casey Bateman Casey-Bateman

  • Hudl
  • Lincoln NE
View GitHub Profile
@Casey-Bateman
Casey-Bateman / gist:5d8e9282f82d5d760f32
Created July 28, 2014 15:51
Crossfade Concat explanation
using Hudl.FFmpeg.Command;
using Hudl.FFmpeg.Common;
using Hudl.FFmpeg.Filters.BaseTypes;
using Hudl.FFmpeg.Metadata;
using Hudl.FFmpeg.Resources.BaseTypes;
using Hudl.FFmpeg.Sugar;
...
//below are a few constants and assumptions that can be made
//we are planning to use filter concatenation on three input videos
var filterchain = Filterchain.FilterTo<VideoStream>(new Concat());
//we want our output to be encoded using the following settings:
// -c:v libx264
// -b:v 3000k
// -s 852x480
// -y
var settings = SettingsCollection.ForOutput(
new CodecVideo("libx264"),
//we are planning to use filter concatenation on three input videos
var filterchain = Filterchain.FilterTo<VideoStream>(new Concat());
//we want our output to be encoded using the following settings:
// -c:v libx264
// -b:v 3000k
// -s 852x480
// -y
var settings = SettingsCollection.ForOutput(
new CodecVideo("libx264"),
//we need to create an instance of a command factory.
var factory = CommandFactory.Create();
//staging all input video streams for concatenation, filtering, and mapping to output
var command = factory.CreateOutputCommand()
.WithInput<VideoStream>("c:/foo/bar1.mp4")
.WithInput<VideoStream>("c:/foo/bar2.mp4")
.WithInput<VideoStream>("c:/foo/bar3.mp4");
//this applies the filterchain to the selected inputs, and gives the resulting stream(s)
var filtered = command.Filter(filterchain);
//this command will map the filtered streams to the path, with the settings we defined
filtered.MapTo<Mp4>("c:/foo/bar4.mp4", settings);
//the render command will start feeding the commands to FFmpeg
factory.Render();
@Casey-Bateman
Casey-Bateman / MomentRenderedFile.cs
Created January 5, 2017 22:03
Base Rating Rendered File Structure
public class BaseMomentRenderedFile : BaseRenderedFile
{
public string Id { get; set; }
public List<string> MomentIds { get; set; }
//.. any additional future fields such as exciting moment time would go here.
}
@Casey-Bateman
Casey-Bateman / BaseGameHighlightRating.cs
Created January 5, 2017 22:06
BaseGameRatingExtension
public class BaseGameHighlightRating
{
//pre-existing fields ...
public List<BaseMomentRenderedFiles> RenderedFiles { get; set; }
}
@Casey-Bateman
Casey-Bateman / BaseMomentHighlightRating.cs
Created January 5, 2017 22:10
BaseMomentHighlightRating
public class BaseGameHighlightRating
{
//pre-existing fields ...
public BaseMomentRenderedFile RenderedFile { get; set; }
}