dcherednik / atracdenc Goto Github PK
View Code? Open in Web Editor NEWDirty implementation of ATRAC1, ATRAC3 encoder
License: GNU Lesser General Public License v2.1
Dirty implementation of ATRAC1, ATRAC3 encoder
License: GNU Lesser General Public License v2.1
Library is here:
Hello @dcherednik and thanks for your great work.
I've been using your precious encoder in one of my side project for a while (here's the link if you're curious: https://github.com/cybercase/webminidisc). One of my users reported that the atracdenc encoder is hanging during conversion; see cybercase/webminidisc#24
After a quick investigation I've been able to reproduce and debug the issue. Basically the encoder ends up into an infinite loop here
atracdenc/src/atrac/atrac3_bitstream.cpp
Line 196 in 40d971c
Using the debugger I see that at every iteration, the loop ends up into line 218 and the minShift
variable is always updated with the same value.
e.g. if maxShift
= 15.00, minShift
= 15.02, shift
= 15.01 then the new minShift = shift + 0.01
value will be equal to the previous, at every iteration. Note that maxShift
can actually be less than minShift
... I'm not sure if this is the problem.
To reproduce the issue you can use this wav file: https://www.dropbox.com/s/94jwklx6xi2uqgh/broken.wav?dl=0
and this command line atracdenc -e atrac3 -i broken.wav -o broken.oma --bitrate 64
I would have fixed the problem myself if I knew more about the code and the algorithm. However, just let me know if there's anything I can do to help.
According to
Uploading of SP tracks (ATRAC1) to Minidisc devices over NetMD is possible. @brenthuisman and @vuori use this in the Linux-Minidisc builds
However your converter generates .aea extensions instead of WAV containers. Can you implement also WAV extensions? So input is WAV PCM and output is WAV ATRAC1. The result can be given a different filename. I presume it's more than just renaming the .aea extension.
There is no option to select LP2 mode in the latest release, only normal and LP4.
We have the decoder:
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/atrac3plus.c
And an encoder (however not open-source) and it only accepts 48KHZ WAV not standard 44.1 KHZ
Can you make an open source encoder with selectable options?
According to https://hydrogenaud.io/index.php?topic=11302.msg114292#msg114292
There is an option to have ATRAC1 mono. But we cannot select that bitrate now in ATRACDENC, or can we already?
ATRAC1 Stereo (292 kbps)
ATRAC1 Mono (146 kbps)
Hi,
as of ed96293
there is MS Windows support. Can your provide an exe file that we can use to encode .aea?
Thanks
This feature is mandatory for LP4 mode
Hello there,
First of all - many thanks for this project. I am hopeful of using it to transcode audio into 292kbit ATRAC and use the linux-minidisc to upload to a NetMD recorder.
To build it (on OSX) I had to add the -DCMAKE_CXX_FLAGS=-std=c++11
flag to cmake. It'd be helpful to others to add that to the readme.
Now I try to encode a file. Here's some info about my setup:
$ ffmpeg -version
ffmpeg version 3.1.3 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.31)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libfaac --enable-libfdk-aac --enable-libx265 --disable-lzma --enable-nonfree --enable-vda
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
$ brew info libsndfile
libsndfile: stable 1.0.26 (bottled)
$ ffmpeg -i input.wav
...
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from 'input.wav':
..
Duration: 00:07:27.67, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
Here goes the encode...
$ ./atracdenc --encode -i input.wav -o output.atrac
Input file: input.wav
Channels: 2
SampleRate: 44100
TotalSamples: 0x7fff504b9658
/ 99% done
Done
How's that file?
$ file output.atrac
output.atrac: Applesoft BASIC program data
Hmmm, 'file' is wrong. How about ffmpeg?
$ ffmpeg -acodec atrac1 -i output.atrac
...
[aac @ 0x7ff9b1002600] Format aac detected only with low score of 1, misdetection possible!
But you said in the readme it might misdetect the file. I'll try forcing atrac1...
$ ffmpeg -acodec atrac1 -i output.atrac
...
[aac @ 0x7ff713000000] Format aac detected only with low score of 1, misdetection possible!
[atrac1 @ 0x7ff713000c00] Unsupported number of channels: 0
[aac @ 0x7ff713000000] Failed to open codec in av_find_stream_info
[atrac1 @ 0x7ff713000c00] Unsupported number of channels: 3
[aac @ 0x7ff713000000] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #0.0 : 4.0
Input #0, aac, from 'output.atrac':
Duration: 00:05:51.64, bitrate: 372 kb/s
Stream #0:0: Audio: atrac1, 48000 Hz, 4 channels, fltp, 372 kb/s
At least one output file must be specified
4 channels @ 48khz? This is not my audio :(
What about sndfile?
$ sndfile-info output.atrac
Error : Not able to open input file output.atrac.
File : output.atrac
Length : 16351488
File contains data in an unknown format.
Can you tell me what I'm doing wrong?
First, this is an amazing project - I can't even start to understand some of the work you've done here!
One issue I've found is a slight 'hiss' in the silence of tracks. Is this something you know about, and is there any possible fix for it?
Is not possible yet. It's only possible to decode Atrac1, not Atrac 3 or Atrac 3 Plus.
Decoding source
ATRAC3 Plus https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/atrac3plus.c
ATRAC3 https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/atrac3.c
Or use the one from VGMStream
Haven't looked closely at the code but at least pffft is usually quite a bit faster than kissfft so might be worth looking at, the license should work as far as I can tell.
I see you have two ATRAC3 dev branches. Which branch do you recommend for ATRAC3 use?
Hi,
I try to use ATRAC3 encode from 44Khz 16bit WAV file. I first encode successfully using ATRAC1 but I got an assertion on line 426 of atrac/atrac3_bitstream.cpp:
assert(channel.size() <= Params.FrameSz/2);
with channel.size() is equal to 781 and Params.FrameSz equal to 96.
More, where can I found the specification of the algorithm implemented in order to help?
thanks
atracdenc --encode=atrac3 currently generates files with a 96 byte header starting with 'EA3\x01
There is at least one other container that can hold these AT3 streams: RIFF/WAVE with content-type==0x0270
Here is a decoder that can read both of these two filetypes/containers for atrac3 which is usefult to compare the mappings between fields in the two cotainers:
https://github.com/GrapheneCt/ElevenMPV-A/blob/master/ElevenMPV-A/source/audio/at3.cpp
One application that only handles the RIFF/WAVE format but not the EA3 format is the XMB on PS3 systems.
I have a simple python script: https://github.com/sahlberg/pop-fe/blob/master/riff.py that reads a EA3 file generated by atracdenc and generates a RIFF/WAVE file that PS3 XMB understands.
Maybe we can get a flag in atracdenc to select output file format?
(Also maybe drop the warnings about poor audio quality for atrac3. Everyone of us using atracdecn to encode the audio into AT3 for PSP/PS3 audio support using your tool think the audio is excellent!)
Your tool is so very very useful. Thanks for writing atracdenc! Thankyou.
I can provide example files of EA3 files and the corresponding RIFF/WAVE files. It is just a matter of swapping one container for another but keeping the raw data unchanged.
To do this conversion from EA3 to RIFF/WAVE, to compare the files you can
1, download https://github.com/sahlberg/pop-fe/blob/master/riff.py
2, atracdenc --encode=atrac3 -i file.waw -o file.tmp
3, python3 ./riff.py create file.tmp SND0.AT3
(SND0.AT3 is what the PS3 XMB want this file to be called)
Hello !
First of all I want to thank you for this great idea of ATRAC encoder.
I will start with one important information : I am a big noob !!! Then sorry if I am asking stupid questions.
When I follow your instruction and try to compile your software, I have error message that I don't understand after the cmake ../ command
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
LIBSNDFILE_INCLUDE_DIR (ADVANCED)
used as include directory in directory /home/yugo/Documents/atracdenc-master/src
used as include directory in directory /home/yugo/Documents/atracdenc-master/src
used as include directory in directory /home/yugo/Documents/atracdenc-master/src
used as include directory in directory /home/yugo/Documents/atracdenc-master/src
used as include directory in directory /home/yugo/Documents/atracdenc-master/src
used as include directory in directory /home/yugo/Documents/atracdenc-master/src
used as include directory in directory /home/yugo/Documents/atracdenc-master/src
used as include directory in directory /home/yugo/Documents/atracdenc-master/src
SNDFILE_LIBRARY (ADVANCED)
linked by target "atracdenc" in directory /home/yugo/Documents/atracdenc-master/src
I am using linux mint.
Could you please help ? I attache both output files.
Thank you a lot.
Regards.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.