Skip to main content
Topic: What container format? (Read 578 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

What container format?

I want to reorganize my collection of audiobooks and I'm at a loss when it comes to picking the right container format.

As for the codec, I decided to use Opus. I know that's a lossy process, but most audiobooks are only speech so 128kB/vbr should do. An entire album will be converted into a single Opus file, plus a cue sheet. There are also album covers to be added.

I've successfully done that with mka: single audio stream with chapters and cover art. The file opens just fine in Foobar, and all chapters show up as tracks. Each track can be selected and plays instantly. Perfect.


I can't find any audio player running under Linux (which I mostly use and currently migrate to) to handle these mka just like Foobar does. Most players don't even open mka, others don't show the chapters/tracks. And the cover art I haven't even tested.

Now I wonder if there is a better choice. Other containers I know are flac and ogg, but after some googling I have still no clue if they support opus/chapters/artwork and work across different players.

I know there's Wine, but I'd prefer to avoid it and it would only be the totally-worst-case solution.

Re: What container format?

Reply #1
What about mpv?  It's technically a video player.  You can use it from a gui or command line.  The album artwork will open as the video, or you can play it as audio only. 

Re: What container format?

Reply #2
I've tried mpv and also vlc. While they do work and handle chapters, navigating and track selection are subpar.
Imho, it's not a real replacement for an audio player.

I know, we Linux users are considered CLI freaks, but a GUI now and then is helpful :)

Re: What container format?

Reply #3
After some exploring, I wonder if using a cue sheet may be a better approach?  Seems it's supported by many audio players, and can probably be used with any audio file type.

I tried with flac/mka and aac/m4a with chapters, could only get mpv to recognize the chapters.  I used a cue sheet with Audacious and Clementine, each player showed each song from the single audio file (tried with several formats).

Edit: re-reading your first post, I'm confused if you meant chapters using a cue sheet, or embed in the audio file itself.

Re: What container format?

Reply #4
I'm trying to achieve single-file albums, where everything is inside so I do not have to take care of any extras.

Sorry for the confusion: I mean chapters inside the mka which denote the individual tracks; the same an external cue sheet would do.

I'm aware that it's probably a very nitpicky approach, but I really like the idea of one single file per audiobook that contains everything: audio, chapters, cover and metadata. Videoplayers generally don't have much of a problem with chapters since the idea comes from DVDs, but I expected a more wide-spread support in audio players. Especially since it does not mean to reinvent the wheel because they already handle seeking via cue sheets, so they would only have to parse the chapter information.

Hm, thinking about it.... Matroska allows attachments which can be pretty much everything, so maybe using a cue sheet as an attachment might work.. Will have to test that.

Re: What container format?

Reply #5
So, I had some time and tested things a bit with the following results (VLC/MPC are only used for the sake of testing as they are kinda pointless as default players for audio):

Code: [Select]
mkvmerge album.opus -o album.mka --chapters chapters.xml --global-tags tags.xml --attach-file cover.jpg
:) works perfectly in Foobar and VLC on Windows
:-\ no cover in MPC
:'( does not seem to work fully in any major audio player I ran across under Linux

Code: [Select]
mkvmerge album.opus -o album.mka --attach-file album.cue
:'( embedded cue sheet is not used by Foobar, VLC or MPC

Code: [Select]
flac -o album.flac --cuesheet=album.cue --picture=cover.jpg album.wav
:o Foobar: shows tracks, but all tracks are named "album" despite titles in cue sheet
:o VLC: shows cover, but no tracks
:o MPC: shows tracks, but no cover
:'( supports only flac codec, not opus; lossy->lossless conversion blows up the filesize

Code: [Select]
:'( adding cover seems ridiculous hacky (base64 text attachment, really?)

Re: What container format?

Reply #6
I used ffmpeg to merge a list of flac files into one, add chapters and the album image to a .mka file.  This seems to be the best method to attach an image.  Other methods I had tried did play (usually), but MPV complained about a bad index file.  Anything that plays matroska audio will play this just fine, but only vlc and mpv on my system will recongnize the chapters.  There's also ffplay which plays similar to mpv, but it's more minimal.

Code: [Select]
ffmpeg -f concat -safe 0 -i filelist.txt -i 3YE_metadata -map_metadata 1 -attach folder.jpg -metadata:s:t mimetype=image/jpeg -c:a copy 3YE.mka

This is the metadata file I created for chapters (3YE_metadata)
Code: [Select]
;this is a comment

title=DMT (Do Ma Thang)

title=OOMM (Out Of My Mind)



title=On Air

title=Stay With Me

title=OOMM (Out Of My Mind) [Remix]


Code: [Select]
file '3YE - [01] - DMT (Do Ma Thang).flac'
file '3YE - [02] - OOMM (Out Of My Mind).flac'
file '3YE - [03] - Queen.flac'
file '3YE - [04] - Yessir.flac'
file '3YE - [05] - On Air.flac'
file '3YE - [06] - Stay With Me.flac'
file '3YE - [07] - OOMM (Out Of My Mind) [Remix].flac'

Mediainfo output:
Code: [Select]
Unique ID                                : 86712376933187418760917567584457970594 (0x413C32429502FF1167052015DE27D3A2)
Complete name                            : 3YE.mka
Format                                   : Matroska
Format version                           : Version 4 / Version 2
File size                                : 169 MiB
Duration                                 : 22 min 28 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 049 kb/s
Track name                               : Triangle
Writing application                      : Lavf57.83.100
Writing library                          : Lavf57.83.100
ErrorDetectionType                       : Per level 1
Attachments                              : folder.jpg
ARTIST                                   : 3YE

ID                                       : 1
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
Codec ID                                 : A_FLAC
Duration                                 : 22 min 28 s
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 kHz
Bit depth                                : 16 bits
Default                                  : Yes
Forced                                   : No

00:00:00.000                             : :DMT (Do Ma Thang)
00:02:57.200                             : :OOMM (Out Of My Mind)
00:06:19.746                             : :Queen
00:09:54.426                             : :Yessir
00:13:14.522                             : :On Air
00:16:09.575                             : :Stay With Me
00:19:46.788                             : :OOMM (Out Of My Mind) [Remix]

Re: What container format?

Reply #7
The Webm container supports Opus, and is supported in modern browsers including Edge, with or without video. The audiobook could start up with an HTML file; just a suggestion.

Re: What container format?

Reply #8
The Webm container supports Opus, and is supported in modern browsers including Edge, with or without video. The audiobook could start up with an HTML file; just a suggestion.

Do you think writing an untrue thing helps everyone believe it? I evidently live on another planet called Europe; I have people who write to me that they don't even want to use Javascript with the browser (1%), so Opus files isn't for everyone. I can't embed Opus with the HTML Audio tag unless I create 2 archives for each track and serve it in CAFF container to all Apple products, and I have to change too the .opus extension to all Android devices prior to version 9, and there are too many. And this is only the first part of the story.

Since I can't waste my time, I have removed Opus from my horizons, I always start with content that is or must be incorporated in the ISO format (and here too it is better to forget Opus because I would only get complaints).

It's a shame. Things are changing but too slowly, so I have only the choice of using older MPEG or AAC formats.

As soon as Microsoft updates Windows, at lower bitrates I will use MPEG USAC or xHE-AAC and I will avoid unnecessary conversions because all my compressed sources are already in MPEG or AAC format and only one decoder will serve them all. Obviously I don't speak about personal use.

SimplePortal 1.0.0 RC1 © 2008-2020