SVN6142 Breaks subtitles in ts files

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5722
Joined: Sat Feb 09, 2008 7:21 pm

Re: SVN6142 Breaks subtitles in ts files

Post by JohnAStebbins »

HandyMan wrote:https://www.sendspace.com/file/tgpscu

Why are the subs located in the bottom/top left corner ? Could we have an option to specify bottom/top centered at some point?
The subs are located where the CC stream says they should be positioned. In this case, what HandBrake is showing accurately reflects what is in the CC stream. The subtitles are changeing position because the CC stream says they should.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5722
Joined: Sat Feb 09, 2008 7:21 pm

Re: SVN6142 Breaks subtitles in ts files

Post by JohnAStebbins »

HandyMan wrote:Here is another sample where the italics continue where it should not

https://www.sendspace.com/file/maxdkr
This is a bug. I'm working on it.
HandyMan
Bright Spark User
Posts: 169
Joined: Tue Aug 07, 2012 10:52 pm

Re: SVN6142 Breaks subtitles in ts files

Post by HandyMan »

JohnAStebbins wrote:
HandyMan wrote:https://www.sendspace.com/file/tgpscu

Why are the subs located in the bottom/top left corner ? Could we have an option to specify bottom/top centered at some point?
The subs are located where the CC stream says they should be positioned. In this case, what HandBrake is showing accurately reflects what is in the CC stream. The subtitles are changeing position because the CC stream says they should.
Strange ... watching with NextPVR, VideoRedo or Media Player Classic and they are centered :shock: .
Deleted User 11865

Re: SVN6142 Breaks subtitles in ts files

Post by Deleted User 11865 »

These players must ignore the positioning information present in the stream.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5722
Joined: Sat Feb 09, 2008 7:21 pm

Re: SVN6142 Breaks subtitles in ts files

Post by JohnAStebbins »

HandyMan wrote:Strange ... watching with NextPVR, VideoRedo or Media Player Classic and they are centered :shock: .
Just as an example, I logged some of the text positions from the CC stream so I could see what we are dealing with. In the First 2 CCs, the column position was 4. In the 3rd the column position was 2. CC lays out text in a grid that is 32 cells tall and wide. So a difference of 2 is going to be about 1/16 of the width of the video, or about 80 px.
HandyMan
Bright Spark User
Posts: 169
Joined: Tue Aug 07, 2012 10:52 pm

Re: SVN6142 Breaks subtitles in ts files

Post by HandyMan »

With SVN6408 the last line of subtitle sometimes get truncated.
You can reproduce it with previous sample Et Dieu créa Laflaque - S10E30 20140907_19302000 sample.ts https://www.sendspace.com/file/maxdkr at 1m02s.

The lines:
de peanut, là, c'est vraiment
écoeurant!
are missing
User avatar
JohnAStebbins
HandBrake Team
Posts: 5722
Joined: Sat Feb 09, 2008 7:21 pm

Re: SVN6142 Breaks subtitles in ts files

Post by JohnAStebbins »

This is a side effect of buffering lines until we have the entire line before "showing" the new subtitle line. Rollup CCs are designed to be shown immediately as each character is received. We are receiving the last character for that line and then immediately getting a command to clear the display. So you never see that line.

The only alternative is to flush out the received characters either immediately as they are received, which means a new subtitle for *every* character. Or do somethign in between where we buffer for some maximum time period and then flush. Either way, you will see characters appear on the screen one at a time or in small bursts. Note that every subtitle we generate contains the entire CC message up to the most recent character received. So generating a subtitle per received character will increase the size of the subtitle track exponentially. So my preference is to collect a few characters at a time and flush them out something like every 200 to 300 ms.
HandyMan
Bright Spark User
Posts: 169
Joined: Tue Aug 07, 2012 10:52 pm

Re: SVN6142 Breaks subtitles in ts files

Post by HandyMan »

Thanks again for looking into this.

I will test the fix with another ts where this happens quite often and give you a feedback.
HandyMan
Bright Spark User
Posts: 169
Joined: Tue Aug 07, 2012 10:52 pm

Re: SVN6142 Breaks subtitles in ts files

Post by HandyMan »

Tested with SVN6409 and the problem persist.
Here is another sample where many lines are not displaying.
https://www.sendspace.com/file/0jisi5

I agree with you that displaying character one at a time grow a srt from 37Kb to 750KB just for a 22min episode. Not to mention that it's very annoying to see these characters appears one at a time.

Could you buffer them and adjust the sub display start and end time when you receive a line position changes command or a clear display command?
Deleted User 11865

Re: SVN6142 Breaks subtitles in ts files

Post by Deleted User 11865 »

HandyMan wrote:Could you buffer them and adjust the sub display start and end time when you receive a line position changes command or a clear display command?
That would unfortunately require buffering associated video frames too, which is a lot more memory-intensive than buffering subtitle packets…
HandyMan
Bright Spark User
Posts: 169
Joined: Tue Aug 07, 2012 10:52 pm

Re: SVN6142 Breaks subtitles in ts files

Post by HandyMan »

Rodeo wrote:
HandyMan wrote:Could you buffer them and adjust the sub display start and end time when you receive a line position changes command or a clear display command?
That would unfortunately require buffering associated video frames too, which is a lot more memory-intensive than buffering subtitle packets…
What about processing sub in the pipeline ahead (like 1-2 minutes) of the video pipeline ?
Deleted User 11865

