Dont transcode CUE tracks to MP3, just copy in original format - *much*

faster
This commit is contained in:
Craig Drummond 2022-03-13 11:32:35 +00:00
parent 649ce31907
commit 4c40a0b41b
3 changed files with 7 additions and 5 deletions

View File

@ -180,8 +180,8 @@ CUE files
If the anlyser encounters an audio file with a matching CUE file (e.g.
`album.flac` and `album.cue` in same folder) then it will attempt to analyse the
individual tracks contained within. To do this the analyser uses `ffmpeg` to
create temporary 128k MP3 files of each track. (These temporary files are
removed afterwards).
create temporary files of each track, which are then analysed. (These temporary
files are removed afterwards).
Exclude folders

View File

@ -192,8 +192,9 @@ pub fn analyze_cue_streaming(tracks: Vec<cue::CueTrack>,) -> BlissResult<Receive
log::debug!("Extracting '{}'", track_path);
if cue_track.duration<last_track_duration {
match Exec::cmd("ffmpeg").arg("-i").arg(&audio_path).arg("-b:a").arg("128k")
match Exec::cmd("ffmpeg").arg("-i").arg(&audio_path)
.arg("-ss").arg(&cue_track.start.hhmmss()).arg("-t").arg(&cue_track.duration.hhmmss())
.arg("-c").arg("copy")
.arg(String::from(tmp_file.to_string_lossy()))
.stderr(NullFile)
.join() {
@ -201,8 +202,9 @@ pub fn analyze_cue_streaming(tracks: Vec<cue::CueTrack>,) -> BlissResult<Receive
Err(e) => { log::error!("Failed to call ffmpeg. {}", e); }
}
} else {
match Exec::cmd("ffmpeg").arg("-i").arg(&audio_path).arg("-b:a").arg("128k")
match Exec::cmd("ffmpeg").arg("-i").arg(&audio_path)
.arg("-ss").arg(&cue_track.start.hhmmss())
.arg("-c").arg("copy")
.arg(String::from(tmp_file.to_string_lossy()))
.stderr(NullFile)
.join() {

View File

@ -49,7 +49,7 @@ pub fn parse(audio_path:&PathBuf, cue_path:&PathBuf) -> Vec<CueTrack> {
Some((_, start)) => {
let mut track_path = audio_path.clone();
let ext = audio_path.extension().unwrap().to_string_lossy();
track_path.set_extension(format!("{}{}{}.mp3", ext, MARKER, resp.len()+1));
track_path.set_extension(format!("{}{}{}", ext, MARKER, resp.len()+1));
let mut ctrack = CueTrack {
audio_path: audio_path.clone(),
track_path: track_path,