Log video info at the start of encode (#629)
This commit is contained in:
parent
7610b5c7a6
commit
fa738555c8
|
@ -145,6 +145,19 @@ impl Input {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn pixel_format(&self) -> anyhow::Result<String> {
|
||||
const FAIL_MSG: &str = "Failed to get resolution for input video";
|
||||
Ok(match self {
|
||||
Input::VapourSynth(video) => {
|
||||
crate::vapoursynth::pixel_format(video).map_err(|_| anyhow::anyhow!(FAIL_MSG))?
|
||||
}
|
||||
Input::Video(video) => {
|
||||
let fmt = crate::ffmpeg::get_pixel_format(video).map_err(|_| anyhow::anyhow!(FAIL_MSG))?;
|
||||
format!("{:?}", fmt)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn transfer_function(&self) -> anyhow::Result<TransferFunction> {
|
||||
const FAIL_MSG: &str = "Failed to get transfer characteristics for input video";
|
||||
Ok(match self {
|
||||
|
|
|
@ -25,7 +25,7 @@ use crate::broker::{Broker, EncoderCrash};
|
|||
use crate::chunk::Chunk;
|
||||
use crate::concat::{self, ConcatMethod};
|
||||
use crate::ffmpeg::{compose_ffmpeg_pipe, num_frames};
|
||||
use crate::grain::create_film_grain_file;
|
||||
use crate::grain::{create_film_grain_file, TransferFunction};
|
||||
use crate::parse::valid_params;
|
||||
use crate::progress_bar::{
|
||||
finish_progress_bar, inc_bar, inc_mp_bar, init_multi_progress_bar, init_progress_bar,
|
||||
|
@ -1085,6 +1085,22 @@ properly into a mkv file. Specify mkvmerge as the concatenation method by settin
|
|||
None
|
||||
};
|
||||
|
||||
let res = self.input.resolution()?;
|
||||
let fps = self.input.frame_rate()?;
|
||||
let format = self.input.pixel_format()?;
|
||||
let tfc = self.input.transfer_function()?;
|
||||
info!(
|
||||
"Input: {}x{} @ {:.3} fps, {}, {}",
|
||||
res.0,
|
||||
res.1,
|
||||
fps,
|
||||
format,
|
||||
match tfc {
|
||||
TransferFunction::SMPTE2084 => "HDR",
|
||||
TransferFunction::BT1886 => "SDR",
|
||||
}
|
||||
);
|
||||
|
||||
let splits = self.split_routine()?;
|
||||
|
||||
if self.sc_only {
|
||||
|
|
|
@ -269,3 +269,19 @@ pub fn transfer_characteristics(source: &Path) -> anyhow::Result<u8> {
|
|||
|
||||
get_transfer(&mut environment)
|
||||
}
|
||||
|
||||
pub fn pixel_format(source: &Path) -> anyhow::Result<String> {
|
||||
// Create a new VSScript environment.
|
||||
let mut environment = Environment::new().unwrap();
|
||||
|
||||
// Evaluate the script.
|
||||
environment
|
||||
.eval_file(source, EvalFlags::SetWorkingDir)
|
||||
.unwrap();
|
||||
|
||||
let info = get_clip_info(&mut environment);
|
||||
match info.format {
|
||||
Property::Variable => bail!("Variable pixel format not supported"),
|
||||
Property::Constant(x) => Ok(x.name().to_string()),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue