Skip to content

[BUG/QUESTION]: Fonts path being passed on attachment on file #790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
PedroBuffon opened this issue Dec 5, 2024 · 4 comments
Open

[BUG/QUESTION]: Fonts path being passed on attachment on file #790

PedroBuffon opened this issue Dec 5, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@PedroBuffon
Copy link

PedroBuffon commented Dec 5, 2024

Program version

5.1.5

Operating System

Windows

Type

CLI

Service

Crunchyroll

Command used

--service crunchy --series G7PU3PVJ9 --episode 1-9

Show ID

G7PU3PVJ9

Episode

1

Console Output

Stream #0:3: Attachment: none
      Metadata:
        filename        : D:\Usuarios\Pedro\anidl\fonts\trebuc.ttf
        mimetype        : application/x-truetype-font
  Stream #0:4: Attachment: none
      Metadata:
        filename        : D:\Usuarios\Pedro\anidl\fonts\trebucbd.ttf
        mimetype        : application/x-truetype-font
  Stream #0:5: Attachment: none
      Metadata:
        filename        : D:\Usuarios\Pedro\anidl\fonts\trebucbi.ttf
        mimetype        : application/x-truetype-font
  Stream #0:6: Attachment: none
      Metadata:
        filename        : D:\Usuarios\Pedro\anidl\fonts\trebucit.ttf
        mimetype        : application/x-truetype-font
  Stream #0:7: Attachment: none
      Metadata:
        filename        : D:\Usuarios\Pedro\anidl\fonts\times.ttf
        mimetype        : application/x-truetype-font
  Stream #0:8: Attachment: none
      Metadata:
        filename        : D:\Usuarios\Pedro\anidl\fonts\timesbd.ttf
        mimetype        : application/x-truetype-font
  Stream #0:9: Attachment: none
      Metadata:
        filename        : D:\Usuarios\Pedro\anidl\fonts\timesbi.ttf
        mimetype        : application/x-truetype-font
  Stream #0:10: Attachment: none
      Metadata:
        filename        : D:\Usuarios\Pedro\anidl\fonts\timesi.ttf
        mimetype        : application/x-truetype-font

Additional Information

cli-default.yml is as follow:

# Set the quality of the stream, 0 is highest available.
q: 0
# Set which stream to use
kstream: 1
# Set which server to use
server: 1
# How many parts to download at once. Increasing may improve download speed.
partsize: 10
# Set whether to mux into an mp4 or not. Not recommended.
mp4: false
# Whether to delete any created files or not
nocleanup: false
# Whether to only download the relevant video once
dlVideoOnce: false
# Whether to keep all downloaded videos or only a single copy
keepAllVideos: false
# What to use as the file name template
fileName: "${showTitle}\\S${season}\\[BUFFON] ${showTitle} S${season}E${episode} [${service} WEBRip-${height}p H265]"
# Enable chapters
chapters: true
# What Audio languages to download
dubLang: ["jpn", "por"]
# What Subtitle languages to download
dlsubs: ["pt-BR"]
# What language Audio to set as default
defaultAudio: "por"
# Force the use of ffmpeg as the muxer
forceMuxer: "ffmpeg"
# Define ffmpeg options
ffmpegOptions: [
    "-c:v hevc_nvenc",
    "-rc-lookahead 32",
    "-crf 20",
    "-c:a copy",
    "-metadata:s:v:0 title='h265 - Encoded By Buffon'",
    "-metadata:s:v:0 language=jpn",
    "-metadata:s:a:0 title='Japanese'",
    "-metadata:s:a:0 language=jpn",
    "-metadata:s:a:1 title='Brazilian CR'",
    "-metadata:s:a:1 language=por",
    "-disposition:a:1 default+forced",
    "-metadata:s:s:0 title='Brazilian CR'",
    "-metadata:s:s:0 language=por",
    "-disposition:s:0 default",
    "-metadata:s:s:1 title='Brazilian CR (Forced)'",
    "-metadata:s:s:1 language=por",
    "-disposition:s:1 default+forced"
]

So when ffmpeg adds the fonts file, the path is added too, is there a way to omit the path?

@PedroBuffon PedroBuffon added the bug Something isn't working label Dec 5, 2024
@Jaynator495
Copy link

Uhhh, I think in ./modules/module.merger.ts if you change line 171 to this:

args.push(`-attach ${font.path} -metadata:s:t:${fontIndex} mimetype=${font.mime} filename="${font.name}"`);

It should instead set each one to the font name which would be equal to what the mkvmerge merger does, I'm not entirely sure why this wasn't already how it was

@PedroBuffon
Copy link
Author

PedroBuffon commented Dec 5, 2024

Thanks for the quick response, I'll try the change and come back with the result.

@PedroBuffon
Copy link
Author

PedroBuffon commented Dec 5, 2024

Recompiled but now getting the error

