Giter VIP home page Giter VIP logo

Comments (7)

sandreas avatar sandreas commented on June 8, 2024

I admit, that a filename with just .m4b should never be the result of a conversion, but i can't think of any use case for --batch-pattern should be used with an empty value?!

I'm not sure, that i get this right. Could you provide a sample command that you execute and some details about your use case?

from m4b-tool.

jeromeof avatar jeromeof commented on June 8, 2024

Sorry, i have a bunch of MP3 audiobooks in a ToConvert folder organised by Author / Title and then I used both the docker build and the standalone build and it creates the same .m4b file (after creating a .m4b-tmpfiles folder first). I noticed with lots of audiobooks PHP seems to run out of memory after a while also (but that is a different problem)?

So, for my current issues and for logging purposes I have stripped it back to one audiobook below.

✘ jeromeof@Jeromes-MacBook-Pro  ~/Music/Audiobooks  ls -l ToConvert/Orson\ Scott\ Card/Stonefather/
total 226152
-rw-r--r--@ 1 jeromeof staff 22688470 28 Aug 17:37 01 1.mp3
-rw-r--r-- 1 jeromeof staff 22414159 28 Aug 17:36 02 2.mp3
-rw-r--r-- 1 jeromeof staff 23013154 28 Aug 17:37 03 3.mp3
-rw-r--r-- 1 jeromeof staff 22530826 28 Aug 17:36 04 4.mp3
-rw-r--r-- 1 jeromeof staff 22908493 28 Aug 17:38 05 5.mp3
-rw-r--r-- 1 jeromeof staff 116322 28 Aug 21:58 cover.jpg

So I run the following command:

php m4b-tool.phar merge --force -vvv --audio-bitrate="48k" --audio-profile="aac_he_v2" --audio-codec="libfdk_aac" --batch-pattern="ToConvert/%a/%m" --output-file="BookBinding/" "ToConvert/"

And get the following result:
jeromeof@Jeromes-MacBook-Pro  ~/Music/Audiobooks  ls -l BookBinding/Orson\ Scott\ Card/Stonefather/.m4b
-rw-r--r-- 1 jeromeof staff 68369233 29 Aug 11:24 BookBinding/Orson Scott Card/Stonefather/.m4b
jeromeof@Jeromes-MacBook-Pro  ~/Music/Audiobooks 

And I get the following log:

tagging file BookBinding/Orson Scott Card/Stonefather/.m4b-tmpfiles//tmp_.m4b with tag:
M4bTool\Audio\Tag Object
(
[encoder] => m4b-tool
[title] => 1
[sortTitle] =>
[artist] => Orson Scott Card
[sortArtist] =>
[genre] =>
[writer] =>
[album] => Stonefather
[sortAlbum] =>
[disk] =>
[disks] =>
[albumArtist] =>
[year] =>
[track] =>
[tracks] =>
[cover] => SplFileInfo Object
(
[pathName:SplFileInfo:private] => ToConvert/Orson Scott Card/Stonefather/cover.jpg
[fileName:SplFileInfo:private] => cover.jpg
)

[description] => 
[longDescription] => 
[comment] => 
[copyright] => 
[encodedBy] => 
[performer] => 
[language] => 
[publisher] => 
[lyrics] => 
[chapters] => Array
    (
        [0] => M4bTool\Audio\Chapter Object
            (
                [name:protected] => 1
                [tag:protected] => 
                [start:protected] => Sandreas\Time\TimeUnit Object
                    (
                        [milliseconds:protected] => 0
                    )

                [length:protected] => Sandreas\Time\TimeUnit Object
                    (
                        [milliseconds:protected] => 2256608
                    )

            )

        [1] => M4bTool\Audio\Chapter Object
            (
                [name:protected] => 2
                [tag:protected] => 
                [start:protected] => Sandreas\Time\TimeUnit Object
                    (
                        [milliseconds:protected] => 2256608
                    )

                [length:protected] => Sandreas\Time\TimeUnit Object
                    (
                        [milliseconds:protected] => 2229115
                    )

            )

        [2] => M4bTool\Audio\Chapter Object
            (
                [name:protected] => 3
                [tag:protected] => 
                [start:protected] => Sandreas\Time\TimeUnit Object
                    (
                        [milliseconds:protected] => 4485723
                    )

                [length:protected] => Sandreas\Time\TimeUnit Object
                    (
                        [milliseconds:protected] => 2289023
                    )

            )

        [3] => M4bTool\Audio\Chapter Object
            (
                [name:protected] => 4
                [tag:protected] => 
                [start:protected] => Sandreas\Time\TimeUnit Object
                    (
                        [milliseconds:protected] => 6774746
                    )

                [length:protected] => Sandreas\Time\TimeUnit Object
                    (
                        [milliseconds:protected] => 2240818
                    )

            )

        [4] => M4bTool\Audio\Chapter Object
            (
                [name:protected] => 5
                [tag:protected] => 
                [start:protected] => Sandreas\Time\TimeUnit Object
                    (
                        [milliseconds:protected] => 9015564
                    )

                [length:protected] => Sandreas\Time\TimeUnit Object
                    (
                        [milliseconds:protected] => 2278527
                    )

            )

    )

[series] => 
[seriesPart] => 

)

file BookBinding/Orson Scott Card/Stonefather/.m4b-tmpfiles//tmp_.m4b is an MP4 file
mp4tags -help
check for sorting support in mp4tags
not supported - get a release from https://github.com/sandreas/mp4v2 for sorting support
mp4tags -song 1 -artist "Orson Scott Card" -album Stonefather -encodedby m4b-tool -type 2 "BookBinding/Orson Scott Card/Stonefather/.m4b-tmpfiles//tmp_.m4b"
tagging file BookBinding/Orson Scott Card/Stonefather/.m4b-tmpfiles//tmp_.m4b
mp4art --add "ToConvert/Orson Scott Card/Stonefather/cover.jpg" "BookBinding/Orson Scott Card/Stonefather/.m4b-tmpfiles//tmp_.m4b" -f
adding cover ToConvert/Orson Scott Card/Stonefather/cover.jpg to BookBinding/Orson Scott Card/Stonefather/.m4b-tmpfiles//tmp_.m4b
adding ToConvert/Orson Scott Card/Stonefather/cover.jpg -> BookBinding/Orson Scott Card/Stonefather/.m4b-tmpfiles//tmp_.m4b

mp4chaps -i "BookBinding/Orson Scott Card/Stonefather/.m4b-tmpfiles//tmp_.m4b"
importing chapters for BookBinding/Orson Scott Card/Stonefather/.m4b-tmpfiles//tmp_.m4b
an error occured, that has not been caught:
Array
(
[type] => 2
[message] => unlink(BookBinding/Orson Scott Card/Stonefather/.m4b-tmpfiles/5-05 5-converting.m4b.fdkaac-input): No such file or directory
[file] => phar:///Users/jeromeof/Music/Audiobooks/m4b-tool.phar/src/library/M4bTool/Executables/Tasks/ConversionTask.php
[line] => 97
)

from m4b-tool.

sandreas avatar sandreas commented on June 8, 2024

Thank you for the detailed description. This should be definetely enough to reproduce the problem. I'll take a look in the next days.

Two hints:

  • The docker image is better for --batch-pattern because of sorting support in mp4tags
  • In my tests the quality of the aac_he_v2 profile was not superior to default libfdk_aac with the same bitrate - you should definitely check this

from m4b-tool.

jeromeof avatar jeromeof commented on June 8, 2024

I am using the libfdk_aac codec but I thought i had to specify the codec separately so was specifying aac_he_v2 profile as that I believe (from reading some documentation) provides the best quality at very low bitrates e.g. 32K?

But if you are saying I don't need to bother with the aac_he_v2 profile parameter then great. I have only started using the tool the other day.

The reason (and other people might come to the same conclusion) is that with MacOS Catalina Apple have stopped supporting Audiobooks in separate iTunes filesystem, including not supporting external HDD for Audiobooks) - so I installed the Catalina Beta and Apple started moving all my Audiobooks from iTunes to the Books at on my main filesystem, eventually this filled up and i ran out of space and I then looked for a solution and it looks like this is how it is designed. So, I thought I have a bunch of Audiobooks as MP3 files maybe its simpler to take the original MP3 files and make M4B files and just leave these complete files on the external HDD and drop them on my iPhone whenever I wanted to listen rather than rely on the terrible Apple Books app.

from m4b-tool.

sandreas avatar sandreas commented on June 8, 2024

that I believe (from reading some documentation) provides the best quality at very low bitrates e.g. 32K?
But if you are saying I don't need to bother with the aac_he_v2 profile parameter then great.

Well, I meant that you have to check this in practise... Yes, the documentation includes this hint about better quality for 32K - but I tested it with some audiobooks and for me the quality of the default encoder profile was better. It depends on your files and you have to check, which settings are best. I would love to hear about your experiences.

The bug should be fixed, here is a testing build (feedback would be great):
m4b-tool.tar.gz

Oh, and i also tried to improve memory management for #44 ... but in PHP this is a difficult one without a full refactoring (i included a dirty hack to make the --batch-pattern feature work). It might be that there is still some issues with it.

from m4b-tool.

jeromeof avatar jeromeof commented on June 8, 2024

Excellent, just tried your test build and it has appeared to solve the problem. The memory leak might be solved also as this ran to completion on about 10 audiobooks in a batch overnight for me.

Not sure of your schedule for your next release but I would love a docker version of this soon. Brew is not building ffmpeg correctly on Catalina at the moment (well it is a beta) but obviously using a docker image on Catalina solves that problem.

Thanks

from m4b-tool.

sandreas avatar sandreas commented on June 8, 2024

Excellent, just tried your test build and it has appeared to solve the problem. The memory leak might be solved also as this ran to completion on about 10 audiobooks in a batch overnight for me.

This is great news. Thank you for your feedback.

Not sure of your schedule for your next release but I would love a docker version of this soon.

If you would like to use an old or new experimental version of m4b-tool within the docker image, you can just provide a build-arg parameter with the according link:

docker build . --build-arg M4B_TOOL_DOWNLOAD_LINK=https://github.com/sandreas/m4b-tool/releases/download/v.0.4.1/m4b-tool.tar.gz -t m4b-tool

or just edit the variable in the Dockerfile.

from m4b-tool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.