-
Notifications
You must be signed in to change notification settings - Fork 1
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
Preserving quality? #2
Comments
Yeah i think. when i said preserve quality is that its set to use the same bitrate thats downloaded.
|
Alright I'll take another look at the code when I have more time.
So the codec is what encodes or decodes the stream, in our case the audio stream. The container as the name implies contains various streams and maybe extra data. When you use ffmpeg you can re-encode the streams, switch the container, or both. In our case the mp3 file is pretty much the MP3 audio stream with id3 tags you can't have chapters and that's why you switched to using m4b (which is just an extension for audiobooks but really it's an MP4 container). To switch container is lossless (assuming the new container can do all the previous did, which is the case here) but to switch between lossy audio codecs isn't lossless. A lossy compression isn't like a lossless one, with lossy compression you will never be able to get the exact original data just an approximate, how close the approximate will be depends on the efficiency of the compressor you used (AAC is more efficient than MP3) and how much data you allow for the output file (the bitrate). With your current script this is what happens:
I haven't seen that test for audio so not sure how it'd be, but if you re-encode an image 100+ times with JPEG, your new 100+ pictures will look very similar to the ones right before them, but the last one will look hardly like the original (imagine going from red to orange in super small steps, you'd hardly notice the difference between each step but you'll easy tell between red and orange). The idea is lossy compression is an acceptable compromise, but as a rule try to not lossy compress something that was already lossy compressed if you can. Wow that was a lot, I hope you're still here! Actually let's add this too: MP3 is deemed transparent at 192+kb/s, AAC at 128+kb/s and OPUS at 96+kb/s, transparent meaning a human ear will have trouble differentiating the compressed audio from the original one, but that depends on the equipment used to listen and the actual human, hence the + above. ;) |
This part ive always understood in my head i see clear Tupperware containers inside each other, each convert your sticking it in another (so now the original audio is 3 Tupperware's deep and the clear is translucent at best) But what to do when you are me and want m4b? Isnt thia the best option?
This is the part i cant seem to wrap my head around Sorry My windows laptop croaked ive been in panic mode (evenn tho i have 2 macs ...just no windows 'Till Tuesday (i love that band) |
Sorry I don't understand what's your question.
Lossy compression is lossy, you don't retain all the original data. Say you create an MP3 out of a WAV, you're going to lose some data, then you re-compress that into an AAC stream you'll suffer more data loss, and so on. If you do it enough times you'll just have unintelligible garbage at the end. You may think that an audio stream contains or doesn't contain all the words, but it's more complicated that that, we're talking about the clarity/quality of the audio signal. Let's try another example: say you're looking at a painting, you hire someone to copy it but they're no perfect artist so the new painting is about 2% different, then again you make a copy of the copy with another ~2% difference, and so on, there will be a point where it will be very clear that what you're looking at isn't the original painting, depending on the original art, its size, your vision and brain health, etc. maybe it'll be when the copy is 5% different, maybe 20% different... With lossy compression your hope is to keep as high quality you can for as small a size you can. AI can try to bring back some of the lost quality but it'll be fake as it has no actual idea of what was lost, it'll just imagine what it could have been. Note: as it is with generic compression (ex: zip), audio compression doesn't need to be lossy it can be lossless, but that'll take more space. For example you can use FLAC to compress a WAV and then revert it back to the exact original WAV. Let's say an audio album in WAV would take ~600Mb, the same could take 300Mb in FLAC with 0 loss, 180Mb in MP3 or 120Mb in AAC both with some actual loss but likely not perceivable. |
HI Its Me , I fked my account somehow. If something can get screwed up i will figure out how to do it spectacularly! |
MY account says ghost, i am so afraid rn |
ghost usually means the account is gone. |
Visual studio code said it needed a token< I clearly misunderstood the directions and made a business account. |
Hello,
I just found your script and I got interested so I dug a bit.
You say it preserves quality but that doesn't seem to be the case since you are re-encoding from MP3 to AAC, which are both lossy. You keep the bitrate but since it's a different codec I am not sure how meaningful that is, wouldn't it be cleaner to just keep the original audio codec as is and just switch the container?
If you do want to re-encode, it could be interesting to offer the choice of the encoder. For instance for AAC libfdk_aac is a better choice than the regular aac, though not always installed. Others may wish to use something like opus to drop bitrate and save on size while not dropping quality too much.
Thank you!
The text was updated successfully, but these errors were encountered: