Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: I want to convert all my proprietary lossless formats to FLAC (Read 8791 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

I want to convert all my proprietary lossless formats to FLAC

I'm fucking tired of those proprietary formats, and I want the disk space savings and increase compatibility that FLAC offers.

However, I think I'm doing something wrong? I tried doing `ffmpeg -i sample.mkv -acodec flac -vcodec copy flac.mkv` with a DTS track, and my resulting file is 1 GB bigger! And the bit rate changed from input 16 bits to 24 bits.

What are the recommended settings? Someone recommended me to just always use -sample_fmt s16 as it's good "enough" for consumer use.

Re: I want to convert all my proprietary lossless formats to FLAC

Reply #1
I presume it is a lossless DTS-HDMA track? Personally i use eac3to to convert DTS-HDMA to FLAC (or ac3 or aac). You can set the output bitrate bit depth with this program.


Normal DTS is lossy. It would not make much sense to convert it to lossless.
Although i have noticed lossy DTS at 1536kbps is about the same bitrate as lossless FLAC(!!!). I'm thinking about converting 1536kbps DTS tracks to 320bkps AAC, which will save a lot of space.

Re: I want to convert all my proprietary lossless formats to FLAC

Reply #2
ac3to is windows only. And I only do stuff in bulk  :D

And in this specific case, it was a lossy DTS audio track yes.  I totally forgot DTS only was loseless! That explains the increase in size as flac tried to preserve all the information...

And If were you I would just convert to opus 5.1 @ 256 kbps. That should be transparent from the DTS track. If you wish to dowmix to 2 channels I would use opus @ 128 kbps.

I think in my case then I'll just convert DTS lossy tracks to opus, saving space at same quality and increasing compatibility which is my goal.

Re: I want to convert all my proprietary lossless formats to FLAC

Reply #3
I don't think any human can hear the difference between 24bit and 16bit. Even with these very dynamic movie tracks, which tend to be quiet at times.

You will save a lot of space when using 16bit instead of 24bit when using FLAC.

Re: I want to convert all my proprietary lossless formats to FLAC

Reply #4
I'm not a audiophile so excuse my ignorance...but flac is lossless right? So how can it be lossless if it will lose quality converting a 24 bit input to 16 bit?

I agree the difference is likely to be impossible to notice. Is that all the settings I have to bother with flac conversion?

Re: I want to convert all my proprietary lossless formats to FLAC

Reply #5
It isn't, Mark777 was just suggesting you might be able to save some space by converting to 16-bit at the same time. Feel free to keep at 24-bit.

Re: I want to convert all my proprietary lossless formats to FLAC

Reply #6
Your ffmpeg command is correct.

With that, you can transcode from any format to FLAC without loss, if ffmpeg supports decoding of the source format.

As mentioned above, DTS isn't always lossless.

Indeed, your DTS track seems to be lossy, if the resulting FLAC is so much bigger that the original.

The bit depth increase is an indicator for lossy DTS too. In fact, most lossy audio formats actually don't have a bit depth, because their audio data isn't stored in PCM. That bit depth is more a suggestion for the playback decoder or what the original lossless source was. Decoding them to 16-bit may end up in little(!) additional loss due to rounding errors. ffmpeg is smart enough to choose the 24-bit variant of FLAC if that will occur.

This small loss is a little noise at -96dB which is unable to notice unless you crank up the volume knob of your (hopefully 100% noiseless and without any audio processing enabled) sound system until it tears down your home and blows the ears of you and in your neighbourhood. 

So don't bother with that. It is negligible because the loss of the original DTS encoding is so much much bigger than that. There is no real reason to convert lossy formats to bit depts higher than 16-bit. So stay with 16-bit FLAC (or even better: Just keep the DTS track as-is and convert it only if really needed for compatibility reasons) and everything will be fine.

If unsure, try both and compare until you get the conclusion that there is no audible difference. 24-bit is intended for professional audio production purposes but absolutely not useful for domestic use, because you can't listen that loud to hear the difference.

So enter following into your console:

ffmpeg -i sample.mkv -acodec flac -sample_fmt s16 -vcodec copy sample.flac.mkv

and be happy.  :))

If you want high compatibility AND lossless, put the audio track two times into the mkv. One time lossy but compatible, one time lossless but "exotic".

- I abandoned this account since I didn't find a way to delete it -

Re: I want to convert all my proprietary lossless formats to FLAC

Reply #7
It seems that when decoding regular DTS with FFMPEG, there is not enough precision for outputing 24-bit. I encoded a deliberately quiet track with MainConcept TotalCode, and boosted the volume after decoding. The FFMPEG output was very watery and with dropouts (no more than 16-17 bits), while old Foobar2000 decoder 0.3.x and earlier (basded on libdts/libdca) delivered 24 good bits with the dither noise and music continuous uninterrupted.

Similar thing happens with AC-3. There is an old complaint about it. I make no claims for whether this dynamic range is needed, but an observation that that ffmpeg doesn't have it, and a comparison between 16 and 24 bits cannot be made.

But DTS is an old format with lots of software capable of playing it, as well as consumer devices. You can also cut it without re-encoding if necessary easily. Only AC-3 or perhaps MP3 would offer greater compatibility. There is nothing to be gained from transcoding.

Re: I want to convert all my proprietary lossless formats to FLAC

Reply #8
With that, you can transcode from any format to FLAC without loss, if ffmpeg supports decoding of the source format
AND the FLAC format supports the signal. Floating-point is out.

(AFAIreadsomewhere - but the ffmpeg documentation sucks on this matter - ffmpeg can encode any signal within the format specification, otherwise you have a second constraint.)


Re: I want to convert all my proprietary lossless formats to FLAC

Reply #9
Thanks guys! I'll just use `-sample_fmt s16` and don't think much about it! I'm now using a profile with MakeMKV so I remux my stuff directly to FLAC.

Re: I want to convert all my proprietary lossless formats to FLAC

Reply #10
It seems that when decoding regular DTS with FFMPEG, there is not enough precision for outputing 24-bit. I encoded a deliberately quiet track with MainConcept TotalCode, and boosted the volume after decoding. The FFMPEG output was very watery and with dropouts (no more than 16-17 bits), while old Foobar2000 decoder 0.3.x and earlier (basded on libdts/libdca) delivered 24 good bits with the dither noise and music continuous uninterrupted.

Similar thing happens with AC-3. There is an old complaint about it. I make no claims for whether this dynamic range is needed, but an observation that that ffmpeg doesn't have it, and a comparison between 16 and 24 bits cannot be made.

But DTS is an old format with lots of software capable of playing it, as well as consumer devices. You can also cut it without re-encoding if necessary easily. Only AC-3 or perhaps MP3 would offer greater compatibility. There is nothing to be gained from transcoding.

Make sure that your command is really correct. FFmpeg can decode to 24bits pcm just fine. It just defaults to 16 bit by default if you do specify nothing.

Re: I want to convert all my proprietary lossless formats to FLAC

Reply #11
Just leave lossy DTS files as they are.  You gain nothing in disc space by re-encoding them.  (Last time I checked, .dts file could not be tagged.  If you need to tag them, put them in a WAV wrapper and then pass them through FLAC -- then you can tag them but they will increase slightly in size.  Audioumuxer's 'Convert DTS/AC3 to SPDIF/WAV ' option does this trick.)