Re: SVN6142 Breaks subtitles in ts files

Post by Deleted User 11865 »

Closed Captions are encoded as "extradata" in the video stream. You have to parse and decode the video stream to obtain the subtitle packets.
HandyMan
Bright Spark User
Posts: 169
Joined: Tue Aug 07, 2012 10:52 pm

Re: SVN6142 Breaks subtitles in ts files

Post by HandyMan »

I was thinking of an subtitle pipeline ahead of a video ENcode pipeline.
Deleted User 11865

Re: SVN6142 Breaks subtitles in ts files

Post by Deleted User 11865 »

That still means we would have to buffer the decoded video frames (which are uncompressed)…
HandyMan
Bright Spark User
Posts: 169
Joined: Tue Aug 07, 2012 10:52 pm

Re: SVN6142 Breaks subtitles in ts files

Post by HandyMan »

And I have seen subtitle lasting minutes on some encode ... that would make memory grow too much.

Could an option be to 'pre-process' the entire ts file to extract the rollup sub before starting the encode?
User avatar
JohnAStebbins
HandBrake Team
Posts: 5722
Joined: Sat Feb 09, 2008 7:21 pm

Re: SVN6142 Breaks subtitles in ts files

Post by JohnAStebbins »

I haven't finished implementing my proposed "fix" yet, much less committed it. What I have so far still has problems. And since I an traveling, it may not be finished for a bit.
HandyMan
Bright Spark User
Posts: 169
Joined: Tue Aug 07, 2012 10:52 pm

Re: SVN6142 Breaks subtitles in ts files

Post by HandyMan »

Thanks for the update, there is no need to rush, I can use CCextractor to get SRT from ts file.
HandyMan
Bright Spark User
Posts: 169
Joined: Tue Aug 07, 2012 10:52 pm

Re: SVN6142 Breaks subtitles in ts files

Post by HandyMan »

I tested SVN 6422 and the last line fix seems to be fine
Thank you again
HandyMan
Bright Spark User
Posts: 169
Joined: Tue Aug 07, 2012 10:52 pm

Re: SVN6142 Breaks subtitles in ts files

Post by HandyMan »

Hello

I got these with one ts file

Code: Select all

[00:10:04] Bug in roll_up, should have 3 lines but I have 4.
[00:10:04] Bug in roll_up, should have 3 lines but I have 4.
[00:10:05] Bug in roll_up, should have 3 lines but I have 5.
[00:10:05] Bug in roll_up, should have 3 lines but I have 5.
[00:10:07] Bug in roll_up, should have 3 lines but I have 4.
[00:10:07] Bug in roll_up, should have 3 lines but I have 4.
[00:13:32] Bug in roll_up, should have 2 lines but I have 3.
[00:13:32] Bug in roll_up, should have 2 lines but I have 3.
[00:13:32] Bug in roll_up, should have 2 lines but I have 3.
[00:13:32] Bug in roll_up, should have 2 lines but I have 3.
[00:13:32] Bug in roll_up, should have 2 lines but I have 3.
[00:13:32] Bug in roll_up, should have 2 lines but I have 3.
[00:13:33] Bug in roll_up, should have 2 lines but I have 3.
[00:13:33] Bug in roll_up, should have 2 lines but I have 3.
Would it be possible to get a time stamp or a frame number indication of where it is happening in the source? Or simply output the CC text in the log file?
Deleted User 11865

Re: SVN6142 Breaks subtitles in ts files

Post by Deleted User 11865 »

Maybe, though I'm sure j45 would like a sample of this ;)
HandyMan
Bright Spark User
Posts: 169
Joined: Tue Aug 07, 2012 10:52 pm

Re: SVN6142 Breaks subtitles in ts files

Post by HandyMan »

Rodeo wrote:Maybe, though I'm sure j45 would like a sample of this ;)
Ok I prepared a 60 MB sample that reproduce the warning in SVN6422
https://www.sendspace.com/file/5qbgbg
User avatar
JohnAStebbins
HandBrake Team
Posts: 5722
Joined: Sat Feb 09, 2008 7:21 pm

Re: SVN6142 Breaks subtitles in ts files

Post by JohnAStebbins »

Been unplugged for a few days, but I have the sample now. Will look at it later today. Thanks!
User avatar
JohnAStebbins
HandBrake Team
Posts: 5722
Joined: Sat Feb 09, 2008 7:21 pm

Re: SVN6142 Breaks subtitles in ts files

Post by JohnAStebbins »

I found 2 problems when analyzing that sample, so thanks!
Fixed
https://trac.handbrake.fr/changeset/6453
https://trac.handbrake.fr/changeset/6454
HandyMan
Bright Spark User
Posts: 169
Joined: Tue Aug 07, 2012 10:52 pm

Re: SVN6142 Breaks subtitles in ts files

Post by HandyMan »

Great :)
Will test when it becomes available in the nightly (it's hasn't changed from SVN6443 for sometimes now)
Deleted User 11865

Re: SVN6142 Breaks subtitles in ts files

Post by Deleted User 11865 »

Yeah, we're having build system issues currently.
Post Reply