Subtitle Problems

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
sgtjond
Posts: 6
Joined: Sat Sep 26, 2020 1:42 am

Subtitle Problems

Post by sgtjond »

I'm having some problems embedding subtitles into an MP4 video file. The Encoding process completes without any errors, but when watching the video back, the subtitles are either incomplete (confirmed in VLC media player) or the option to turn them on isn't there at all (confirmed in the Default Windows 10 player). And by incomplete, I mean that some of the subtitles display when they should, but most of them don't display at all.

I should also mention that when I manually import the same .srt file I used for the embed process into the media player, the subtitles work as they should, so to me that suggests a problem with the Embed process. I also noted that the encoded file is about 41 MB smaller than the original, which seems a bit weird. Has this happened to anyone else? Did I miss a step? I am new to using this thing, so I think it's likely I missed something.

My current Handbrake version is 1.3.3, and my OS is Windows 10 Home Version 1903.
Woodstock
Veteran User
Posts: 3790
Joined: Tue Aug 27, 2013 6:39 am

Re: Subtitle Problems

Post by Woodstock »

Well, if we had the required activity logs, we could examine what you did, and then see if there is a problem.
rollin_eng
Veteran User
Posts: 3558
Joined: Wed May 04, 2011 11:06 pm

Re: Subtitle Problems

Post by rollin_eng »

Could you please post your HB logs, instructions can be found here:

https://handbrake.fr/docs/en/latest/hel ... y-log.html
sgtjond
Posts: 6
Joined: Sat Sep 26, 2020 1:42 am

Re: Subtitle Problems

Post by sgtjond »

Here's the log file: https://pastebin.com/xVefuXQ7
Woodstock
Veteran User
Posts: 3790
Joined: Tue Aug 27, 2013 6:39 am

Re: Subtitle Problems

Post by Woodstock »

[18:32:18] * subtitle track 1, English [SRT] (track 0, id 0xff000000, Text) -> Passthrough, Default, offset: 0, charset: UTF-8
[18:32:18] + name: English
Are you SURE the SRT file is in UTF-8 format? SRT does not have a default encoding, and if you get it wrong, you can get uncertain results.

MP4 files do not allow SRT files, so handbrake has to translate them to an acceptable format; that conversion is dependent upon knowing the correct encoding.
sgtjond
Posts: 6
Joined: Sat Sep 26, 2020 1:42 am

Re: Subtitle Problems

Post by sgtjond »

Yes, I'm sure the encoding is UTF-8. I even went back and manually resaved the .srt file with UTF-8 encoding selected, and it didn't fix the issue. What subtitle format would be better for .mp4 files?
User avatar
Rodeo
HandBrake Team
Posts: 12604
Joined: Tue Mar 03, 2009 8:55 pm

Re: Subtitle Problems

Post by Rodeo »

There are 17 subtitle packets in the output. Are there supposed to be more?
sgtjond
Posts: 6
Joined: Sat Sep 26, 2020 1:42 am

Re: Subtitle Problems

Post by sgtjond »

There are supposed to be 25.
User avatar
Rodeo
HandBrake Team
Posts: 12604
Joined: Tue Mar 03, 2009 8:55 pm

Re: Subtitle Problems

Post by Rodeo »

Weird. Can you ZIP the subtitle file and upload it somewhere?
sgtjond
Posts: 6
Joined: Sat Sep 26, 2020 1:42 am

Re: Subtitle Problems

Post by sgtjond »

It's not that long, so I stuck it in a pastebin: https://pastebin.com/FwjEDaL9. The only potential problem I can see is the length of each line, but as far as I can tell there's no hard limit for that.
User avatar
Rodeo
HandBrake Team
Posts: 12604
Joined: Tue Mar 03, 2009 8:55 pm

Re: Subtitle Problems

Post by Rodeo »

Code: Select all

% mkvmerge -o test.mks Subrip\ File.srt
mkvmerge v50.0.0 ('Awakenings') 64-bit
'Subrip File.srt': Using the demultiplexer for the format 'SRT subtitles'.
Warning: 'Subrip File.srt' track 0: Error in line 30: expected a SRT timestamp line but found something else. Aborting this file.
'Subrip File.srt' track 0: Using the output module for the format 'text subtitles'.
The file 'test.mks' has been opened for writing.
Progress: 100%
The cue entries (the index) are being written...
Multiplexing took 0 seconds.
That's the cause of the error "sync: subtitle 0xff000000 duration <= 0, PTS 5396940" (but not of the missing subtitle packets, however).

