Fix: update TextTrack to handle SRT file conversion and location mana… #200
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem Summary
Cause:
After a subtitle was converted/renamed to .srt, the
TextTrackobject continued to point (self._location) to the original path ending in.mp4. When muxing,mkvmergereceived the.mp4path (which didn't exist) and failed with an "open file error."Example of the error you showed: mkvmerge tried to open
~/VT-PR/Temp/TextTrack_en-us_subtitle_dialog_0_dec.mp4but the subtitle was actually in.srtformat.Fixes:
Update
self._locationwhen the file is renamed to.srt.When converting formats (when
self.codec != "srt"), I now explicitly write the SRT to a file with the.srtextension, remove the original container file, and updateself._locationto point to the.srtfile.I kept the behavior of returning the actual path of the final file (now returns
.srtwhen applicable).How is this the case?
After the fix,
TextTrack._locationnow points toTextTrack_... .srt. In the mux step,Tracks.mux()callsst.locate()and gets the correct.srtpath, somkvmergewon't try to open a non-existent.mp4.Fix these issues: #144 #162 #182