Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions FFMpegCore.Test/FFProbeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,13 @@ public async Task FFProbe_Should_Throw_FFMpegException_When_Exits_With_Non_Zero_
await Assert.ThrowsAsync<FFMpegException>(async () => await FFProbe.AnalyseAsync(input,
cancellationToken: TestContext.CancellationToken, customArguments: "--some-invalid-argument"));
}

[TestMethod]
public void Probe_Success_Output_Data()
{
var info = FFProbe.Analyse(TestResources.Mp4Video);

Assert.AreNotEqual(0, info.OutputData.Count);
CollectionAssert.Contains(info.OutputData.ToList(), " \"codec_long_name\": \"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10\",");
}
}
2 changes: 2 additions & 0 deletions FFMpegCore/FFProbe/FFProbe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ private static IMediaAnalysis ParseOutput(IProcessResult instance)
throw new FormatNullException();
}

ffprobeAnalysis.OutputData = instance.OutputData;
ffprobeAnalysis.ErrorData = instance.ErrorData;

return new MediaAnalysis(ffprobeAnalysis);
}

Expand Down
2 changes: 2 additions & 0 deletions FFMpegCore/FFProbe/FFProbeAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class FFProbeAnalysis

[JsonPropertyName("chapters")] public List<Chapter> Chapters { get; set; } = null!;

[JsonIgnore] public IReadOnlyList<string> OutputData { get; set; } = new List<string>();

[JsonIgnore] public IReadOnlyList<string> ErrorData { get; set; } = new List<string>();
}

Expand Down
1 change: 1 addition & 0 deletions FFMpegCore/FFProbe/IMediaAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ public interface IMediaAnalysis
List<VideoStream> VideoStreams { get; }
List<AudioStream> AudioStreams { get; }
List<SubtitleStream> SubtitleStreams { get; }
IReadOnlyList<string> OutputData { get; }
IReadOnlyList<string> ErrorData { get; }
}
4 changes: 3 additions & 1 deletion FFMpegCore/FFProbe/MediaAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ internal class MediaAnalysis : IMediaAnalysis
internal MediaAnalysis(FFProbeAnalysis analysis)
{
Format = ParseFormat(analysis.Format);
Chapters = analysis.Chapters.Select(c => ParseChapter(c)).ToList();
Chapters = analysis.Chapters.Select(ParseChapter).ToList();
VideoStreams = analysis.Streams.Where(stream => stream.CodecType == "video").Select(ParseVideoStream).ToList();
AudioStreams = analysis.Streams.Where(stream => stream.CodecType == "audio").Select(ParseAudioStream).ToList();
SubtitleStreams = analysis.Streams.Where(stream => stream.CodecType == "subtitle").Select(ParseSubtitleStream).ToList();
OutputData = analysis.OutputData;
ErrorData = analysis.ErrorData;
}

Expand All @@ -29,6 +30,7 @@ internal MediaAnalysis(FFProbeAnalysis analysis)
public List<VideoStream> VideoStreams { get; }
public List<AudioStream> AudioStreams { get; }
public List<SubtitleStream> SubtitleStreams { get; }
public IReadOnlyList<string> OutputData { get; }
public IReadOnlyList<string> ErrorData { get; }

private MediaFormat ParseFormat(Format analysisFormat)
Expand Down