Skip to content

decavsub: add general purpose avcodec subtitle decoder - #2495

Closed
jstebbins wants to merge 10 commits into
HandBrake:masterfrom
jstebbins:avsubs
Closed

jstebbins wants to merge 10 commits into
HandBrake:masterfrom
jstebbins:avsubs

Conversation

@jstebbins

@jstebbins jstebbins commented Dec 8, 2019 •

Copy link
Copy Markdown
Contributor

Currently using it for pgs, srt, and ssa subtitles.

Fixes srt font face parsing.

It's fairly easy to add more or convert our current decoders to libav. I'll look into converting our vobsub and cc608 subtitle decoders to use libav as well. And adding dvbsubs should be relatively easy.

Test on:

  • Windows 10+ (via MinGW)
  • macOS 10.13+
  • Ubuntu Linux

@sr55

sr55 commented Dec 11, 2019 •

Copy link
Copy Markdown
Contributor

Related issues:
#982 DVB Subtitles
#1799 CC608 / 708
#2494 SRT Subtitle font
#2449 Subtitle Rendering issues

@sr55

sr55 commented Dec 14, 2019 •

Copy link
Copy Markdown
Contributor

Some preliminary testing on Windows:

Subtitle Type Test Tested
VobSub Passthru Pass
VobSub Burn-in Pass
ASS Passthru Pass
ASS Burn-in Pass
ASS Burn-in + Offset Pass
SRT Passthru Pass
SRT Burn-in Pass (Including Bold, Italitc etc)
CC608 Passthru Pass
CC608 Burn-in Odd Rendering (Screenshots below)
PGS Passthru Pass
PGS Burn-in Pass

image
vs passthru:

image

@jstebbins

Copy link
Copy Markdown
Contributor Author

Nice! Thanks for all the testing. I think I have that particular sample you see the odd rendering with (I recognize that desert scene 😉 ) I'm seeing broken timing of the subtitles with that sample, will look into that. The rendering is almost the same with the player I use (mpv) so the font size difference must be your player making an odd choice. The the position is too close to the bottom and subtitles are being cropped when burned in.

@sr55

sr55 commented Dec 15, 2019 •

Copy link
Copy Markdown
Contributor

It's VLC and yes, it's the Doctor who sample :)

@jstebbins

jstebbins commented Dec 15, 2019 •

Copy link
Copy Markdown
Contributor Author

I get identical results between burned, mpv, and vlc. Could be a difference in font selection on windows. On linux CC font is "monospace" which resolves to "DejaVuSansMono" on my system. And on windows CC uses "Lucida Console". We chose that a while back for windows because monospace resulted in selection of "Courier New" which looked awful. Maybe Lucida Console has limited range of font sizes? The definition of this is in handbrake/internal.h HB_FONT_MONO if you want to try other fonts.

@sr55

sr55 commented Dec 16, 2019

Copy link
Copy Markdown
Contributor

20 is better.

Maybe something we can make configurable down the line.

Currently using it for pgs, srt, and ssa subtitles.
passthrough will hopefully come later ;)
simplifies code, eliminates deccc608sub.c
Simplifies code, removes encvobsub.c (was never used) and decvobsub.c.
This seems to be what ffmpeg expects.  This way we also mux it correctly
into mkv, i.e. without the trailing 0xff stuffing byte.
The "clear" subtitle packets were not making it through to the muxer
The larger font size was causing rendering outside the frame boundaries
@sr55

sr55 commented Mar 29, 2020

Copy link
Copy Markdown
Contributor

Shall we push this and let folks have a play?

@jstebbins

Copy link
Copy Markdown
Contributor Author

Be sure to make ffmpeg.xclean if you are testing from an existing build. There are patches that must be applied.

@jstebbins jstebbins closed this Mar 29, 2020
@jstebbins

jstebbins commented Mar 29, 2020 •

Copy link
Copy Markdown
Contributor Author

FYI, the features this adds are

  • More complete handling of SRT formatting tags
  • DVB subtitle burn-in and "passthrough" to mkv. mp4 must be burned (bitmap subs)

@cehoyos

cehoyos commented Mar 29, 2020

Copy link
Copy Markdown

Please send your patches upstream for review.

@cehoyos

cehoyos commented Mar 29, 2020

Copy link
Copy Markdown

And while there, please look at FFmpeg tickets 7377, 7389, 7572, 8070 and 8502

@jstebbins

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants