ffmpeg_cmdline_utils/ffmpeg_error_kind.rs
1use serde::Deserialize;
2use serde::Serialize;
3use thiserror::Error;
4
5use crate::*;
6
7/// Various causes of failure for ffmpeg/ffprobe functions.
8#[derive(Error, Debug, Clone, Serialize, Deserialize)]
9pub enum FfmpegError {
10 /// Ffmpeg/Ffprobe command was not found. Make sure Ffmpeg is installed and can be found on the command line.
11 #[error("ffmpeg/ffprobe file not found. Make sure ffmpeg/ffprobe are installed and visible on the command line")]
12 FfmpegNotFound,
13
14 /// Io error occurred while executing Ffmpeg/Ffprobe command
15 #[error("Ffmpeg IO error")]
16 Io(String),
17
18 /// Ffmpeg/Ffprobe returned a nonzero exit code. Because ffmpeg sometimes prints long error strings
19 /// to stderr, The resulting string contains the first few hundred characters of the error message.
20 #[error("Internal Ffmpeg Failure: {0}")]
21 FfmpegInternal(String),
22
23 /// Failed to interpret Ffmpeg/Ffprobe output as a utf8-string.
24 #[error("utf8 parsing/conversion failure")]
25 Utf8Conversion,
26
27 /// When using Ffprobe to obtain the resolution of the video file before beginning the
28 /// decoding process, either the X or Y dimensions was zero.
29 /// Note: This sometimes occur when attempting to decode frames from an audio file.
30 #[error("Ffmmpeg decoded no frames from the video")]
31 InvalidResolution,
32
33 /// Failed to obtain video information.
34 #[error("Failed to get video properties")]
35 Info(#[from] VideoInfoError),
36
37 /// Other
38 #[error("Ffmpeg/ffprobe error: {0}")]
39 Other(String),
40}