Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Tom's lossless Audio Kompressor (TAK) #41

Open
mrlioncub opened this issue Apr 4, 2017 · 9 comments
Open

Support Tom's lossless Audio Kompressor (TAK) #41

mrlioncub opened this issue Apr 4, 2017 · 9 comments

Comments

@mrlioncub
Copy link

Please add support format Support Tom's lossless Audio Kompressor (TAK)
http://wiki.hydrogenaud.io/index.php?title=TAK

@SokoloffA
Copy link
Member

You mean support for input or output files?

@mrlioncub
Copy link
Author

mrlioncub commented Apr 6, 2017

For input. But it would be good for output.

@SokoloffA
Copy link
Member

Sorry, but I can't find decoder program for tak for linux. Only takc.exe.

@mrlioncub
Copy link
Author

ffmpeg can demux, decode and parse TAK since commit d7a473926504e2acfa6ae3bead0938e1f4e03441:[1]. First official release that supports TAK decoding is 1.1.

@SokoloffA
Copy link
Member

The ffmpeg is a crap.

If you use STDOUT as a output file ffmpeg returns incorrect file size and duration in the WAV header. How to check (You will need the following programs: sox, mediainfo, flac and ffmpeg)
1.1 Create the CD quality audio file

$ rec -t raw -r 44100 -b 16 -e unsigned  -c 2 /dev/urandom cd.wav trim 0 10

Convert to file and to STDOUT

$ ffmpeg -i cd.wav -f wav ffmpeg-file.wav
$ ffmpeg -i cd.wav -f wav - > ffmpeg-stdout.wav

Check

$ hexdump -n 8 -x ffmpeg-file.wav 
0000000    4952    4646    eae6    001a                                
0000008
$ hexdump -n 8 -x ffmpeg-stdout.wav 
0000000    4952    4646    ffff    ffff                                
0000008

This creates problems, but not fatal. I even decided to write woraround. But when I found second glitch, I decided that ffmpeg not for me at all.

ffmpeg silently corrupts the quality of the audio. How to check. You will need the following programs: sox, mediainfo, flac and ffmpeg.

2.1. Create HD audio file

$ rec -t raw -r 192000 -b 24 -e unsigned  -c 2 /dev/urandom 24x192.wav trim 0 10

2.2 Encode it to FLAC

$ flac 24x192.wav -o 24x192.flac 

2.3 Check input files

$ mediainfo 24x192.wav
General
Complete name                            : 24x192.wav
Format                                   : Wave
File size                                : 11.0 MiB
Duration                                 : 10 s 0 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 9 216 kb/s

Audio
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 : 00001000-0000-0100-8000-00AA00389B71
Duration                                 : 10 s 0 ms
Bit rate mode                            : Constant
Bit rate                                 : 9 216 kb/s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 192 kHz
Bit depth                                : 24 bits
Stream size                              : 11.0 MiB (100%)



$ mediainfo 24x192.flac
General
Complete name                            : 24x192.flac
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
File size                                : 3.61 MiB
Duration                                 : 10 s 0 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 3 032 kb/s

Audio
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
Duration                                 : 10 s 0 ms
Bit rate mode                            : Variable
Bit rate                                 : 3 025 kb/s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 192 kHz
Bit depth                                : 24 bits
Stream size                              : 3.61 MiB (100%)
Writing library                          : libFLAC 1.3.2 (UTC 2017-01-01)

Both have sampling rate 192 kHz and bit depth 24 bits.

2.4 Decode using flac

flac 24x192.flac -d -o flac.wav

2.5 Decode using ffmpeg

ffmpeg -i 24x192.flac  ffmpeg.wav

2.6 Check:
Pay attention, how much file sizes are differ.

ls -l flac.wav ffmpeg.wav 
-rw-rw-r-- 1 sokoloff sokoloff  7680102 апр 12 19:20 ffmpeg.wav
-rw-rw-r-- 1 sokoloff sokoloff 11520044 апр 12 19:08 flac.wav

As you can see, ffmpeg loose half of bits, instead 24 we have 16.

$  mediainfo flac.wav 

General
Complete name                            : flac.wav
Format                                   : Wave
File size                                : 11.0 MiB
Duration                                 : 10 s 0 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 9 216 kb/s

Audio
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 : 1
Duration                                 : 10 s 0 ms
Bit rate mode                            : Constant
Bit rate                                 : 9 216 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 192 kHz
Bit depth                                : 24 bits
Stream size                              : 11.0 MiB (100%)



$ mediainfo ffmpeg.wav
General
Complete name                            : ffmpeg.wav
Format                                   : Wave
File size                                : 7.32 MiB
Duration                                 : 10 s 0 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 6 144 kb/s
Writing application                      : Lavf57.41.100

Audio
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 : 00001000-0000-0100-8000-00AA00389B71
Duration                                 : 10 s 0 ms
Bit rate mode                            : Constant
Bit rate                                 : 6 144 kb/s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 192 kHz
Bit depth                                : 16 bits
Stream size                              : 7.32 MiB (100%)

@richardpl
Copy link

richardpl commented Apr 14, 2017

FFmpeg is not crap, you just do not know how to use it.

By default ffmpeg will not pick decoding parameters that are present when encoding.

So decoding 24bit file to .wav without any parameters will not give lossless output.

@SokoloffA
Copy link
Member

@richardpl

OK, you're right. The following command creates the correct file.

ffmpeg -i 24x192.flac -acodec pcm_s24le  ffmpeg.wav

Do you know, ffmpeg has a key like "keep maximum quality" or some?
Or I have to choose settings for each time?

@SokoloffA
Copy link
Member

@richardpl
As I can see, you are developer of ffmpeg.
Maybe will be good if ffmpeg will keep maximum of quality by default. IMHO current behavior is non intuitive and even dangerous. The Internet is full of tips which offers ffmpeg -i foo.ape foo.wav.

@cg00001
Copy link

cg00001 commented Jun 30, 2023

While reading the above I was trying my Arch Linux audio converters -I had a 300 MB tak file.
FF Multi Converter converted tak to flac easily.
Package: ffmulticonverter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants