This is related to a separate issue that I'm having but I wanted to ask a new question so as not to conflate things.
I have an MP4 file "input.mp4" which has a tx3g subtitle stream that I would like to extract, ideally as an SRT. Here is a mediainfo excerpt:
Here is my experience extracting the subtitles with various software:Code:General Complete name : D:\input.mp4 Format : MPEG-4 Format profile : Base Media / Version 2 Codec ID : mp42 (mp42/isom/iso2/iso5/dash/avc1/dby1/mp41) File size : 5.79 GiB Duration : 2 h 39 min Overall bit rate : 5 188 kb/s [...] Text ID : 4 Format : Timed Text Muxing mode : sbtl Codec ID : tx3g Duration : 2 h 39 min Bit rate : 131 b/s Stream size : 153 KiB (0%) Language : German Default : Yes Forced : No Alternate group : 2
- MKVToolNix GUI does not recognize the subtitle stream.
- My MP4Box GUI recognizes the subtitle stream (file information: "Text - Timed text"), but fails at extracting it.
- LosslessCut similarly recognizes the stream (tag "t3xg", codec "mov_te") and also fails to extract it.
- ffmpeg: "ffmpeg -i input.mp4 subs.srt" and XMedia Recode output almost the exact same file:The only difference is that the final entry (4822) is not included in XMedia's output file. Note that all of the subtitle durations are 0, which makes them unusable. The timestamps are correct, though.Code:1 00:00:02,440 --> 00:00:02,440 <font face="Serif" size="18">* ER SCHLUCHZT *</font> 2 00:00:03,200 --> 00:00:03,200 <font face="Serif" size="18">* ER SCHLUCHZT *</font> 3 00:00:04,800 --> 00:00:04,800 <font face="Serif" size="18">* ER SCHLUCHZT *</font> 4 00:00:05,920 --> 00:00:05,920 <font face="Serif" size="18">So ist das nicht richtig.</font> 5 00:00:06,400 --> 00:00:06,400 <font face="Serif" size="18">So ist das nicht richtig.</font> 6 00:00:08,000 --> 00:00:08,000 <font face="Serif" size="18">So ist das nicht richtig.</font> 7 00:00:09,600 --> 00:00:09,600 <font face="Serif" size="18">So ist das nicht richtig.</font> [...] 4818 02:39:38,960 --> 02:39:38,960 <font face="Serif" size="18">Also, wie bist du zur Waise geworden?</font> 4819 02:39:39,200 --> 02:39:39,200 <font face="Serif" size="18">Also, wie bist du zur Waise geworden?</font> 4820 02:39:40,800 --> 02:39:40,800 <font face="Serif" size="18">Also, wie bist du zur Waise geworden?</font> 4821 02:39:42,000 --> 02:39:42,000 <font face="Serif" size="18">Oh, verstehe. Ist kompliziert, richtig?</font> 4822 02:39:42,400 --> 02:39:42,400 <font face="Serif" size="18">Oh, verstehe. Ist kompliziert, richtig?</font>
- MP4Box: "mp4box input.mp4 -srt 4" outputs the following:Compared to ffmpeg's output, the subtitle durations are now correct, BUT the subtitle file abrupty ends more than 40 minutes before the end of the movie. Also, the font information is gone, but I don't really care about that. When running the above MP4Box command, I get the error messagesCode:1 00:00:02,440 --> 00:00:03,200 * ER SCHLUCHZT * 2 00:00:03,200 --> 00:00:04,800 * ER SCHLUCHZT * 3 00:00:04,800 --> 00:00:05,520 * ER SCHLUCHZT * 4 00:00:05,920 --> 00:00:06,400 So ist das nicht richtig. 5 00:00:06,400 --> 00:00:08,000 So ist das nicht richtig. 6 00:00:08,000 --> 00:00:09,600 So ist das nicht richtig. 7 00:00:09,600 --> 00:00:10,640 So ist das nicht richtig. [...] 3637 01:55:19,280 --> 01:55:20,000 * Alarm geht los * 3638 01:55:20,000 --> 01:55:21,600 * Alarm geht los * 3639 01:55:21,600 --> 01:55:22,320 * Alarm geht los * 3640 01:55:24,440 --> 01:55:24,800 Legen Sie bitte alle Metallgegenstände ab: 3641 01:55:24,800 --> 01:55:26,400 Legen Sie bitte alle Metallgegenstände ab: 3642 01:55:26,400 --> 01:55:26,640 3643 01:55:26,640 --> 01:55:28,000 3644 01:55:28,000 --> 01:55:29,600Code:[iso file] Unknown box type 6F660000(73/100) [iso file] Unknown box type 14000000 [iso file] Unknown box type 72756E01 Conversion failed (BitStream Not Compliant)
To summarize, ffmpeg gives me unusable subtitles with display durations of 0, while MP4Box gives me usable subtitles which however end too early.
How do I fix either of those issues so I can get a usable SRT file?
Thank you in advance!
+ Reply to Thread
Results 1 to 22 of 22
[Script Info] ; Script generated by FFmpeg/Lavc58.54.100 ScriptType: v4.00+ PlayResX: 384 PlayResY: 288 [V4+ Styles] Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding Style: Default,Serif,18,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0 [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:02.44,0:00:02.44,Default,,0,0,0,,* ER SCHLUCHZT * Dialogue: 0,0:00:03.20,0:00:03.20,Default,,0,0,0,,* ER SCHLUCHZT * Dialogue: 0,0:00:04.80,0:00:04.80,Default,,0,0,0,,* ER SCHLUCHZT * Dialogue: 0,0:00:05.92,0:00:05.92,Default,,0,0,0,,So ist das nicht richtig. Dialogue: 0,0:00:06.40,0:00:06.40,Default,,0,0,0,,So ist das nicht richtig. Dialogue: 0,0:00:08.00,0:00:08.00,Default,,0,0,0,,So ist das nicht richtig. Dialogue: 0,0:00:09.60,0:00:09.60,Default,,0,0,0,,So ist das nicht richtig. [...]
It's really weird that MP4Box is the only software which seems to recognize the correct subtitle duration. (And unfortunate that it's also the only software with this premature subtitle cut-off issue.)
Last edited by davexnet; 18th Jul 2021 at 21:08.
My MP4Box GUI and just as described, there is a popup saying that the timed text subtitle stream has been recognized. But when I click on Demux, simply nothing happens. On the bottom it just says "Ready...", and no subtitles are extracted anywhere. I have tried My MP4Box GUI with other MP4 files (which have SRT subtitles), and the demuxing works just fine. But unfortunately not in this case.
Maybe this is not too surprising because the tool is based on MP4Box, and MP4Box (the command-line tool) does actually say that the "conversion failed" when trying to extract the subtitles, so one might expect MP4Box GUI to fail as well. Only difference is that MP4Box still outputs a (somewhat broken) SRT file, while the GUI version produces nothing at all.
Opening an MP4 directly in Subtitle Edit is something I hadn't yet considered, but unfortunately the subtitle table stays empty when I try.
I have uploaded the file in question here. Apologies for the large file size (5.79GB); I would have just shared a small excerpt but keep in mind that cutting the video is exactly where all of the issues arise in my case. So I can only share the whole file. Hope you or somebody can see what's going on here.
I have been down exactly the same road without success. Finally in desperation I decided to make a dummy copy via Vidcoder selecting the fastest encode, lousy video resolution and sound down to stereo bit the subs are there. Started to process and finally after 4 hours had a new MKV file with subs. Extracted the subs and they were ok. Transferred the subs into my real MKV files. I would love a simpler viable solution, so there is the ability in Vidcoder and presumably Handbrake to handle timed text correctly.SONY 75" Full array 200Hz LED TV, Yamaha A1070 amp, Zidoo UHD3000, BeyonWiz PVR V2 (Enigma2 clone), Chromecast, Windows 7 Ultimate, QNAP NAS TS851
PS. the files emerged as .ass format.SONY 75" Full array 200Hz LED TV, Yamaha A1070 amp, Zidoo UHD3000, BeyonWiz PVR V2 (Enigma2 clone), Chromecast, Windows 7 Ultimate, QNAP NAS TS851
pay for a "plan" to complete the download. What a scam. More for my own curiosity, that's all
Perhaps netmask56's plan will work
Well my workaround works for me, so far I've done 5 files without issue but it's an unsatisfactory way of doing it. Surely there must a program to easily and successfully demux all elements in an MP4 file?SONY 75" Full array 200Hz LED TV, Yamaha A1070 amp, Zidoo UHD3000, BeyonWiz PVR V2 (Enigma2 clone), Chromecast, Windows 7 Ultimate, QNAP NAS TS851
MKVCleaver does actually see a "Subtitle Track [ASS] (German)". Unfortunately, when you extract the subtitles, the .ass file is completely empty (i.e. it ends after the [Events] section).
However, while the reencoding was happening, I stumbled upon a different tool called BOX4. Using this tool, I converted the MP4 into an MKV (without reencoding, so within minutes!) and the resulting file – at last – had a subtitle stream that could be exported by MKVCleaver into a working SRT. Of course it would be too easy if this SRT file was actually perfect Here's an excerpt from the MP4Box subtitles:Code:
227 00:08:52,800 --> 00:08:53,320 (Polizist 2:) Hände hoch! Na los! Wirds bald! 228 00:09:12,920 --> 00:09:13,600 Lieutenant.Code:
227 00:08:52,821 --> 00:09:12,941 <font face="Serif" size="18">(Polizist 2:) Hände hoch! Na los! Wirds bald!</font> 228 00:09:12,941 --> 00:09:13,621 <font face="Serif" size="18">Lieutenant.</font>
At the end of the day, subtitles being shown for too long is the most minor issue I've had with my file so far, so I'd be willing to put up with it (subtitles are actually visible, and the SRT does not end prematurely). It's still a bit annoying though, and in any case, as you say, there has to be an easier (and hopefully less error-prone) way to do it.
Google Drive as well. This should hopefully be free to download.
Last edited by Fleand; 19th Jul 2021 at 13:26.
I downloaded the file (thank you). My first thought is that there is something wrong with the file itself,
it doesn't open properly in either Mpc-HC or Mpc-BE and I have to use the task manager to halt the task
I used the command
ffmpeg -i matrix.mp4 -ss 00:00:00 -t 00:03:00 -c:v copy -c:a copy -c copy matrix_out2.mp4
to copy the streams for 3 minutes to a new clip. This works; in MPC-HC, the subtitles flash onto the screen but for
just a fraction of a second. I'll see what else I can find out
Last edited by davexnet; 20th Jul 2021 at 01:45.
But yes, it's ultimately a minor issue so don't dwell on it for too long if you don't want to
We haven't got anywhere with this. None of the methods we've seen documented, have yielded anything useful
If I find anything further, I'll let you know
If subtitles are present that’s where TSDoctor comes into its own but I don’t think it will edit anything other than broadcast TS files. I use it to edit local TV recorded programs on my Beyonwiz PVR. But my version is very old and I know it won’t handle anything but TS. After editing it can demux all elements present in the file.
Doesn't really help you unfortunately, except more evidence there is something off about that source file, but I created an mp4 with similar subs
then used this to extract the subs to .ass
The resulting subs look good
[Script Info] ; Script generated by FFmpeg/Lavc59.3.102 ScriptType: v4.00+ PlayResX: 384 PlayResY: 288 ScaledBorderAndShadow: yes [V4+ Styles] Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0 [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:01:15.46,0:01:18.59,Default,,0,0,0,,Why's your mother marrying\Non a Friday? I have work to do. Dialogue: 0,0:01:18.83,0:01:21.21,Default,,0,0,0,,Once we've eaten,\NI'm off to the office. Dialogue: 0,0:01:21.38,0:01:23.17,Default,,0,0,0,,Do as you like, darling. Dialogue: 0,0:01:23.46,0:01:26.59,Default,,0,0,0,,- Have I put on too much powder?\N- You always do. Dialogue: 0,0:01:30.13,0:01:32.51,Default,,0,0,0,,And remember, children,\Nyou need to behave. Dialogue: 0,0:01:32.67,0:01:35.17,Default,,0,0,0,,Not like your cousins\Nat the last wedding. Dialogue: 0,0:01:35.33,0:01:37.62,Default,,0,0,0,,They ate too much ice-cream\Nand were ill. Dialogue: 0,0:01:37.88,0:01:40.38,Default,,0,0,0,,And Sylvie, don't interrupt\Nthe grown-ups! Dialogue: 0,0:01:40.67,0:01:44.09,Default,,0,0,0,,Olivier, no elbows on the table.\NThink about your spine.Code:
General Complete name : I:\bin\cc_output.mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/iso2/avc1/mp41) File size : 374 MiB Duration : 1 h 35 min Overall bit rate mode : Variable Overall bit rate : 546 kb/s Writing application : Lavf59.4.101 Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4 Format settings : 4 Ref Frames Format settings, CABAC : No Format settings, Reference frames : 4 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 1 h 35 min Source duration : 1 h 35 min Bit rate : 424 kb/s Width : 480 pixels Height : 360 pixels Display aspect ratio : 4:3 Frame rate mode : Variable Frame rate : 24.000 FPS Minimum frame rate : 23.634 FPS Maximum frame rate : 24.390 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.102 Stream size : 290 MiB (78%) Source stream size : 290 MiB (78%) Writing library : x264 core 148 Encoding settings : cabac=0 / ref=2 / deblock=0:0:0 / analyse=0x3:0x113 / me=hex / subme=4 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=11 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=0 / open_gop=0 / weightp=0 / keyint=250 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=20 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=1400 / vbv_bufsize=4000 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00 mdhd_Duration : 5745087 Codec configuration box : avcC Audio ID : 2 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Codec ID : mp4a-40-2 Duration : 1 h 35 min Bit rate mode : Constant Bit rate : 114 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 44.1 kHz Frame rate : 43.066 FPS (1024 SPF) Compression mode : Lossy Stream size : 77.9 MiB (21%) Language : French Default : Yes Alternate group : 1 Text ID : 3 Format : Timed Text Muxing mode : sbtl Codec ID : tx3g Duration : 1 h 34 min Bit rate mode : Variable Bit rate : 47 b/s Stream size : 32.7 KiB (0%) Default : Yes Forced : No Alternate group : 3