BookPlayer icon indicating copy to clipboard operation
BookPlayer copied to clipboard

Allow editing chapter/track names

Open Willamin opened this issue 2 years ago • 5 comments

Feature request

I'd love the ability to edit chapter/track names of an m4b file on the fly. As I'm listening, I've always wanted to update the track metadata (well, only the name) so once I'm finished with a book I can archive it for later listening (with correct metadata).

Narrative

  • Feel free to change the following format to better suit the details of the enhancement

GIVEN:

  • that I have an audiobook file (an m4b or similar instead of a collection of tracks in a playlist) WHEN:
  • I want to do so (via gesture, tapping an edit button, or similar) THEN:
  • I can update the track name, persisting it in the audiobook file

Design

I have a temporary solution entirely separate where I:

  1. run mp4chaps --export SomeBook.m4b
  2. move that exported file to my phone
  3. use a separate, simple personally-built (but not published) app to view/edit chapters
  4. and when the book is finished:
  5. move the edited chapters file back to my computer
  6. run mp4chaps --import SomeBook.m4b
  7. archive that audiobook file in my personal collection

Here's a screenshot of the app I built. I didn't spend any time trying to design it to be beautiful, but feel free to take any inspiration for the layout: image

Willamin avatar Nov 19 '23 02:11 Willamin

Hi @Willamin ! I tested out building an app with one of the ffmpeg libraries for iOS, but modifying the metadata took a long time in the app, but I'm not sure if that's just because I'm a noob with ffmpeg commands as I was basically transcoding the entire thing, or if it's just the nature of it, because of how big audiobook files usually are. I looked into doing it natively with AVFoundation, but I think there was a problem with mp3s, but I can't remember many details, as I didn't get too much into that part.

I'm curious how much time it took for your app to edit the metadata on m4b files? and if it's a reasonable small amount of time, are you willing to share your approach and/or code for your app?

-- EDIT

I think I read too fast and misunderstood the steps. This is something that I did want to do, well indirectly, as the goal was to allow users to create the chapters list for their books, but the things I've tried, have not been a good fit to be included in the app so far, but I'm open to ideas/suggestions on how to achieve this

GianniCarlo avatar Nov 19 '23 03:11 GianniCarlo

For FFmpeg, some care needs to be taken for licensing issues. You can read more about them at https://ffmpeg.org/legal.html and, for an example of a library for iOS, https://github.com/arthenica/ffmpeg-kit?tab=readme-ov-file#15-patents. For metadata-only, it's probably fine, but something to keep in mind.

I think this issue is specifically about editing chapter names in mp4 files that already have chapters, which is pretty easy to do without any libraries, even. However, it would probably be better to include a full tag editor, allowing the creation of chapters in a file that doesn't have them, including mp3s, mp4s, mkvs, etc. This would probably be easiest with FFmpeg, and should be pretty quick, it's just reading and writing bytes.

I'm not sure how much work that would be or if there are existing utilities for that.

harrisi avatar Nov 19 '23 04:11 harrisi

@GianniCarlo I'll try to get this app running locally and see if I can quickly make some amount of progress on this! If I can spike something out, would you be up for helping it fit the organization and code style of the project?

@harrisi Right, this issue is more specifically for editing chapter names of existing chapters.

Adding chapters in books where none exist would be a great feature too, but I think would expand the scope of this issue too much.

Editing other tags is also a great feature - the ability to edit the Title, Author, and Cover art is present and more would be appreciated. Again though I think expanding the set of non-chapter metadata that can be editing would be good to separate as a new issue.

Willamin avatar Nov 19 '23 19:11 Willamin

Yeah definitely, feel free to open a PR and I can provide feedback. Regarding existing changes we allow to the title and artwork, this currently does not affect the underlying file, these are just changes at the app level, because I couldn't find a lightweight way to update the files, @harrisi pointed out a ffmpeg command I can try, but on my end I'm focusing first on stand alone playback watch (and some improvements to caching when streaming audio) before I focus on anything else

I can give some pointers later on where to focus for updating the chapters title in the code, and there's a developer section in the wiki to setup the project locally, let me know if you run into any problems with that

GianniCarlo avatar Nov 19 '23 20:11 GianniCarlo

this currently does not affect the underlying file, these are just changes at the app level

Ohhh, that makes total sense! Honestly, I'd be happy with that kind of change for chapter names too – as long as those are exportable, similar to exporting bookmarks!

Willamin avatar Nov 20 '23 16:11 Willamin