gnoling / UnlinkMKV

Merges ordered chapters / segmented MKVs back into a single file.
MIT License
156 stars 8 forks source link

No subtitles AND openings/endings in the wrong place #30

Open isrealityreallyreal opened 6 years ago

isrealityreallyreal commented 6 years ago

I'm running Arch Linux, so I used the repository linked here.. I had to hard-code the paths to ffmpeg, mkvextract, mkvinfo, and mkvmerge in the source code to make the script work at all.

After running the script on the Coalgirls release of Kämpfer (which has only one ending song, but a different opening for the last two episodes), none of the resulting files had dialogue or song subtitles (though there appeared to be baked subs of the episode title in German). I saw a couple other bug reports on here suggesting that I need to change my locale, but I checked and it was already set to English. Here is the output of "locale":

LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=

I also noticed a couple other strange problems. In episode one, the opening song starts exactly 15 seconds later than it should; in episode 2, the opening is in the right place, but the video fails exactly where the ending is supposed to start (unless you manually skip to a few seconds past there, in which case it works); in episode 3, not only is the opening a few seconds late, but there are unwatchably horrible compression artifacts during the opening and ending animation that don't appear elsewhere. I haven't bothered to look in later episodes since I assume this sort of thing happened in all of them.

The command I used to run the program was ~/unlinkmkv-git/pkg/unlinkmkv-git/usr/bin $ ./unlinkmkv --output ~/Desktop/KEEMPFER/ -ll TRACE ~/Desktop/\[Coalgirls\]_Kampfer_\(1920x1080_Blu-Ray_FLAC\)/ > ~/Desktop/help.txt (I had created a folder named "KEEMPFER" on the desktop for testing purposes)

This is the log that that command generated:

help.txt

I tried running with the --fixaudio and --fixvideo options, but that always resulted in a build failure (as in the script did not produce any output files), even when I included other options like -fs and --ignoredefaultflag.

This is where it gets weird: I also tried all of this on Windows (installed on the same hardware), using the compiled binary provided in the dist/ folder. The result of this was the EXACT SAME errors, except the subtitles worked perfectly (as in, even if the opening was offset wrong, the subtitles were offset wrong by the same amount). I should also note that the script was noticeably slower on Windows: running the vanilla script took about 30 minutes vs about 3 minutes on Linux.

I would prefer a linux-specific solution to this problem, however, as I have been and intend to continue using Arch Linux as my primary operating system.

The thing is, the files work as originally released when I play them in VLC media player on my computer, but I need to put them on a Plex server, which doesn't support ordered chapters. I was literally about to try to write a script like this myself when I found this one. I haven't tested it on anything else with ordered chapters, so it could very well be that this particular release has some horrible encoding problem that VLC doesn't care about, being the "all-purpose" media player it is.

Any help is much appreciated.

gnoling commented 6 years ago

Linux has always been the primary platform, I only distribute a dist for windows to ease up on Issues from people simply trying to set it up at all on windows. I'm not familiar with the arch package, that's not by me -- looking at it it looks like it sources from here, but it doesn't set up the configuration file which is why you had to set up the paths the way you did.

Coalgirls releases tend to be problematic, I suspect this is a problem with the resulting chapter data. Can you take one of the built/broken files and strip the chapter data from them? Like so:

/usr/bin/mkvmerge --no-chapters -o testfile.mkv [Coalgirls]_Kampfer_02_(1920x1080_Blu-Ray_FLAC)_[C6B6CA13].mkv

And see if testfile.mkv plays correctly without chapters?

isrealityreallyreal commented 6 years ago

Unfortunately, that did not work. There are still no subtitles (as in no sub track is listed in VLC and none are burned either) and episode 2 still breaks where the ending song should start.

isrealityreallyreal commented 6 years ago

same with episode 1 -- no subtitles and opening song still starts 5 seconds too late.

gnoling commented 6 years ago

Missing subtitles are fixed; it was caused by newer mkvinfo versions changing their output a bit. I've identified the issue with episode 2 being an unlinkmkv bug during subtitle retiming -- this is not fixed yet.

Update: It would appear this isn't actually an issue with unlinkmkv's subtitle fixing, still investigating.

wallace11 commented 6 years ago

I can confirm the same behavior on latest mkvtoolnix version.

isrealityreallyreal commented 6 years ago

I finally got around to testing this program with a different set of videos, namely the KAA release of Sailor Moon (linked here). The result was pretty much exactly what I expected: there were no weird timing issues or compression artifacts like there were for Kämpfer, but the only subtitles that showed up were the ones that were already burned into the opening and ending videos. You said previously that you had fixed the subtitle issue, but I don't see any recent commits and there is only one branch, so I am unsure how to apply any changes you may have made.

It took me three tries to get the script to output anything at all: ~/unlinkmkv-git/pkg/unlinkmkv-git/usr/bin $ ./unlinkmkv --outdir ~/Desktop/SERA_MOON/ -ll TRACE ~/Downloads/Sailor\ Moon > ~/Desktop/help.txt

~/unlinkmkv-git/pkg/unlinkmkv-git/usr/bin $ ./unlinkmkv --outdir ~/Desktop/SERA_MOON/ --no-chapters -ll TRACE ~/Downloads/Sailor\ Moon > ~/Desktop/help.txt

~/unlinkmkv-git/pkg/unlinkmkv-git/usr/bin $ ./unlinkmkv --outdir ~/Desktop/SERA_MOON/ --no-chapters --ignoredefaultflag -ll TRACE ~/Downloads/Sailor\ Moon > ~/Desktop/help.txt

The first two tries took a couple seconds each and resulted in build failures. The third try, however, took about a minute and produced files that had the openings and endings in the right place, but no subtitles, as previously mentioned. Here is the resulting help text:

help.txt

I hope this information helps you solve one or the other issue, be it from what did work here that didn't work for Kämpfer, or what failed in common between the two.

isrealityreallyreal commented 6 years ago

I just realized I never tried running the --ignoredefaultflag without the --no-chapters, but it turns out that it has exactly the same results, so the problem probably doesn't stem from the --no-chapters flag.

gnoling commented 6 years ago

My mistake! It was indeed in an unpublished branch, I've pushed the next version's branch titled "Metadatafixes" which also contains the fixes I mentioned.

There's no need to test for the other issue I mentioned, I know the cause of it. What's happening is the script is adjusting the timing incorrectly in the subtitle files, and what happens is that when the segments are appended later this causes the timing for the "main" segment to run longer then the audio/video actually is -- because subtitles are also a stream -- which causes the problem in the ending segment you mentioned. This is a more complicated fix that I haven't had time to work on.

isrealityreallyreal commented 6 years ago

It took me a while to figure out how to clone a branch other than master, but once I did, the script worked great for Sailor Moon after I made the .ini file (as in, the subtitles showed up and there were no timing issues). I am currently testing this version on Kämpfer.

isrealityreallyreal commented 6 years ago

Once again, it worked exactly as expected. When I applied the new script to Kämpfer, it fixed the subtitle problem, but all the other issues were still there. I've decided I don't really care about the opening and/or ending songs being a few seconds off, since the subtitles are still offset by the right amount. However, I can't have the video randomly break or suddenly become horribly compressed, as this makes it totally unwatchable. My suggestion is to focus on those issues before trying to fix the timing thing, assuming the causes are unrelated (which they might not be).

aaronstc1 commented 5 years ago

Is this an ongoing issue? The files rejoining at the wrong place? Don't want to start a new issue if so.

I have a series where this is the case and also the subtitles get really small.

gnoling commented 5 years ago

Is this an ongoing issue? The files rejoining at the wrong place? Don't want to start a new issue if so.

I have a series where this is the case and also the subtitles get really small.

This issue is still open, yeah. Whether it's the same issue remains to be seen, could you please include a full log (include -ll trace on the command line). You can write it directly to a log file as well, isrealityreallyreal's initial report includes the command he used to do this as well.

aaronstc1 commented 5 years ago

help.txt

Sorry if this is a bit much. I can send you another with just one file. I'm inclined to think it might be the encode that's the problem though as I'm getting other video issues I haven't noticed until now (but only after unlinked).

gnoling commented 5 years ago

@aaronstc1 I've opened issue #35 to track your report (it's not related to this issue).

dobbleg1000 commented 4 years ago

I am having at least part of this issue where the ending there must be like a section of playableness right at the ending. VLC just pauses when the ending starts. and MPV jumps about 30 seconds and then the ending begins a little late like the first 6 seconds are cut off. It happens with or without fix audio (though it seems to be ignored on windows. and removing the chapters does not help either. help.txt

gnoling commented 4 years ago

I am having at least part of this issue where the ending there must be like a section of playableness right at the ending. VLC just pauses when the ending starts. and MPV jumps about 30 seconds and then the ending begins a little late like the first 6 seconds are cut off. It happens with or without fix audio (though it seems to be ignored on windows. and removing the chapters does not help either. help.txt

@dobbleg1000 I went ahead and moved your report into a separate issue, #48