audible-tools / audible-tools.github.io

Converts aax to audiofiles online. Please don't sue me amazon.
https://audible-tools.kamsker.at/
Other
397 stars 46 forks source link

output filename using metadata title and author #2

Closed writetome1 closed 3 years ago

writetome1 commented 3 years ago

Simple perfect !!! . Thanks a lot.

I'd like to be able to use ffmpeg and set output filename using the input metadata es: title and author Please have a look if possible

JKamsker commented 3 years ago

Im trying to come up with a solution. Just give me some time :D

For the Title and Author thingie i could use ffprobe wasm But im not sure how i could pack that into a usable UI

Ideas welcome

Lewiscowles1986 commented 3 years ago

Could you spike it by just adding a filename override and allowing @writetome1 etc to use that, giving them control (it's one-file at a time right now anyway, so... maybe less important to automate?)

@writetome1 would that be an acceptable first-step for you?

Lewiscowles1986 commented 3 years ago

Some notes (only relevant in bash + zsh / nix environments I think)

Fields for title and author seem to be:

It'd be quite difficult to read as a shell script though.

writetome1 commented 3 years ago

Thanks to all. My preferred env is windows and I'm patient to wait for JKamsker ... But I will check Lewiscowles1986 bash solution in Linux Mint and I'll let You know

Lewiscowles1986 commented 3 years ago

@writetome1 I don't know if you know this but WSL and git bash are also valid test environments, if ffmpeg is in your PATH. For example my setup_ffmpeg is basically

export PATH=$PATH:/c/ffmpeg/bin

I prefer *nix like Linux and OSx, but, I use Windows and like to try to see how much of my workflow I can make OS independent. Perhaps that helps.

Git Bash comes with git for windows. I think ffmpeg directly distributes a windows binary.

writetome1 commented 3 years ago

@writetome1 I don't know if you know this but WSL and git bash are also valid test environments, if ffmpeg is in your PATH. For example my setup_ffmpeg is basically

export PATH=$PATH:/c/ffmpeg/bin

I prefer *nix like Linux and OSx, but, I use Windows and like to try to see how much of my workflow I can make OS independent. Perhaps that helps.

Git Bash comes with git for windows. I think ffmpeg directly distributes a windows binary.

Hi, i test the bash solution both in windows and linux mint .... no results .... did I miss something ?

in Windows using Cygwin console:

write@DESKTOP-GGNI10P ~ $ ffmpeg -y -activation_bytes 68e98608 -i C:/Users/write/Documents/my-test.aax 2>&1 | grep -E '^\sFIELD\s\:\s.*$' | head -n 1 | awk -F ': ' '{print $2}'

write@DESKTOP-GGNI10P ~ $

===> No answer

PLEASE NOTE: in Windows using Cygwin its OK ( ffprobe correctly releases all metadata and ffmpeg is also OK: ffmpeg -y -activation_bytes 68e98608 -i C:/Users/write/Documents/my-test.aax -map_metadata 0 -id3v2_version 3 -codec:a libmp3lame -vn C:/Users/write/Documents/my-test.mp3

in Linux Mint same result

write@write-Aspire-7741:~$ ffmpeg -y -activation_bytes 68e98608 -i '/media/write/Windows 10 Pro/Users/write/Documents/my-test.aax' 2>&1 | grep -E '^\sFIELD\s\:\s.*$' | head -n 1 | awk -F ': ' '{print $2}' write@write-Aspire-7741:~$

===> No answer

JKamsker commented 3 years ago

I tested it on wsl, i personally dont have cygwin.

On windows, you have to set the PATH variable or copy the ffmpeg.exe in order to use ffmpeg like that (https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/)

writetome1 commented 3 years ago

I tested it on wsl, i personally dont have cygwin.

On windows, you have to set the PATH variable or copy the ffmpeg.exe in order to use ffmpeg like that (https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/)

path is ok. ffmpeg, ffplay, ffprobe are fully tested and are ok . Same OK and well tested on Linux mint

As I said before: PLEASE NOTE: in Windows using Cygwin its OK ( ffprobe correctly releases all metadata and ffmpeg is also OK: ffmpeg -y -activation_bytes 68e98608 -i C:/Users/write/Documents/my-test.aax -map_metadata 0 -id3v2_version 3 -codec:a libmp3lame -vn C:/Users/write/Documents/my-test.mp3
I got a good mp3 file !!

JKamsker commented 3 years ago

then i dont understand the question 😅

writetome1 commented 3 years ago

I apologize for not having replaced FIELD with title and artist. Now, yes, it's OK : title and artist are released in output:

write@DESKTOP-GGNI10P ~ $ ffmpeg -y -activation_bytes 68e98608 -i C:/Users/write/Documents/my-test.aax 2>&1 | grep -E '^\stitle\s\:\s.*$' | head -n 1 | awk -F ': ' '{print $2}' xxx yyyyy zzzzz <---- OK title

$ ffmpeg -y -activation_bytes 68e98608 -i C:/Users/write/Documents/my-test.aax 2>&1 | grep -E '^\sartist\s\:\s.*$' | head -n 1 | awk -F ': ' '{print $2}' xxxxxxxx bbbbbbb <---- OK artist

but my goal is to have the output file mp3 file with title and artist name like: "xxx yyyyy zzzzz - xxxxxxxx bbbbbbb.mp3"

Lewiscowles1986 commented 3 years ago
  1. FIELD needs to be exchanged for artist or title.
  2. You'll need to save the result into a variable to use later. I Suggest TITLE and AUTHOR to meet the original language asked.
  3. You'd then build the output filename. I noticed you are not in pwd and are giving full-paths to the files. This tool gives relative pwd path as did my tests. Using pwd certainly keeps things shorter and avoid Windows path oddities.

To ensure your pwd is C:/Users/write/Documents/ you can either install using git bash and right-click to open a shell in that folder; or use the change directory cd command to navigate there before issuing commands.

writetome1 commented 3 years ago
1. FIELD needs to be exchanged for `artist` or `title`.

2. You'll need to save the result into a variable to use later. I Suggest `TITLE` and `AUTHOR` to meet the original language asked.

3. You'd then build the output filename.
   I noticed you are not in `pwd` and are giving full-paths to the files.
   This tool gives relative `pwd` path as did my tests.
   Using `pwd` certainly keeps things shorter and avoid Windows path oddities.

To ensure your pwd is C:/Users/write/Documents/ you can either install using git bash and right-click to open a shell in that folder; or use the change directory cd command to navigate there before issuing commands.

Yes, is OK now ....May be I'm going to write a little pithon script having ffmpeg inside .... I'll appreciate Your help

Lewiscowles1986 commented 3 years ago

Can always PR or offer docs to this repo too 😉

JKamsker commented 3 years ago

Scripts are welcome in this organization.

writetome1 commented 3 years ago

I'm sorry bat my script is very specific for my needs: and is not general purpose ....