Content-Length: 244733 | pFad | http://github.com/Jaded-Encoding-Thaumaturgy/muxtools/issues/12

2D New methods request for `Chapters` and `SubFile` · Issue #12 · Jaded-Encoding-Thaumaturgy/muxtools · GitHub
Skip to content
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

New methods request for Chapters and SubFile #12

Closed
PhosCity opened this issue May 6, 2024 · 5 comments
Closed

New methods request for Chapters and SubFile #12

PhosCity opened this issue May 6, 2024 · 5 comments

Comments

@PhosCity
Copy link

PhosCity commented May 6, 2024

I have a couple of feature requests. If they already exist and I missed them in the docs, let me know.

  • In Chapters.from_sub, could you add two more parameters:
    • use_actor_field which makes this method search for chapter marker in actor instead of effect field.
    • marker so that we can use any chapter marker we want and not just chapter or chptr.
  • In SubFile, could you add two more paramaters:
    • clean_extradata which removes extradata form the subtitle file.
    • remove_comments which removes all commented lines from the subtitle file.
  • This is optional request and may be more high effort than others so feel free to ignore it if you wish to. This maybe a method for Premux or mux, I'm quite not sure.
    Essentially, I want a way to edit the metadata of tracks in the mkv.
    Let's say I have a video, japanese audio and german audio. No matter what their order are, let's say I want a way to set video to track order 1, name it to "[choom/MTBB Encode]" + set japanese audio to track order 2, name it to "Japanese", set it's default to yes + set german audio to track order 3, name it to "German", set it's default to no.
    I don't know what it'd look like. Maybe
Premux.video(lang="jpn", default=True, track_order=0, name="[choom/MTBB Encode]").audio(
    jpn={"name": "Japanese", "default": "True", "track_order": 1},
    de={"name": "German", "default": "False", "track_order": 2},
)

If the audio does not exist, ignore it of course.

@PhosCity
Copy link
Author

PhosCity commented May 6, 2024

Currently my workaround (which is probably bad in many ways) for the optional feature request is:

    video_id = utils.find_tracks(
        video_file_path,
        type=utils.types.TrackType.VIDEO,
    )[0].track_id

    audio_tracks = utils.find_tracks(
        sub_properties["video"], type=utils.types.TrackType.AUDIO
    )

    for track in audio_tracks:
        if track.language == "ja":
            japanese_audio_id = track.track_id
        elif track.language == "en":
            english_audio_id = track.track_id

    if "english_audio_id" not in locals():
        english_audio_id = None

    if not english_audio_id:
        mkvmerge_args = f'--no-global-tags --track-name {japanese_audio_id}:"Japanese" --default-track-flag {japanese_audio_id}:yes --track-order 0:{video_id},0:{japanese_audio_id}'
    else:
        mkvmerge_args = f'--no-global-tags --track-name {japanese_audio_id}:"Japanese" --default-track-flag {japanese_audio_id}:yes --track-name {english_audio_id}:"English" --default-track-flag {english_audio_id}:no --track-order 0:{video_id},0:{japanese_audio_id},0:{english_audio_id}'

    video = Premux(
        video_file_path,
        subtitles=None,
        keep_attachments=False,
        mkvmerge_args=mkvmerge_args,
    )

@Vodes
Copy link
Collaborator

Vodes commented May 6, 2024

Yeah I wouldn't mind adding the sub and chapter stuff.

I'm also not really against the premux stuff but I wouldn't expect that in a timely manner. I don't really need it and I've been kinda busy lately so the priority is low.

@PhosCity
Copy link
Author

PhosCity commented May 6, 2024

Awesome!

And it's understandable about the premux feature. The workaround seems to be working in the limited testing I've done so I'll use that for the time being.

@Vodes
Copy link
Collaborator

Vodes commented May 12, 2024

Added the sub and chapter stuff. Feel free to test.
If everything works I'll probably release a new patch version because the fontcollector changes are also quite useful.

@PhosCity
Copy link
Author

I tested it briefly and all four of the features seems to work properly. Thanks!

@Vodes Vodes closed this as completed May 13, 2024
@Vodes Vodes pinned this issue May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/Jaded-Encoding-Thaumaturgy/muxtools/issues/12

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy