[O] Set number of threads
This commit is contained in:
@@ -1,14 +1,14 @@
|
|||||||
processes = 2
|
processes = 6
|
||||||
|
|
||||||
[[encoders]]
|
[[encoders]]
|
||||||
name = "H264 Full VBR35"
|
name = "H264 Full VBR35"
|
||||||
cmd = "ffmpeg -i {{INPUT}} -nostdin -c:v h264_nvenc -cq:v 35 -rc:v vbr -c:a aac -pix_fmt yuv420p -color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart {{OUTPUT}}"
|
cmd = "ffmpeg -i {{INPUT}} -nostdin -c:v h264_nvenc -cq:v 35 -rc:v vbr -c:a libmp3lame -pix_fmt yuv420p -color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart {{OUTPUT}}"
|
||||||
suffix = "h264-vbr35.mp4"
|
suffix = "h264-vbr35.mp4"
|
||||||
|
|
||||||
[[encoders]]
|
#[[encoders]]
|
||||||
name = "AV1 Full CRF38"
|
#name = "AV1 Full CRF38"
|
||||||
cmd = "ffmpeg -i {{INPUT}} -nostdin -c:v libsvtav1 -crf 38 -c:a aac -pix_fmt yuv420p -color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart {{OUTPUT}}"
|
#cmd = "ffmpeg -i {{INPUT}} -nostdin -c:v libsvtav1 -crf 38 -c:a libmp3lame -pix_fmt yuv420p -color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart {{OUTPUT}}"
|
||||||
suffix = "av1-crf38.mp4"
|
#suffix = "av1-crf38.mp4"
|
||||||
|
|
||||||
#[[encoders]]
|
#[[encoders]]
|
||||||
#name = "x264 Full CRF32"
|
#name = "x264 Full CRF32"
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use std::io::{BufReader};
|
|||||||
use xdg_mime::{SharedMimeInfo};
|
use xdg_mime::{SharedMimeInfo};
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
|
use rayon::ThreadPoolBuilder;
|
||||||
use serde::{de, ser};
|
use serde::{de, ser};
|
||||||
use walkdir::{WalkDir, DirEntry};
|
use walkdir::{WalkDir, DirEntry};
|
||||||
use crate::encoder::Encoders;
|
use crate::encoder::Encoders;
|
||||||
@@ -103,6 +104,10 @@ impl Generator {
|
|||||||
|
|
||||||
/// Process a directory
|
/// Process a directory
|
||||||
pub fn encode_dir(&self, dir: &PathBuf) -> Result<()> {
|
pub fn encode_dir(&self, dir: &PathBuf) -> Result<()> {
|
||||||
|
// Set number of threads
|
||||||
|
ThreadPoolBuilder::new().num_threads(self.encoders.processes).build_global()?;
|
||||||
|
info!("Activating {} threads", self.encoders.processes);
|
||||||
|
|
||||||
// Found file
|
// Found file
|
||||||
let videos: Vec<PathBuf> = self.list_video_files(dir).collect();
|
let videos: Vec<PathBuf> = self.list_video_files(dir).collect();
|
||||||
info!("Found {} videos", videos.len());
|
info!("Found {} videos", videos.len());
|
||||||
|
|||||||
Reference in New Issue
Block a user