389

Now I don't have to : right-click > english audio and right-click > french subtitle. It launches every video of the season ready to go. It was worth it, right?
Now it's time to enjoy my day. Oh wait! (it's 6 am here)

all 39 comments
sorted by: hot top controversial new old
[-] N0x0n@lemmy.ml 39 points 8 months ago* (last edited 8 months ago)

You could have saved hours by just using mkvpropedit writing a simple 3 line bash script that loops through your files.

Just saying 🤷🏼

[-] Zachariah@lemmy.world 20 points 8 months ago

Maybe it took ten hours to find this solution?

[-] pete_the_cat@lemmy.world 14 points 8 months ago

9 hours and 59 minutes to find the solution, 60 seconds to write the code.

[-] N0x0n@lemmy.ml 5 points 8 months ago* (last edited 8 months ago)

Maybe try c+v and do it in 10 seconds?

9h 59m and 10s

You're welcome !

[-] WilliamsStark@sh.itjust.works 2 points 8 months ago

That's what I already did. And finding the good mkvpropedit command was long.
But here I wanted to automate that and just having to choose the audio and subtitles languages and it executes the mkvpropedit command.

[-] N0x0n@lemmy.ml 2 points 8 months ago

Thanks for sharing your script :) I never thought you would need such a complex (not a programmer so it's complex for me xD) script. This seems a full automation and looks great ! Well done, it was worth it !

[-] WilliamsStark@sh.itjust.works 2 points 8 months ago

Thank you very much. It's nice to hear it. I have to say that it's very satisfaying to have a "complete" script with clean code and comments.

[-] Blue_Morpho@lemmy.world 1 points 8 months ago

I'm not sure if it's fixed now but a few years ago Plex ignored the properties and played the first audio stream it found. I had Scooby Doo with Portuguese as the first audio track and although mkvpropedit worked when playing back in VLC, in Plex it would still play Portuguese as default. I had to re merge the streams with English as the first track for Plex to play English by default.

[-] N0x0n@lemmy.ml 2 points 8 months ago* (last edited 8 months ago)

I'm thinking of ~~2~~ 3 issues here.

Either your file had the propertie flag --forced-display-flag for the audio track 1 and this would force the audio 1 to play even if you changed the flag-default with mkvpropedit. In that case you have no other choice to remux your file with mkvmerge and change the flag to --forced-display-flag 1:no (if it's the audio track 1) I have no idea why someome would force an audio track....

Or you didn't used the --edit track:s1 flag with the flag-default propertie, which uses mkvmerge under the hood. Reading through my notes there is a superuser.com link talking specifically about that, and how it could fuck up your tracks order if you don't use the track flag.

Edit: This is only true if your player is capable to select the audio based on the flag default or forced. Otherwise you have to remux the file and change the order of tracks with the --track-order flag with mkvmerge. ~~This could be the case for Plex, you can probably find that info in the plex documentation !~~

Edit2: Plex seems to use both but I would suspect plex or bad flags being the culprit here rather than mkvtools.

[-] Blue_Morpho@lemmy.world 2 points 8 months ago

Yes, the problem was Plex. Other players were fine.

[-] anivia@lemmy.ml 2 points 8 months ago

Plex has a built in solution for that now

[-] flambonkscious@sh.itjust.works 26 points 8 months ago

Share your code? (Or is it like mine, and shameful)

[-] WilliamsStark@sh.itjust.works 29 points 8 months ago

I could but I would have to comment it a little more. If I don't forget I'll share it later in response of your message.

[-] ryannathans@aussie.zone 16 points 8 months ago

Or you could just post it and then fix it up later

[-] WilliamsStark@sh.itjust.works 1 points 8 months ago* (last edited 8 months ago)

I know but I didn't feel completely at ease to share some mildly clean code. Now it's good. I put it in the comments.

[-] ipkpjersi@lemmy.ml 1 points 8 months ago* (last edited 8 months ago)

Why not share it and then let others comment it? Something like that should work.

[-] WilliamsStark@sh.itjust.works 2 points 8 months ago

I know but I didn't fell completely at ease to share some mildly clean code. Now it's good. I put it in the comments.

[-] ipkpjersi@lemmy.ml 2 points 8 months ago

Nice, thanks for sharing :)

[-] WilliamsStark@sh.itjust.works 3 points 8 months ago* (last edited 8 months ago)

Here it is. I took the time to comment it well and rearrange some things.
It's in 2 files :
https://pastebin.com/FQ7xqNSt
https://pastebin.com/6S3qesWc
Keep the file names I chose when copy/pasting. Read the loop file to see how to use it quickly.
I forgot to say in the loop script’s quick explanations that you need mkvmerge and mkvpropedit from MKVToolNix (put it in the PATH variable if needed) and nodejs to make that script work.

[-] Smallwater@lemmy.world 19 points 8 months ago

Why waste 5 seconds every time to want to watch a video, when you can waste 10 hours writing a script to automate it?

That's just how we programmers roll

[-] WilliamsStark@sh.itjust.works 2 points 8 months ago
[-] jackpot@lemmy.ml 10 points 8 months ago

but did you make the script agpl3?

[-] WilliamsStark@sh.itjust.works 1 points 8 months ago

I think you're talking about the licence and for the moment I didn't have time to think about what licences I should use and primarly what are the licences existing.

[-] jackpot@lemmy.ml 1 points 8 months ago

agplv3 is the most copyleft one

[-] WilliamsStark@sh.itjust.works 1 points 8 months ago

Ok, thanks. I'll note this. I have to begin to understand this if I want to put some code online more "seriously".

[-] jackpot@lemmy.ml 1 points 8 months ago

theres no reason not to agpl as others can fork your repo and put it onljne thenselves

[-] elxeno@lemm.ee 5 points 8 months ago

U can configure that in vlc

[-] WilliamsStark@sh.itjust.works 1 points 8 months ago

Yes, and VLC respects the default and forced flags of the tracks, unlike MPC. But I'm so used to MPC and I prefer it.

[-] damnthefilibuster@lemmy.world 5 points 8 months ago

You didn’t ask ChatGPT to write it for you???

[-] Muffi@programming.dev 4 points 8 months ago

Maybe he wanted something that could actually run?

[-] umbrella@lemmy.ml 6 points 8 months ago

you can massage LLM code into working faster than doing it from scratch if you do it right

[-] WilliamsStark@sh.itjust.works 2 points 8 months ago

I wanted to do it myself, learn and getting used to dev things again. AI are often wrong on some details but I used it sometimes and it can help a lot for parts of code or understanding some things.

[-] devfuuu@lemmy.world 4 points 8 months ago

I think you can put a list of preferred languages in the conf file. At least most mpv guis allow setting that somewhere.

[-] Pantherina@feddit.de 3 points 8 months ago

Btw Celluloid is the best modern MPV GUI with all the goodies like portals. And it supports MPV configs which can solve many VLC issues in a single line, like click-to-play ! Never going back.

[-] WilliamsStark@sh.itjust.works 1 points 8 months ago

Thanks but I'm on Windows. But I'll keep it if I settle on Linux someday.

[-] Pantherina@feddit.de 1 points 8 months ago

Then I think VLC is the best

[-] Andrew15_5@mander.xyz 2 points 8 months ago

I literally did the same thing once. But I did it under an hour, if not under 10 minutes, because there is no autocompletion for mpv in Lua.

[-] Sentient_Modem@lemm.ee 2 points 8 months ago

!remindme 10 days

this post was submitted on 10 Mar 2024
389 points (98.0% liked)

Memes

45553 readers
784 users here now

Rules:

  1. Be civil and nice.
  2. Try not to excessively repost, as a rule of thumb, wait at least 2 months to do it if you have to.

founded 5 years ago
MODERATORS