[AVFormatContext @ 00000198e92c2040] Unable to choose an output format for 'filename=trebuc.ttf'; use a standard extension for the filename or specify the format manually.
[out#0 @ 00000198e9351d80] Error initializing the muxer for filename=trebuc.ttf: Invalid argument
Error opening output file filename=trebuc.ttf.
Error opening output files: Invalid argument
[ERROR] {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 7628,
  stdout: null,
  stderr: null,
  code: 1
}
[ERROR] [ffmpeg] Merging failed with exit code 1

Full command generated is as follow
"ffmpeg" -i "D:\Media\Anidl\Delico's Nursery\S01\[BUFFON] Delico's Nursery S01E01 [CR WEBRip-1080p H265].Japanese.video.m4s" -i "D:\Media\Anidl\Delico's Nursery\S01\[BUFFON] Delico's Nursery S01E01 [CR WEBRip-1080p H265].Japanese.audio.m4s" -i "D:\Media\Anidl\Delico's Nursery\S01\[BUFFON] Delico's Nursery S01E01 [CR WEBRip-1080p H265].04.por.Brazilian Portuguese.ass" -attach D:\Usuarios\Pedro\anidl\fonts\trebuc.ttf -metadata:s:t:0 mimetype=application/x-truetype-font filename="trebuc.ttf" -attach D:\Usuarios\Pedro\anidl\fonts\trebucbd.ttf -metadata:s:t:1 mimetype=application/x-truetype-font filename="trebucbd.ttf" -attach D:\Usuarios\Pedro\anidl\fonts\trebucbi.ttf -metadata:s:t:2 mimetype=application/x-truetype-font filename="trebucbi.ttf" -attach D:\Usuarios\Pedro\anidl\fonts\trebucit.ttf -metadata:s:t:3 mimetype=application/x-truetype-font filename="trebucit.ttf" -attach D:\Usuarios\Pedro\anidl\fonts\times.ttf -metadata:s:t:4 mimetype=application/x-truetype-font filename="times.ttf" -attach D:\Usuarios\Pedro\anidl\fonts\timesbd.ttf -metadata:s:t:5 mimetype=application/x-truetype-font filename="timesbd.ttf" -attach D:\Usuarios\Pedro\anidl\fonts\timesbi.ttf -metadata:s:t:6 mimetype=application/x-truetype-font filename="timesbi.ttf" -attach D:\Usuarios\Pedro\anidl\fonts\timesi.ttf -metadata:s:t:7 mimetype=application/x-truetype-font filename="timesi.ttf" -map 0 -map -0:a -metadata:s:v:0 title="undefined" -map 1 -metadata:s:a:0 language=jpn -map 2 -c:v copy -c:a copy -c:s ass -metadata:s:s:0 title="Brazilian Portuguese" -metadata:s:s:0 language=por -c:v hevc_nvenc -rc-lookahead 32 -crf 20 -highbitdepth 1 -c:a copy -metadata:s:v:0 title='h265 - Encoded By Buffon' -metadata:s:v:0 language=jpn -metadata:s:a:0 title='Japanese' -metadata:s:a:0 language=jpn -metadata:s:a:1 title='Brazilian CR' -metadata:s:a:1 language=por -disposition:a:1 default+forced -metadata:s:s:0 title='Brazilian CR' -metadata:s:s:0 language=por -disposition:s:0 default -metadata:s:s:1 title='Brazilian CR (Forced)' -metadata:s:s:1 language=por -disposition:s:1 default+forced "D:\Media\Anidl\Delico's Nursery\S01\[BUFFON] Delico's Nursery S01E01 [CR WEBRip-1080p H265].mkv"

@PedroBuffon
Copy link
Author

PedroBuffon commented Dec 5, 2024

So after messing around with the code i've found out that FFmpeg was interpreting filename=${font.name} as a file output so i passed -metadata:s:t:${fontIndex} filename=${font.name} and it worked, log as follows

  Stream #0:3: Attachment: none
      Metadata:
        mimetype        : application/x-truetype-font
        filename        : trebuc.ttf
  Stream #0:4: Attachment: none
      Metadata:
        mimetype        : application/x-truetype-font
        filename        : trebucbd.ttf
  Stream #0:5: Attachment: none
      Metadata:
        mimetype        : application/x-truetype-font
        filename        : trebucbi.ttf
  Stream #0:6: Attachment: none
      Metadata:
        mimetype        : application/x-truetype-font
        filename        : trebucit.ttf
  Stream #0:7: Attachment: none
      Metadata:
        mimetype        : application/x-truetype-font
        filename        : times.ttf
  Stream #0:8: Attachment: none
      Metadata:
        mimetype        : application/x-truetype-font
        filename        : timesbd.ttf
  Stream #0:9: Attachment: none
      Metadata:
        mimetype        : application/x-truetype-font
        filename        : timesbi.ttf
  Stream #0:10: Attachment: none
      Metadata:
        mimetype        : application/x-truetype-font
        filename        : timesi.ttf

mkvtoolnix attachments
image

Whole line is args.push(`-attach ${font.path} -metadata:s:t:${fontIndex} mimetype=${font.mime} -metadata:s:t:${fontIndex} filename=${font.name}`);

AnimeDL added a commit that referenced this issue Jan 4, 2025
Fixes file paths being passed to ffmpeg when merging subtitles. #790
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants