justdan96 / tsMuxer

tsMuxer is a transport stream muxer for remuxing/muxing elementary streams, EVO/VOB/MPG, MKV/MKA, MP4/MOV, TS, M2TS to TS to M2TS. Supported video codecs H.264/AVC, H.265/HEVC, VC-1, MPEG2. Supported audio codecs AAC, AC3 / E-AC3(DD+), DTS/ DTS-HD.
Apache License 2.0
849 stars 144 forks source link

Can't remux MP4: “MP4/MOV error: Invalid SRT frame” #607

Closed rkjnsn closed 2 years ago

rkjnsn commented 2 years ago

I have an MP4 file that I'm trying to remux into an MP4 file. If I try to add it to the GUI, nothing happens. Running the command-line tool in track detection mode, however, I get

tsMuxeR version git-d3c495d. github.com/justdan96/tsMuxer
Error: MP4/MOV error: Invalid SRT frame at position 2240905

The file plays fine, however, and I was able to remux it into an MKV and import that into tsMuxer. It'd be nice to avoid the extra step, though. If there's an error with one of the tracks, it seems like it would make more sense to skip it with a warning instead of refusing to work with the file altogether.

jcdr428 commented 2 years ago

@rkjnsn can ypu please provide the mp4 provoking the bug.

rkjnsn commented 2 years ago

Attached a small segment that demonstrates the problem.

https://user-images.githubusercontent.com/7364197/170848014-2a39d784-fddf-42a3-8018-3914b90c5648.mp4

jcdr428 commented 2 years ago

@rkjnsn no video attached (message "No video with supported format and MIME type found"). Can you please provide a link ? Or if the srt is enough to provoke the bug in tsMuxer, please upload the srt in github.

rkjnsn commented 2 years ago

Agh. Looks like Github decided to make things complicated by embedding the link as a video. You can still right click it and select copy video link (on my browser, at least), but here's the URL directly: https://user-images.githubusercontent.com/7364197/170848014-2a39d784-fddf-42a3-8018-3914b90c5648.mp4

jcdr428 commented 2 years ago

@rkjnsn there are some text modifiers that tsMuxer does not seem to parse correctly. I have applied a quick patch, can you try tomorrow. The modification of the SRT according to the modifier (in this case, italics on part of the subtitle) is still to be done.

rkjnsn commented 2 years ago

With the May 31st Linux build, I get this error with the full file:

tsMuxeR version git-d77bf22. github.com/justdan96/tsMuxer
double free or corruption (out)

I see that doesn't happen with the sample I uploaded, so I'll see if I can create a sample that triggers it in the next day or two.

jcdr428 commented 2 years ago

@rkjnsn indeed I tested the fix with Windows, I forgot that with Linux the subtitles were going through freetype. Anyway MP4 subtitles with inline modifiers seem to be rare enough, I'll wait for your sample.

Edit: decoding the text style modifiers is actually a substantial addition https://github.com/FFmpeg/FFmpeg/blob/3a7e9caf920c9949076c5e51651d3e99b19e295b/libavcodec/movtextdec.c#L499 I suppose your mp4 includes other modifiers than the 'styl' box provided in the sample.

jcdr428 commented 2 years ago

@rkjnsn I have pushed a fix to fully remove the parsing of the tx3g modifiers until it is implemented. Please try tomorrow or try https://github.com/justdan96/tsMuxer/suites/6731994755/artifacts/256788981.

I am still interested by your samples, I could not find any mp4 sample using tx3g modifiers on the net.

rkjnsn commented 2 years ago

The 2022-06-02 build does indeed process the file without crashing. As expected, however, all italics are lost unless I first use an external tool to convert them to an external .srt file and add that.

I'm having trouble extracting a sample that reproduces the double free or corruption (out) crash on 2022-05-31. The full file is about 10 GiB. Is there a good way to get that to you?

jcdr428 commented 2 years ago

For 10GB the best would be to create a bittorrent link with an open tracker.

rkjnsn commented 2 years ago

Alright, I sent you an e-mail. Let me know if there's a better way to get it to you.

justdan96 commented 2 years ago

Mega.co.nz gives you 20GB free storage, Google Drive gives you 15GB I think.

jcdr428 commented 2 years ago

@rkjnsn please try tomorrow's release, thanks. Edit: closing, can be reopened on request.