Using KM to Merge Audio Files?

T'aint luck. T'is some sort of unresolved issue you're having.

  • Did you change the macro from what Tom posted?
  • Are all title's failing?
    • Have you tried selecting different sets of items?
  • What version of macOS are you using?
  • What version of Keyboard Maestro are you using?

Peter explains the 1Password error items in the editor log file in that thread. They can't be afflicting Tom's macro, and unless there are thousands of them they aren't impacting your system performance.

[quote="ccstone, post:43, topic:9068"]

  • Did you change the macro from what Tom posted?
    Only to the m4b format per Tom's suggestion. I've replaced the changed and unchanged version with a fresh import at least five times.
  • Are all title's failing?
    Yes, they are,
  • Have you tried selecting different sets of items?
    Of course I have. I'm not completely hopeless.
  • What version of macOS are you using?
    Catalina (10.15.7)
  • What version of Keyboard Maestro are you using?
    10.0.2

Post an example file path to one of the failing titles -- it feels like a "funky file path" problem although, given that the macro is use "Quote for Shell Script", I'm not sure why...

But at least posting the file path will allow others to try and replicate your problem in a similar environment.

Thanks, Nice_S.

Just tried 3 of the 12 files at /Users/pamela/Downloads/Putin's World Russia Against the West and with the Rest/Putin's World-Part01.mp3 and got this from the log:

Then tried a group at /Volumes/Media/AUDIOBOOKS/:temp:folders/Bill Buford - Heat/Bill Buford/1-04 1d.mp3 and get an error with more details:

And as you can see from the errors, the first is choking on the " in "Putin's", the second on the : in ":temp".

The simplest solution is to stop using "weird" characters in your file and folder names -- stick to "a-zA-Z0-9-_" and your problem will disappear. But we're Mac users, so that ain't gonna happen!

My guess is that since "Local Path" is getting quoted in the second action, the problem is with "Local Parent". I don't know enough about KM to know how that works, but you could try adding a "Filter Variable" action immediately before the "Execute Shell Script" one, and in that filter "local parent" similar to how "local path" was done earlier -- you might want to filter into a new "Local Parent Quoted" variable and then use "$KMVAR_Local_Parent_Quoted" in the final action.

At least that'll buy the Forum some time until @ccstone or @Tom get back with the correct answer :wink:

BTW, your first error shows that this was nothing to do with whether your files were on the system drive or an external USB...

Splendid, Nige_S. I'll tidy-up all the filenames and read about the rest while we wait for the others. Who knows...necessity may yet mother invention.

Thanks so much.

Try this one:

Join files with MP4Box [2022-04-21].kmmacros (6.9 KB)

I changed the way the output path is constructed, which allowed for proper quoting — as @Nige_S had suggested:

Untitled-pty

Tested with folder names like this: un"titled 'folder


Lesson learned (again): Never be sloppy with path quoting. It will hit you back, even if it’s 4 years later :wink:

1 Like

You gentlemen do cut a heroic figure and I may have found a way to be of service to the forum. Whatever you build no matter how robustly just let me try it the way they put the first astronauts through all manner of unnecessary nonsense. Tom's newest version works perfectly on my local drive and with the changed Putin files that broke earlier. Over on my external drive, though, I (first moved the joined file to my Desktop) then tried the same files as a control at:

/Volumes/Media/AUDIOBOOKS/:temp:folders/Putin's World Russia Against the West and with the Rest/Putins World 01.mp3 and got the usual importing error:

In past this would break the macro even on the local drive so I tried it on some Thomas Merton files there and it still works locally. On the USB these same files again failed. Will do some maintenance on the USB tonight and try again. If that fails I'll wipe a small drive and try there as well. Can't imagine what it would be if not the drive. In any event thanks so much to everyone here and especially to Tom for your generosity when you may wish to move on.

It seems the problem are the colon : characters in your path name.

MP4Box uses the colon as delimiter for file-specific options. For example (from the Wiki):

MP4Box -add file.mpg#audio:dur=10 new_file.mp4

“Normally” it should work because the paths are properly quoted now, but for MP4Box the colon probably has precedence over any quotation marks. So, it thinks the file name ends at the colon and it takes the part after the colon as option. (See your error: “Unrecognized import option temp”.)

ATM I don’t have a solution for that, except removing the colons from the file and path names. (And also any octothorp #, while you’re at it.)


How did these colons get in there? (:temp:folders)

If you have created the folder in the Finder, then you must have written it as /temp/folders, because colons are not allowed in the Finder. (Slashes from Finder filenames get converted to colons in Shell filenames, and vice versa.)

In general, I would rather avoid using slashes or colons in file or folder names. If the purpose of the slash is sorting the folder before other files, then you could use an underscore instead.

1 Like

Thanks so much, Tom. It's huge to know that a few renames will allow access. I don't know how anyone can be so smart.

This macro has worked hundreds of times flawlessly until I updated KM a few days ago to v 10.1.1, in Catalina. Can someone tell me what might have stopped the magic? I re-imported Tom's 2022 version safely and it does appear in the enabled group. I've tried running it from the keyboard shortcut and from the editor. The error is "Execute a Shell Script failed with script error: text-script: line 1: MP4Box: command not found. Macro “Trying” cancelled (while executing Execute Shell Script)." I see this now at the bottom of the script though it may have always been there.

Thanks for any help. I've miles to go to prepare our media library for PLEX and can't imagine finishing without this.

Looks like your PATH environment variable needs setting again. Pop back up to this post and the following few for the probable solution.

2 Likes

That did it, Nige. Thanks for your kind instruction. How I miss you guys when I'm not pestering you. ; )