aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormyristate <myristate@users.noreply.github.com>2026-10-13 13:36:10 -0400
committerBond_009 <bond.009@outlook.com>2026-10-13 13:36:10 -0400
commit054706333d0c76b2fe676c91fbdf19b39d3d7b8b (patch)
tree6811450ba7a5bc9308ec51d0b1083b79be83c455
parent619eb231b4b9e9eaffa4a072c944fc3f7a8997d3 (diff)
Backport pull request #18243 from jellyfin/release-12.z
Fix crash probing streams without frame size Original-merge: 8e50df32e7ca3f7d74553b2dbb40cc3ef8e95bfc Merged-by: crobibero <cody@robibe.ro> Backported-by: Bond_009 <bond.009@outlook.com>
-rw-r--r--CONTRIBUTORS.md1
-rw-r--r--MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs6
-rw-r--r--tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs21
-rw-r--r--tests/Jellyfin.MediaEncoding.Tests/Test Data/Probing/video_ts_no_dimensions.json81
-rw-r--r--tests/Jellyfin.MediaEncoding.Tests/Test Data/Probing/video_ts_no_dimensions_zero_dar.json83
5 files changed, 192 insertions, 0 deletions
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 9012e35f1d..2bd0aeba6a 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -99,6 +99,7 @@
- [mitchfizz05](https://github.com/mitchfizz05)
- [mohd-akram](https://github.com/mohd-akram)
- [MrTimscampi](https://github.com/MrTimscampi)
+ - [myristate](https://github.com/myristate)
- [n8225](https://github.com/n8225)
- [Nalsai](https://github.com/Nalsai)
- [Narfinger](https://github.com/Narfinger)
diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
index 5533e55223..c9d618c84a 100644
--- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
+++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
@@ -1110,6 +1110,12 @@ namespace MediaBrowser.MediaEncoding.Probing
&& width > 0
&& height > 0))
{
+ // Live TV and other early probes can report neither a usable display aspect ratio nor the frame size
+ if (info.Width is not > 0 || info.Height is not > 0)
+ {
+ return original;
+ }
+
width = info.Width.Value;
height = info.Height.Value;
}
diff --git a/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs b/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs
index 52e0b19700..cf9930abe1 100644
--- a/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs
+++ b/tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs
@@ -242,6 +242,27 @@ namespace Jellyfin.MediaEncoding.Tests.Probing
Assert.False(res.MediaStreams[0].IsAVC);
}
+ [Theory]
+ [InlineData("Test Data/Probing/video_ts_no_dimensions.json", null)]
+ [InlineData("Test Data/Probing/video_ts_no_dimensions_zero_dar.json", "0:1")]
+ public void GetMediaInfo_TSWithoutDimensions_Success(string path, string? expectedAspectRatio)
+ {
+ var bytes = File.ReadAllBytes(path);
+ var internalMediaInfoResult = JsonSerializer.Deserialize<InternalMediaInfoResult>(bytes, _jsonOptions);
+
+ MediaInfo res = _probeResultNormalizer.GetMediaInfo(internalMediaInfoResult, VideoType.VideoFile, false, "http://192.168.1.19:5004/auto/v4", MediaProtocol.Http);
+
+ Assert.Equal(2, res.MediaStreams.Count);
+
+ var video = res.MediaStreams[0];
+ Assert.Equal(MediaStreamType.Video, video.Type);
+ Assert.Equal("mpeg2video", video.Codec);
+ Assert.Null(video.Width);
+ Assert.Null(video.Height);
+ Assert.Equal(expectedAspectRatio, video.AspectRatio);
+ Assert.False(video.IsAnamorphic);
+ }
+
[Fact]
public void GetMediaInfo_WebM_Success()
{
diff --git a/tests/Jellyfin.MediaEncoding.Tests/Test Data/Probing/video_ts_no_dimensions.json b/tests/Jellyfin.MediaEncoding.Tests/Test Data/Probing/video_ts_no_dimensions.json
new file mode 100644
index 0000000000..cc45b48fff
--- /dev/null
+++ b/tests/Jellyfin.MediaEncoding.Tests/Test Data/Probing/video_ts_no_dimensions.json
@@ -0,0 +1,81 @@
+{
+ "streams": [
+ {
+ "index": 0,
+ "codec_name": "mpeg2video",
+ "codec_long_name": "MPEG-2 video",
+ "profile": "Main",
+ "codec_type": "video",
+ "codec_tag_string": "[2][0][0][0]",
+ "codec_tag": "0x0002",
+ "pix_fmt": "yuv420p",
+ "level": 8,
+ "id": "0x259",
+ "r_frame_rate": "25/1",
+ "avg_frame_rate": "0/0",
+ "time_base": "1/90000",
+ "start_pts": 6181452600,
+ "start_time": "68682.806667",
+ "disposition": {
+ "default": 0,
+ "dub": 0,
+ "original": 0,
+ "comment": 0,
+ "lyrics": 0,
+ "karaoke": 0,
+ "forced": 0,
+ "hearing_impaired": 0,
+ "visual_impaired": 0,
+ "clean_effects": 0,
+ "attached_pic": 0,
+ "timed_thumbnails": 0
+ }
+ },
+ {
+ "index": 1,
+ "codec_name": "mp2",
+ "codec_long_name": "MP2 (MPEG audio layer 2)",
+ "codec_type": "audio",
+ "codec_tag_string": "[3][0][0][0]",
+ "codec_tag": "0x0003",
+ "sample_fmt": "fltp",
+ "sample_rate": "48000",
+ "channels": 2,
+ "channel_layout": "stereo",
+ "bits_per_sample": 0,
+ "id": "0x25a",
+ "r_frame_rate": "0/0",
+ "avg_frame_rate": "0/0",
+ "time_base": "1/90000",
+ "start_pts": 6181460000,
+ "start_time": "68682.888889",
+ "bit_rate": "256000",
+ "disposition": {
+ "default": 0,
+ "dub": 0,
+ "original": 0,
+ "comment": 0,
+ "lyrics": 0,
+ "karaoke": 0,
+ "forced": 0,
+ "hearing_impaired": 0,
+ "visual_impaired": 0,
+ "clean_effects": 0,
+ "attached_pic": 0,
+ "timed_thumbnails": 0
+ },
+ "tags": {
+ "language": "eng"
+ }
+ }
+ ],
+ "format": {
+ "filename": "http://192.168.1.19:5004/auto/v4",
+ "nb_streams": 2,
+ "nb_programs": 1,
+ "format_name": "mpegts",
+ "format_long_name": "MPEG-TS (MPEG-2 Transport Stream)",
+ "start_time": "68682.806667",
+ "probe_score": 50
+ }
+}
diff --git a/tests/Jellyfin.MediaEncoding.Tests/Test Data/Probing/video_ts_no_dimensions_zero_dar.json b/tests/Jellyfin.MediaEncoding.Tests/Test Data/Probing/video_ts_no_dimensions_zero_dar.json
new file mode 100644
index 0000000000..c249efda3c
--- /dev/null
+++ b/tests/Jellyfin.MediaEncoding.Tests/Test Data/Probing/video_ts_no_dimensions_zero_dar.json
@@ -0,0 +1,83 @@
+{
+ "streams": [
+ {
+ "index": 0,
+ "codec_name": "mpeg2video",
+ "codec_long_name": "MPEG-2 video",
+ "profile": "Main",
+ "codec_type": "video",
+ "codec_tag_string": "[2][0][0][0]",
+ "codec_tag": "0x0002",
+ "sample_aspect_ratio": "0:1",
+ "display_aspect_ratio": "0:1",
+ "pix_fmt": "yuv420p",
+ "level": 8,
+ "id": "0x259",
+ "r_frame_rate": "25/1",
+ "avg_frame_rate": "0/0",
+ "time_base": "1/90000",
+ "start_pts": 6181452600,
+ "start_time": "68682.806667",
+ "disposition": {
+ "default": 0,
+ "dub": 0,
+ "original": 0,
+ "comment": 0,
+ "lyrics": 0,
+ "karaoke": 0,
+ "forced": 0,
+ "hearing_impaired": 0,
+ "visual_impaired": 0,
+ "clean_effects": 0,
+ "attached_pic": 0,
+ "timed_thumbnails": 0
+ }
+ },
+ {
+ "index": 1,
+ "codec_name": "mp2",
+ "codec_long_name": "MP2 (MPEG audio layer 2)",
+ "codec_type": "audio",
+ "codec_tag_string": "[3][0][0][0]",
+ "codec_tag": "0x0003",
+ "sample_fmt": "fltp",
+ "sample_rate": "48000",
+ "channels": 2,
+ "channel_layout": "stereo",
+ "bits_per_sample": 0,
+ "id": "0x25a",
+ "r_frame_rate": "0/0",
+ "avg_frame_rate": "0/0",
+ "time_base": "1/90000",
+ "start_pts": 6181460000,
+ "start_time": "68682.888889",
+ "bit_rate": "256000",
+ "disposition": {
+ "default": 0,
+ "dub": 0,
+ "original": 0,
+ "comment": 0,
+ "lyrics": 0,
+ "karaoke": 0,
+ "forced": 0,
+ "hearing_impaired": 0,
+ "visual_impaired": 0,
+ "clean_effects": 0,
+ "attached_pic": 0,
+ "timed_thumbnails": 0
+ },
+ "tags": {
+ "language": "eng"
+ }
+ }
+ ],
+ "format": {
+ "filename": "http://192.168.1.19:5004/auto/v4",
+ "nb_streams": 2,
+ "nb_programs": 1,
+ "format_name": "mpegts",
+ "format_long_name": "MPEG-TS (MPEG-2 Transport Stream)",
+ "start_time": "68682.806667",
+ "probe_score": 50
+ }
+}