Skip to content

Commit

Permalink
Added subtitle test for MediaTranscoder.
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcclive committed Apr 14, 2021
1 parent 02f82d5 commit e5b0ba6
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Tricycle.Media.FFmpeg.Tests/MediaTranscoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,44 @@ public void StartAddsAc3AudioStreamOnJob()
Assert.AreEqual("640k", stream.Bitrate);
}

[TestMethod]
public void StartAddsSubtitleStreamOnJob()
{
int index = 2;
var format = SubtitleFormat.TimedText;
string codec = "mov_text";

_transcodeJob.SourceInfo.Streams.Add(new SubtitleStreamInfo()
{
Index = index
});
_transcodeJob.Streams.Add(new SubtitleOutputStream()
{
SourceStreamIndex = index,
Format = format
});
_configManager.Config = new FFmpegConfig()
{
Subtitles = new SubtitleConfig()
{
Codecs = new Dictionary<SubtitleFormat, SubtitleCodec>()
{
{ format, new SubtitleCodec(codec) }
}
}
};

_transcoder.Start(_transcodeJob);

Assert.AreEqual(2, _ffmpegJob.Streams?.Count);

var stream = _ffmpegJob.Streams[1];

Assert.AreEqual(0, stream.Input?.FileIndex);
Assert.AreEqual(index, stream.Input?.StreamIndex);
Assert.AreEqual(codec, stream.Codec?.Name);
}

[TestMethod]
public void StartAssignsStreamMetadataOnJob()
{
Expand Down

0 comments on commit e5b0ba6

Please sign in to comment.