HydrogenAudio

Lossless Audio Compression => FLAC => Topic started by: batemenj on 2020-09-16 00:07:09

Title: How to convert 2-channel DTS to FLAC on Linux command line
Post by: batemenj on 2020-09-16 00:07:09
Hi
I need to convert DTS and PCM 2-Channel Audios to FLAC on Linux (command line) using FLAC (https://xiph.org/flac/) 1.3.3 (not with in-built FLAC of ffmpeg).

Code: [Select]
test $ ffmpeg -version
ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)

test $ flac --version
flac 1.3.3
test $

So I tried various ways and all of them throw errors (even with "-s" option)

Code: [Select]
ffmpeg -i Test.dts -f wav - | flac - -o Test.flac

ffmpeg -i title_t01.mkv -vn -map 0:a:0 -f wav - | flac -s --ignore-chunk-sizes -8 - -o title.flac

ffmpeg -i title_t01.mkv -vn -map 0:a:0 -f wav - | flac -8 - -o title.flac
Getting various errors like - (even with different compression levels)

Code: [Select]
WARNING: unexpected EOF; expected 1073741823 samples, got 549924864 samples
WARNING: skipping unknown chunk 'LIST' (use --keep-foreign-metadata to keep)
WARNING: 'data' chunk has non-zero size, using --ignore-chunk-sizes is probably a bad idea
Tried without ffmpeg -
Code: [Select]
test $   flac test1.dts -o test1_direct.flac

flac 1.3.3
Copyright (C) 2000-2009  Josh Coalson, 2011-2016  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

ERROR: for encoding a raw file you must specify a value for --endian, --sign, --channels, --bps, and --sample-rate
Type "flac" for a usage summary or "flac --help" for all options
test $

Could anyone please advise proper CLI method on Linux?  Many thanks!!
Title: Re: How to convert 2-channel DTS to FLAC on Linux command line
Post by: Porcus on 2020-09-16 12:41:15
The "raw file" option for flac.exe is absolutely not what you want; that is for a "general purpose compressor" like 7-zip or winrar (i.e. not as an "audio codec"), so forget about that.

What do you get if you just ask ffmpeg to encode to wav or flac?
Title: Re: How to convert 2-channel DTS to FLAC on Linux command line
Post by: Rollin on 2020-09-16 12:42:43
Try -f w64 instead of -f wav. Also try to add -map_metadata -1. And when reencoding lossy  dts try to add -c:a pcm_s24le or -c:a pcm_s16le
Title: Re: How to convert 2-channel DTS to FLAC on Linux command line
Post by: Octocontrabass on 2020-09-16 22:54:06
I need to convert DTS
Are you converting DTS-HD MA, or one of the many lossy flavors of DTS? You could end up with a bigger file than the input audio if it's ordinary lossy DTS. That's fine if you're converting it for a player that doesn't support whichever flavor of DTS, but it doesn't make much sense otherwise.

using FLAC (https://xiph.org/flac/) 1.3.3 (not with in-built FLAC of ffmpeg).
What's wrong with the built-in FLAC encoder in ffmpeg?