advplyr / audiobookshelf

Self-hosted audiobook and podcast server
https://audiobookshelf.org
GNU General Public License v3.0
6.17k stars 431 forks source link

[Enhancement]: Filter by file format (codec) #2086

Open iconoclasthero opened 11 months ago

iconoclasthero commented 11 months ago

Describe the feature/enhancement

Use Case: I have two libraries, the current one is .opus and the legacy one is .mp3. It is possible there are some other formats mixed in by mistake (always seems to happen with any large collection) and the .opus ones are of a better sound quality (because they're not using an > 35 year old codec). I would like to be able to sort the library by format so that if there's something from my legacy collection that needs to be listened to, I can try to get a better quality copy.

slyfoxgh commented 10 months ago

I have some m4b books that are split into parts and multi-track filter does not help to separate mp3 from m4b. I would like to see a filter by codec option.

nichwall commented 10 months ago

Should something be included if any file for the item has the codec/extension, or all files have the codec/extension?

I think any is the better option so if one file for the item is different it can be adjusted, but that would add extra columns to the file list to specify which files are which codec (codec does not equal extension).

The (potentially) better option would be to have the filter only be for all, and then have a filter which is just "items with inconsistent format/codec/bitrate/etc", but that would also require changes to the backend.

iconoclasthero commented 10 months ago

In the OP, the use case was whole books (i.e., all files) in whatever codec and/or extension. In my collection, there aren't likely to be files that have a mismatch b/w the codec and the extension, however, I could see that happening with that of others. My main concern is to identify the books in which all the files are .mp3 as they're lower quality than my .opus files and that was the primary motivation. I can then go back through and try to update/upgrade the mp3 files or get something to replace it when I want to go to listen to one of those older books.

I think out of the options nichwall presented, the (potentially) better solution of having 2 different ways to identify the underlying files would be the most useful. My second choice would be any. As it so happens, I ran into an issue yesterday where I'd converted mp3s to opus, transferred the book into the library and forgot to delete the mp3s. In that case, the most useful would be if any files are not opus.

I'm not making much sense here so let me list: 1) filter for all and a filter for inconsistent format/codec/bitrate/etc. To this, I think it would be useful to be able to filter for the negative, i.e., I want to see which books/files are not of a specific file type/codec. 2) if Any of the files are or are not of the specified codec...but this would only apply to audio (and perhaps video) files so that it wouldn't alert me to .jpgs, .pngs., .nfos, .jsons, etc., I could see video being streamed as audio-only in the case of e.g., The Great Courses or The Simpsons.
3) if all the files are or are not of the specified type.

iconoclasthero commented 10 months ago

The extension issue is a bit of a concern because [in linux] .mp3 and .MP3 aren't the same and .ogg could be vorbis or opus or flac. mp4 can hold a bunch of different codecs, so i guess it would need to be checked with ffprobe and then the codec reported.

iconoclasthero commented 10 months ago

I have some m4b books that are split into parts and multi-track filter does not help to separate mp3 from m4b. I would like to see a filter by codec option.

If you have .m4bs that have been split into chapters (i.e., they do not have embedded chapter information w/ multiple chapters per file) then what I was told on #ffmpeg was that they should be named m4a. I just looked into it and it is apparently not super clear what is what and depending on your sources, who knows how the extensions have been selected.

That said, if I were to keep aac-encoded audiobook files that are e.g., a chapter or part/file and there is no embedded chapterization, I'd rename them .m4a so as to distinguish them from multi-part/chapter files with embedded chapterization. Right now, my chapter splitting script saves the split out chapters as .m4a to make it easier to distinguish between the two.

nichwall commented 10 months ago

1) filter for all and a filter for inconsistent format/codec/bitrate/etc. To this, I think it would be useful to be able to filter for the negative, i.e., I want to see which books/files are not of a specific file type/codec.

When I say filter for inconsistencies, I meant only within library items, not with the rest of the library since that would be handled by other filters. So like if a book has all mp3 files, but one of the files is a different bitrate from the others, or one of the files is ogg instead of mp3 it would show up in the filter.

2/3

Then to those points, it would just be a filter for whether all files for the item are or are not an extension/codec.

iconoclasthero commented 10 months ago

I meant those in order of preference if they could not all be handled. I think ultimately both my original (all files) idea as well as inconsistent audio/video files within a book UUID (your idea), would be useful. The use I have for it right now would be best served by finding any mp3s, which would pick up the instance in which I forgot to delete the source files after conversion as well as my lower-quality .mp3 files.

(And yes, I'm well aware of the pitfalls of lossy > lossy! :)