2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 03:11:24 +00:00

ffprobe: handle files with empty stream json

This commit is contained in:
asonix 2024-05-20 22:08:54 -05:00
parent 260f9a158a
commit d03cc63d2b
3 changed files with 52 additions and 3 deletions

View file

@ -53,6 +53,7 @@ impl FfMpegStreams {
FfMpegStream::Unknown { codec_name } => { FfMpegStream::Unknown { codec_name } => {
tracing::info!("Encountered unknown stream {codec_name}"); tracing::info!("Encountered unknown stream {codec_name}");
} }
FfMpegStream::Empty {} => {}
} }
} }
@ -135,6 +136,7 @@ enum FfMpegStream {
Audio(FfMpegAudioStream), Audio(FfMpegAudioStream),
Video(FfMpegVideoStream), Video(FfMpegVideoStream),
Unknown { codec_name: String }, Unknown { codec_name: String },
Empty {},
} }
#[derive(Debug, serde::Deserialize)] #[derive(Debug, serde::Deserialize)]

View file

@ -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"
}
}

View file

@ -1,11 +1,11 @@
use crate::formats::{ use crate::formats::{
AlphaCodec, AnimationFormat, ImageFormat, ImageInput, InputFile, InputVideoFormat, Mp4Codec, AlphaCodec, AnimationFormat, ImageFormat, ImageInput, InputFile, InputVideoFormat,
WebmAlphaCodec, WebmCodec, Mp4AudioCodec, Mp4Codec, WebmAlphaCodec, WebmCodec,
}; };
use super::{Discovery, FfMpegDiscovery, PixelFormatOutput}; use super::{Discovery, FfMpegDiscovery, PixelFormatOutput};
fn details_tests() -> [(&'static str, Option<Discovery>); 13] { fn details_tests() -> [(&'static str, Option<Discovery>); 14] {
[ [
( (
"animated_webp", "animated_webp",
@ -151,6 +151,18 @@ fn details_tests() -> [(&'static str, Option<Discovery>); 13] {
frames: None, 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),
}),
),
] ]
} }