The line in question is:

Code: Select all

 8
-00:00:50.833,766 --> 00:00:53,732
+00:00:50,833 --> 00:00:53,732
 as well as the current stop name and the name of the next stop.
- is the bad line, + is the corrected timestamp.
User avatar
Rodeo
HandBrake Team
Posts: 12604
Joined: Tue Mar 03, 2009 8:55 pm

Re: Subtitle Problems

Post by Rodeo »

Actually that may not have been the cause of the HB log error either. The subtitle with a negative duration is actually:

Code: Select all

 10
-00:00:59,966 --> 00:00:59,333
+00:00:59,966 --> 00:01:06,000
 The system also provides occasional public service announcements, such as a reminder of the current mask mandate
User avatar
Rodeo
HandBrake Team
Posts: 12604
Joined: Tue Mar 03, 2009 8:55 pm

Re: Subtitle Problems

Post by Rodeo »

There are several other instances of malformed subtitles in the file. mkvmerge seems to automatically correct them, but HandBrake expects correct timestamps all over.

Here's all the corrections required:

https://pastebin.com/dpHvVm8t

Code: Select all

diff --git a/Subrip File.old.srt b/Subrip File.new.srt
index d5eddca..c00fc49 100644
--- a/Subrip File.old.srt	
+++ b/Subrip File.new.srt	
@@ -7,27 +7,27 @@ At NAU Shuttle Services, we are one of the most familiar parts of campus life, t
 Because we interact with so many passengers that all have differing needs, it is especially important that we accommodate those needs as best as we can.
 
 3
-00:00:25,033 --> 00:00:30.133
+00:00:25,033 --> 00:00:30,133
 Because of this, we have made it our goal to better serve our passengers that need accommodation.
 
 4
-00:00:30,533 --> 00:00:34.700
+00:00:30,533 --> 00:00:34,700
 Over the past several years, we have been actively pursuing this goal in a number of ways, 
 
 5
-00:00:34,800 --> 00:00:40.366
+00:00:34,800 --> 00:00:40,366
 but the most prominent examples of our efforts are our new low-floor buses and our automated announcement system
 
 6
-00:00:42,533 --> 00:00:46.333
+00:00:42,533 --> 00:00:46,333
 One of our newest innovations is our automated announcement system
 
 7
-00:00:46,766 --> 00:00:50.800
+00:00:46,766 --> 00:00:50,800
 The system automatically announces arrivals and departures from each stop
 
 8
-00:00:50.833,766 --> 00:00:53,732
+00:00:50,833 --> 00:00:53,732
 as well as the current stop name and the name of the next stop.
 
 9
@@ -35,7 +35,7 @@ as well as the current stop name and the name of the next stop.
 This allows anyone who has a visual impairment to easily determine where the bus is on its route
 
 10
-00:00:59,966 --> 00:00:59,333
+00:00:59,966 --> 00:01:06,000
 The system also provides occasional public service announcements, such as a reminder of the current mask mandate
 
 11
@@ -96,4 +96,4 @@ each passenger is transported safely and efficiently regardless of any accommoda
 
 25
 00:02:30,566 --> 00:02:39,366
-Our efforts allow us to not only provide better service to those that rely on these accommodations, but also help us to increase the quality of our service for everyone.
\ No newline at end of file
+Our efforts allow us to not only provide better service to those that rely on these accommodations, but also help us to increase the quality of our service for everyone.
Bottom line is, if you created these files manually, don't, and use subtitle creation/edition software instead. If you did use software, find better software.
User avatar
Rodeo
HandBrake Team
Posts: 12604
Joined: Tue Mar 03, 2009 8:55 pm

Re: Subtitle Problems

Post by Rodeo »

I did find one bug though, when the output is MP4 we seem to be skipping the last packet for no reason, so there's that.
User avatar
Rodeo
HandBrake Team
Posts: 12604
Joined: Tue Mar 03, 2009 8:55 pm

Re: Subtitle Problems

Post by Rodeo »

Might be related to issue 3142 on github, will try and keep track of it.
sgtjond
Posts: 6
Joined: Sat Sep 26, 2020 1:42 am

Re: Subtitle Problems

Post by sgtjond »

I did write the file myself because it didn't look too complicated based on some of the examples I saw, so I guess I was bound to make some mistakes. I'll find some software and try it that way. Thanks for your help, I'll update this thread if I keep having issues.
Post Reply