From d03cc63d2bad6d5732f3c56dd4c0afda0d6f8aef Mon Sep 17 00:00:00 2001 From: asonix Date: Mon, 20 May 2024 22:08:54 -0500 Subject: [PATCH] ffprobe: handle files with empty stream json --- src/discover/ffmpeg.rs | 2 ++ .../ffmpeg/ffprobe_6_0_mov_details.json | 35 +++++++++++++++++++ src/discover/ffmpeg/tests.rs | 18 ++++++++-- 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 src/discover/ffmpeg/ffprobe_6_0_mov_details.json diff --git a/src/discover/ffmpeg.rs b/src/discover/ffmpeg.rs index 705007c..17867cc 100644 --- a/src/discover/ffmpeg.rs +++ b/src/discover/ffmpeg.rs @@ -53,6 +53,7 @@ impl FfMpegStreams { FfMpegStream::Unknown { codec_name } => { tracing::info!("Encountered unknown stream {codec_name}"); } + FfMpegStream::Empty {} => {} } } @@ -135,6 +136,7 @@ enum FfMpegStream { Audio(FfMpegAudioStream), Video(FfMpegVideoStream), Unknown { codec_name: String }, + Empty {}, } #[derive(Debug, serde::Deserialize)] diff --git a/src/discover/ffmpeg/ffprobe_6_0_mov_details.json b/src/discover/ffmpeg/ffprobe_6_0_mov_details.json new file mode 100644 index 0000000..44a3682 --- /dev/null +++ b/src/discover/ffmpeg/ffprobe_6_0_mov_details.json @@ -0,0 +1,35 @@ +{ + "programs": [ + + ], + "streams": [ + { + "codec_name": "hevc", + "width": 1920, + "height": 1080, + "pix_fmt": "yuv420p10le", + "nb_read_frames": "187", + "side_data_list": [ + { + + } + ] + }, + { + "codec_name": "aac", + "nb_read_frames": "135" + }, + { + + }, + { + + }, + { + + } + ], + "format": { + "format_name": "mov,mp4,m4a,3gp,3g2,mj2" + } +} diff --git a/src/discover/ffmpeg/tests.rs b/src/discover/ffmpeg/tests.rs index 73d994d..d8f5867 100644 --- a/src/discover/ffmpeg/tests.rs +++ b/src/discover/ffmpeg/tests.rs @@ -1,11 +1,11 @@ use crate::formats::{ - AlphaCodec, AnimationFormat, ImageFormat, ImageInput, InputFile, InputVideoFormat, Mp4Codec, - WebmAlphaCodec, WebmCodec, + AlphaCodec, AnimationFormat, ImageFormat, ImageInput, InputFile, InputVideoFormat, + Mp4AudioCodec, Mp4Codec, WebmAlphaCodec, WebmCodec, }; use super::{Discovery, FfMpegDiscovery, PixelFormatOutput}; -fn details_tests() -> [(&'static str, Option); 13] { +fn details_tests() -> [(&'static str, Option); 14] { [ ( "animated_webp", @@ -151,6 +151,18 @@ fn details_tests() -> [(&'static str, Option); 13] { frames: None, }), ), + ( + "mov", + Some(Discovery { + input: InputFile::Video(InputVideoFormat::Mp4 { + video_codec: Mp4Codec::H265, + audio_codec: Some(Mp4AudioCodec::Aac), + }), + width: 1920, + height: 1080, + frames: Some(187), + }), + ), ] }