Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Subtitles
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 4th November 2021, 22:53   #1  |  Link
Earthnuker
Registered User
 
Earthnuker's Avatar
 
Join Date: Mar 2021
Location: Germany
Posts: 11
DVD EIA-608 Closed Captions timing source

Hello everyone,

i am currently working on a tool to extract EIA-608 closed captions from MPEG2 streams demuxed from VOB files. Mainly as a learning excercise but also because ffmpeg's extractor doesn't work properly for me and neither does CCExtractor.

The decoding of the text itself works fine, but from the information i could find (EIA-608 Wikipedia article, VLC source code, ffmpeg source code, mencoder source code) it is not really clear to me where the timestamps for when to display the captions come from, when i use the PTS of the packet containing the "Display Buffer" control command the captions are delayed by a factor of about 12 (i.e. they run 12 times slower than they should).

VLC displays the caption without issue and with proper timing.

i hope someone can point me in the right direction.

(the end goal is to wrap this and some other tooling i wrote up in a script as a headless (maybe i'll add a GUI when everything works), cross-platform alternative to MakeMKV that's aimed at preparing DVDs for filtering using Vapoursynth or AVISynth)

Best regards,

Earthnuker
__________________
Hack the planet!

Last edited by Earthnuker; 4th November 2021 at 23:25.
Earthnuker is offline   Reply With Quote
Old 4th November 2021, 23:36   #2  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,545
http://www.theneitherworld.com/mcpoo...SCC_TOOLS.HTML
https://www.zilog.com/docs/tv/z86229.pdf
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."

Last edited by Emulgator; 5th November 2021 at 00:17.
Emulgator is offline   Reply With Quote
Old 5th November 2021, 00:51   #3  |  Link
Earthnuker
Registered User
 
Earthnuker's Avatar
 
Join Date: Mar 2021
Location: Germany
Posts: 11
Thanks for the reply,

sadly the tools linked on the SCC Tools website are windows only, which defeats the purpose of my endeavor and closed source which allows no easy introspection into how they work.

The datasheet for the Zilog Z86229 NTSC Line 21 CCD Decoder chip, while very interesting, also does not fit my use case, as i am not trying to extract captions from an NTSC broadcast transmitted over the air but from an MPEG2 elementary stream demuxed from a VOB file which was retrieved from a DVD.

Best regards,

Earthnuker
__________________
Hack the planet!
Earthnuker is offline   Reply With Quote
Old 5th November 2021, 01:09   #4  |  Link
Earthnuker
Registered User
 
Earthnuker's Avatar
 
Join Date: Mar 2021
Location: Germany
Posts: 11
I should probably give a quick overview of how my closed-captions extractor works to make sure I'm not missing anything obvious:

- use ffprobe -f lavfi -i movie=foo.m2v[out+subcc] -show_packets to retrieve the position and timestamp of subtitle packets within the mpeg stream
- seek to the corresponding position+42 in the file, make sure there is a 000001B24343 marker
- retrieve caption blocks, process commands and update the state of the caption-rendering state machine accordingly
- if a "Display Buffer" command is received, retrieve all non-empty lines from the current screen buffer and print them to the console, along with the PTS of the MPEG2 packet that contained the "Display Buffer" command

my code is here: https://pastebin.com/DGPFa2Mm it's a bit messy because i hacked it together in two days

Best regards,

Earthnuker
__________________
Hack the planet!
Earthnuker is offline   Reply With Quote
Reply

Tags
captions, dvd, eia-608


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 20:02.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.