Jump to content


Photo

exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format


  • Please log in to reply
38 replies to this topic

#1 samsamsam

  • Senior Member
  • 2,005 posts

+143
Excellent

Posted 29 April 2019 - 23:42

Hello,

 

I added support for 

For interested embeded PGS subtitle format  to the exteplayer3:

 

 

https://github.com/e...d856eb2efad393b

https://github.com/e.../exteplayer3png

 

exteplayer3 extracts PGS subtitles frames, resize it to the valid size according to the skin resolution and save each frame as separate png file which can be displaied by the enigma2 system.

 

For example:

exteplayer3 -b 20 -G "/media/mmc/SubtitlesGraphic/"  -W "1280"  -H "720"  -9 0  "file:///media/mmc/pgs/Forced Sub Sample (PGS).mkv"

Output:

root@h9combo:/var/volatile/tmp# /iptvplayer_rootfs/usr/bin/exteplayer3 -b 20 -G "/media/mmc/SubtitlesGraphic/"  -W "1280"  -H "720"  -9 0  "/media/mmc/downloads/pgs/Forced Sub Sample (PGS).mkv"
{"EPLAYER3_EXTENDED":{"version":63}}
file: [file:///media/mmc/downloads/pgs/Forced Sub Sample (PGS).mkv]
{"PLAYBACK_OPEN":{"OutputName":"Output", "file":"file:///media/mmc/downloads/pgs/Forced Sub Sample (PGS).mkv", "sts":0}}
{"OUTPUT_OPEN":{"sts":0}}
{"PLAYBACK_PLAY":{"sts":0}}
{"v_c":{"id":0,"e":"V_MPEG4/ISO/AVC","n":"und","w":1920,"h":1080,"f":23976,"p":-1,"an":1,"ad":1}}
{"a_l": [{"id":1,"e":"A_IPCM","n":"eng"}]}
{"a_c":{"id":1,"e":"A_IPCM","n":"eng"}}
{"s_l": [{"id":2,"e":"S_GRAPHIC/PGS","n":"eng"}]}
{"s_f":{"r":0}}
{"s_f":{"r":0}}
{"s_s":{"id":2,"sts":0}}
{"s_c":{"id":2,"e":"S_GRAPHIC/PGS","n":"eng"}}
{"v_c":{"id":0,"e":"V_MPEG4/ISO/AVC","n":"und","w":1920,"h":1080,"f":23976,"p":1,"an":1,"ad":1}}
{"v_e":{"w":1920,"h":1080,"a":1,"f":24000,"p":1}}
{"s_a":{"id":2,"s":6173,"e":null,"r":[{"x":369,"y":526,"w":541,"h":115,"f":"2_6173_0.png"}]}}
{"s_a":{"id":2,"s":10844,"e":null,"r":[]}}
{"s_a":{"id":2,"s":11095,"e":null,"r":[{"x":343,"y":592,"w":593,"h":49,"f":"2_11095_0.png"}]}}
{"s_a":{"id":2,"s":14890,"e":null,"r":[]}}
{"s_a":{"id":2,"s":15224,"e":null,"r":[{"x":411,"y":592,"w":459,"h":39,"f":"2_15224_0.png"}]}}
{"s_a":{"id":2,"s":17351,"e":null,"r":[]}}
{"s_a":{"id":2,"s":28195,"e":null,"r":[{"x":549,"y":593,"w":182,"h":49,"f":"2_28195_0.png"}]}}
{"s_a":{"id":2,"s":29696,"e":null,"r":[]}}
{"log":"Frame read error: 'End of file'"}

Edited by samsamsam, 29 April 2019 - 23:43.


Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #2 samsamsam

  • Senior Member
  • 2,005 posts

+143
Excellent

Posted 29 April 2019 - 23:54

Subtitle frames will be accessible in the following location:

/media/mmc/SubtitlesGraphic/2_6173_0.png

/media/mmc/SubtitlesGraphic/2_11095_0.png

 

In the Enigma2 they could be displayed using Pixmap component:

 

from Components.Pixmap import Pixmap
 
class PlayerWindow(Screen):
    def __init__(self):
        self.skin = '''
        ...
            <widget name="subPixmapRec1 position="0,0" size="8,8" zPosition="1" transparent="1" alphatest="blend" />
            <widget name="subPixmapRec2 position="0,0" size="8,8" zPosition="1" transparent="1" alphatest="blend" />
        ...
        '''
        ...
        for idx in range(1, 3, 1):
            self["subPixmapRec%d" % idx] = Pixmap()
 
 
    def updateSubtitles(self, subAtom):
        # subAtom = {"s_a":{"id":2,"s":6173,"e":null,"r":[{"x":369,"y":526,"w":541,"h":115,"f":"2_6173_0.png"}]}}
        rects = subAtom['r']
 
        for idx in range(1, 3, 1):
            key = 'subPixmapRec%d' % idx
            self[key].instance.setPixmap(None)
            if len(rects) < idx:
                self[key].hide()
            else:
                rec = rects[idx-1]
                self[key].instance.resize(eSize(rec['width'], rec['height']))
                self[key].resize(eSize(rec['width'], rec['height']))
                self[key].instance.move( ePoint(rec['x'], rec['y']) )
                self[key].instance.setPixmapFromFile("/media/mmc/SubtitlesGraphic/" + rec['f'])
                self[key].show()


Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #3 littlesat

  • PLi® Core member
  • 47,584 posts

+497
Excellent

Posted 30 April 2019 - 06:57

Actually they should be added in the binary cpp e2 code and after 15 years or so nobody took the time to implement them right.... :( actually as the code was there in MP3 player it took a long time to make srt subs right... but there indeed it should be done/added...

Edited by littlesat, 30 April 2019 - 07:01.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #4 samsamsam

  • Senior Member
  • 2,005 posts

+143
Excellent

Posted 30 April 2019 - 07:14

Anyway I was added support to exteplayer3 and E2iPlayer and work well at least on the H9.

 

Rescaling and encoding as PNG in the exteplayer3 is done by software.

Same on the Enigma2 sitede de-coding PNG is also done by software, so I am not sure if this will work well on STBs with a weak main CPU.

 

If it would be done in in the cpp part of Enigma2 then the process encoding/decoding to/from PNG  format will be not needed.

Probably also rescaling could be done using hwaccel.

 

However even this "workaround" solution works well.



Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #5 littlesat

  • PLi® Core member
  • 47,584 posts

+497
Excellent

Posted 30 April 2019 - 08:43

Yes it might indeed work well... But the question here is more... is this the real solution -or- a work-a-round....

I still believe when we all had infinitive time and work together it should be added in the gstreamer stuff... next to srt. And than we need indeed someone with good knowledge of cpp.

 

Unless this I still prefer srt as they can be rendered the way I want and they are never upscaled to the OSD resolution. But I'm aware blue-ray (grabs) have the PGS subs.


Edited by littlesat, 30 April 2019 - 08:46.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #6 WanWizard

  • Forum Moderator
    PLi® Core member
  • 46,428 posts

+751
Excellent

Posted 30 April 2019 - 10:56

All builds have failed last night due to the latest changes. I've updated the PR with the errors.

 

edit: my bad, the errors were because the build started after the PR was merged...


Edited by WanWizard, 30 April 2019 - 14:20.

Currently in use: VU+Duo 4K (2xFBC S2), Amiko Viper T2C (T2), SAB Alpha Triple HD (S2+T2), Zgemma H3.T2C (T/C), Zgemma H6 (fallback), VU+Zero (fallback)

Many answers to your question can be found in our new and improved wiki.

note: I do not provide support via PM !

 


Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #7 samsamsam

  • Senior Member
  • 2,005 posts

+143
Excellent

Posted 30 April 2019 - 15:32

These problem are because the exteplayer3 does not define compilation environment by it self.

So, maybe there will better to not made compilation from head, but rather use compilation of the specific commit.

 

 

Clarification:

To be able got PGS subtitles decoding there must be also plugin exteplayer3png.so in the library path, for example /usr/lib/exteplayer3png.so

https://github.com/e.../exteplayer3png

 

exteplayer3 does not link directly to this library at compilation time but search it at run-time. 

exteplayer3 will be working without this library but PGS subtitles decoder will not work.

 

exteplayer3png,so is wrapper for the png library.

I use this solution because not everyone need PGS subtitles decoding and using run-time linking the exteplayer3 has less dependencies.
 


Edited by samsamsam, 30 April 2019 - 15:32.


Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #8 WanWizard

  • Forum Moderator
    PLi® Core member
  • 46,428 posts

+751
Excellent

Posted 30 April 2019 - 16:50

Our develop branch always builds from HEAD, for release branches, we build from a specific commit hash, exactly to avoid potential issues for the wider public. 


Currently in use: VU+Duo 4K (2xFBC S2), Amiko Viper T2C (T2), SAB Alpha Triple HD (S2+T2), Zgemma H3.T2C (T/C), Zgemma H6 (fallback), VU+Zero (fallback)

Many answers to your question can be found in our new and improved wiki.

note: I do not provide support via PM !

 


Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #9 samsamsam

  • Senior Member
  • 2,005 posts

+143
Excellent

Posted 5 May 2019 - 20:37

For interested.

 

In the exteplayer3 v67 I added embedded DVB and XSUB graphic subtitle formats support in the same technology.

 

Sample files:

 

DVB:

https://subtitling.c...vb-subtitles-1/

 

XSUB:

https://wiki.multime.../index.php/XSUB

 

Regards,

Sam



Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #10 athoik

  • PLi® Core member
  • 7,825 posts

+286
Excellent

Posted 6 May 2019 - 06:06

There are lot of people interested in your work, directly or indirectly.

Eg, serviceapp uses exteplayer, (and) needs to catch-up with those changes.

By the way does ffmpeg already support "closed captions" (subtitles as called in USA)?

Those are subtitles embeeded on video stream.

VLC supports those using libzvbi. CCextractor also uses libzvbi.

        ccextractor atsc-cea-708-dtvcc-and-cea-608.ts -quiet -stdout
        1
        00:00:00,201 --> 00:00:02,735
        engine.

        2
        00:00:02,803 --> 00:00:04,570
        There isn't even
        a Yugoslavia anymore!

        3
        00:00:04,638 --> 00:00:05,971
        Bring it back at once!

        4
        00:00:06,040 --> 00:00:07,940
                    You're the boss.

        5
        00:00:08,009 --> 00:00:09,808
                  (crashing)

        6
        00:00:09,877 --> 00:00:11,510
        (laughing)

        7
        00:00:11,579 --> 00:00:13,045
                  (groaning)

        8
        00:00:13,114 --> 00:00:15,014
                 (grumbling):
              Stupid punishment.
If ffmpeg support closed captions, exteplayer can consume it most probably.

Regards,
Athoik
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #11 samsamsam

  • Senior Member
  • 2,005 posts

+143
Excellent

Posted 6 May 2019 - 18:28

Hello @athoik

 

There is no only one kind of "closed caption" - these one from your example file are not exposed as separate stream (they are not transmitted on separate PID), they are send in the H264 frames metadata.

So, just as logic suggests they should be returned in the callback by the video decoder. 

 

As, you know video decoding is not handled by the exteplayer3. Video decoding is handled by video processing unit, let say "hardware" (/dev/dvb/adapter0/video0).

 

Theoretically, you can parse each H264/H265 NAL frame to search metadata with subtitles.

But I am not sure how big impact this will have on the performance.

 

Regards,

Sam


Edited by samsamsam, 6 May 2019 - 18:28.


Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #12 athoik

  • PLi® Core member
  • 7,825 posts

+286
Excellent

Posted 6 May 2019 - 21:40

Hi,


I don't know the overhead required when parsing video data.

But getting the stream from e2 and process it in real time seems possible.

# wget http://localhost:8001/1:0:19:X:.:.:.:0:0:0: -qO- | ccextractor -stdin -pn X -stdout -noteletext -ts

CCExtractor 0.87, Carlos Fernandez Sanz, Volker Quetschke.
Teletext portions taken from Petr Kutalek's telxcc
--------------------------------------------------------------------------
Input: stdin
[Extract: 1] [Stream mode: Transport]
[Program : X ] [Hauppage mode: No] [Use MythTV code: Auto]
[Timing mode: Auto] [Debug: No] [Buffer input: No]
[Use pic_order_cnt_lsb for H.264: No] [Print CC decoder traces: No]
[Target format: .srt] [Encoding: UTF-8] [Delay: 0] [Trim lines: No]
[Add font color data: Yes] [Add font typesetting: Yes]
[Convert case: No] [Video-edit join: No]
[Extraction start time: not set (from start)]
[Extraction end time: not set (to end)]
[Live stream: Yes, no timeout] [Clock frequency: 90000]
[Teletext page: Autodetect]
[Start credits text: None]
[Quantisation-mode: CCExtractor's internal function]

-----------------------------------------------------------------
Reading from standard input
Analyzing data in general mode
Sending captions to stdout.
Streaming |  00:00Changed fps using NAL to: 59.940060

Found large gap(6065523) in PTS! Trying to recover ...

Found large gap(6065515) in PTS! Trying to recover ...

Found large gap(6065511) in PTS! Trying to recover ...

Found large gap(6065508) in PTS! Trying to recover ...

Found large gap(6065512) in PTS! Trying to recover ...

Found large gap(6065519) in PTS! Trying to recover ...

Found large gap(6065516) in PTS! Trying to recover ...

Found large gap(6065520) in PTS! Trying to recover ...
Streaming |  00:101
00:00:08,625 --> 00:00:14,630
ABOUT KAWHI BEING GREAT OR
EMBIID BEING SICK?

2
00:00:14,632 --> 00:00:15,798
EMBIID BEING SICK?
DAN: HE WASN'T HIMSELF.

3
00:00:15,800 --> 00:00:17,733
DAN: HE WASN'T HIMSELF.
THAT TEAM NEEDS HIM TO BE GREAT

4
00:00:17,735 --> 00:00:19,735
THAT TEAM NEEDS HIM TO BE GREAT
IN ORDER TO ADVANCE IN THIS

Streaming |  00:205
00:00:19,737 --> 00:00:20,035
IN ORDER TO ADVANCE IN THIS
ROUND.

6
00:00:20,037 --> 00:00:21,637
ROUND.
IF HE PLAYS LIKE HE PLAYED IN

7
00:00:21,639 --> 00:00:23,672
IF HE PLAYS LIKE HE PLAYED IN
THAT GAME, THEY WILL LOSE, AND

8
00:00:23,674 --> 00:00:26,775
THAT GAME, THEY WILL LOSE, AND
LOSE THE NEXT TWO.

9
00:00:26,777 --> 00:00:28,944
LOSE THE NEXT TWO.
IZZY: JUST A SIDENOTE.

Streaming |  00:3010
00:00:28,946 --> 00:00:31,013
IZZY: JUST A SIDENOTE.
IT FEELS LIKE JOEL EMBIID IS

11
00:00:31,015 --> 00:00:32,147
IT FEELS LIKE JOEL EMBIID IS
ALWAYS SICK, THERE'S ALWAYS A

12
00:00:32,149 --> 00:00:34,016
ALWAYS SICK, THERE'S ALWAYS A
NEW INJURY, THERE'S NOTHING

13
00:00:34,018 --> 00:00:37,286
NEW INJURY, THERE'S NOTHING
RIGHT WITH HIM, UNTIL ONCE IN A

14
00:00:37,288 --> 00:00:38,954
RIGHT WITH HIM, UNTIL ONCE IN A
WHILE HE GIVES YOU 33 AND 15.

Streaming |  00:4015
00:00:38,956 --> 00:00:40,189
WHILE HE GIVES YOU 33 AND 15.
YOU NEVER KNOW FROM GAME TO

16
00:00:40,191 --> 00:00:40,956
YOU NEVER KNOW FROM GAME TO
GAME.

17
00:00:40,958 --> 00:00:42,991
GAME.
IF I'M BRETT BROWN, I'M PULLING

18
00:00:42,993 --> 00:00:43,392
IF I'M BRETT BROWN, I'M PULLING
MY HAIR OUT.

19
00:00:43,394 --> 00:00:45,260
MY HAIR OUT.
I DON'T WANT TO SEE A TEXT FROM

20
00:00:45,262 --> 00:00:49,098
I DON'T WANT TO SEE A TEXT FROM
JOEL AT 6:00 IN THE MORNING EVER

Streaming |  00:5021
00:00:49,100 --> 00:00:50,099
JOEL AT 6:00 IN THE MORNING EVER
UNLESS YOU'RE PLAYING AT

22
00:00:50,101 --> 00:00:51,100
UNLESS YOU'RE PLAYING AT
7:00 A.M.

23
00:00:51,102 --> 00:00:53,168
7:00 A.M.
KAWHI HAS BEEN PHENOMENAL, THE

24
00:00:53,170 --> 00:00:54,470
KAWHI HAS BEEN PHENOMENAL, THE
COMPARISONS TO MICHAEL JORDAN,

25
00:00:54,472 --> 00:00:55,270
COMPARISONS TO MICHAEL JORDAN,
SHAQUILLE O'NEAL.

26
00:00:55,272 --> 00:00:56,505
SHAQUILLE O'NEAL.
HE'S INCREDIBLE.

27
00:00:56,507 --> 00:00:58,307
HE'S INCREDIBLE.
THIS GAME WAS ABOUT MARC GASOL

Streaming |  01:0028
00:00:58,309 --> 00:01:02,377
THIS GAME WAS ABOUT MARC GASOL
AND KYLE LOWRY AND SERGE IBAKA

29
00:01:02,379 --> 00:01:03,378
AND KYLE LOWRY AND SERGE IBAKA
FINALLY HELPING HIM.

...
CPU usage on ccextractor is less than 1%.


In theory...

I guess adding support on Enigma2, more or less requires a PES/TS/Section reader that will feed libzvbi and output of libzvbi can feed e2 with produced results.

In practice...

git commit
git revert
git commit
git commit
git revert

:)
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #13 samsamsam

  • Senior Member
  • 2,005 posts

+143
Excellent

Posted 8 May 2019 - 21:04

@athoik

 

The first thing will be to add PMT and EIT parser which will be able to check if this closed caption are available in the TS stream.

 

According to this document 

https://evertz.com/r..._608_708_cc.pdf

 

such information can be found in the PMT or in the EIT

 

In case of exteplayer3 demultiplexing and table parsing is handled by ffmpeg, so such thing need to be added to the ffmpeg and then such information need to be exposed to in our case to the exteplaye3.

Then exteplayer3 need to process each video frame to find metadata with subtitles make re-ordering and so on.

 

Regarding your question, ffmpeg has partial support for CC but looks that this is in the video decoder part not used by the exteplayer3.



Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #14 samsamsam

  • Senior Member
  • 2,005 posts

+143
Excellent

Posted 8 May 2019 - 21:07

If you know that CC is in the stream then you can use this:

 

ffmpeg -f lavfi -i "movie=input.ts[out0+subcc]" -map s output.srt

 

to extract them.



Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #15 athoik

  • PLi® Core member
  • 7,825 posts

+286
Excellent

Posted 8 May 2019 - 21:16

Well detection using the PMT/EIT should be easy, if provider provides that information.


There is also another library called libcaption that comes with a ts2srt sample: https://github.com/s...amples/ts2srt.c

But sample ts2srt seems incomplete...

# ts2srt out.ts
01
0:00:02,551 --> 00:00:04,186
TH

02
0:00:04,186 --> 00:00:04,219
THAT

03
0:00:04,219 --> 00:00:04,252
THAT S

04
0:00:04,252 --> 00:00:04,286
THAT STR

05
0:00:04,286 --> 00:00:04,319
THAT STRIK

06
0:00:04,319 --> 00:00:04,352
THAT STRIKE

07
0:00:04,352 --> 00:00:04,386
THAT STRIKE TH

08
0:00:04,386 --> 00:00:04,419
THAT STRIKE THRE

09
0:00:04,419 --> 00:00:04,453
THAT STRIKE THREE

10
0:00:04,453 --> 00:00:04,486
THAT STRIKE THREE CA

11
0:00:04,486 --> 00:00:04,519
THAT STRIKE THREE CALL

12
0:00:04,519 --> 00:00:04,553
THAT STRIKE THREE CALLED

13
0:00:04,553 --> 00:00:04,553
THAT STRIKE THREE CALLED,

14
0:00:04,553 --> 00:00:05,020
THAT STRIKE THREE CALLED,
EX

15
0:00:05,020 --> 00:00:05,053
THAT STRIKE THREE CALLED,
EXCE

16
0:00:05,053 --> 00:00:05,087
THAT STRIKE THREE CALLED,
EXCELL

17
0:00:05,087 --> 00:00:05,120
THAT STRIKE THREE CALLED,
EXCELLEN

18
0:00:05,120 --> 00:00:05,120
THAT STRIKE THREE CALLED,
EXCELLENT

19
0:00:05,120 --> 00:00:06,555
THAT STRIKE THREE CALLED,
EXCELLENT W

20
0:00:06,555 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WO

21
0:00:06,588 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WORK

22
0:00:06,588 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WORK.

23
0:00:06,588 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WORK.

24
0:00:06,588 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WORK.

25
0:00:06,588 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WORK.

26
0:00:06,588 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WORK.

27
0:00:06,588 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WORK.

28
0:00:06,588 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WORK.

29
0:00:06,588 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WORK.

30
0:00:06,588 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WORK.

31
0:00:06,588 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WORK.

32
0:00:06,588 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WORK.

33
0:00:06,588 --> 00:00:06,588
THAT STRIKE THREE CALLED,
EXCELLENT WORK.
Anyway using such a library, we can feed data from video pid and display results.

The eDVBTeletext class already implements most of the logic (reading data from a PID and displaying decoded data, https://github.com/O...text.cpp#L220).

So a new eDVBClosedCaption class should be created, need to find a ready to use library.

diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp
index 9607937..db4c550 100644
--- a/lib/service/servicedvb.cpp
+++ b/lib/service/servicedvb.cpp
@@ -3223,6 +3223,12 @@ RESULT eDVBServicePlay::enableSubtitles(iSubtitleUser *user, SubtitleTrack &trac
                if (m_dvb_service)
                        m_dvb_service->setCacheEntry(eDVBService::cSUBTITLE, ((pid&0xFFFF)<<16)|((composition_page_id&0xFF)<<8)|(ancillary_page_id&0xFF));
        }
+       else if (track.type == 2)
+       {
+               m_subtitle_widget = user;
+               // TODO cc1
+               //m_closed_caption_parser->start(track.pid);
+       }
        else
                goto error_out;
        return 0;
@@ -3380,6 +3386,14 @@ RESULT eDVBServicePlay::getSubtitleList(std::vector<SubtitleTrack> &subtitlelist
                }
        }

+       struct SubtitleTrack track;
+       track.type = 2;
+       track.pid = getInfo(sVideoPID);
+       track.page_number = 0;
+       track.magazine_number = 0;
+       track.language_code = "cc1";
+       subtitlelist.push_back(track);
+
        return 0;
 }

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #16 samsamsam

  • Senior Member
  • 2,005 posts

+143
Excellent

Posted 9 May 2019 - 21:18

@athoik

 

Please provide example file which cause such problems with libcaption.

 

libcaption looks quite easy, so it could be used and fixed if needed.



Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #17 athoik

  • PLi® Core member
  • 7,825 posts

+286
Excellent

Posted 9 May 2019 - 22:50

Hi,

Use that sample: https://mega.nz/#!iU...Yrmcg6sm9lDTfjw


CCextractor has no issue to extract it.
# ccextractor out.ts
CCExtractor 0.87, Carlos Fernandez Sanz, Volker Quetschke.
Teletext portions taken from Petr Kutalek's telxcc
--------------------------------------------------------------------------
Input: out.ts
[Extract: 1] [Stream mode: Autodetect]
[Program : Auto ] [Hauppage mode: No] [Use MythTV code: Auto]
[Timing mode: Auto] [Debug: No] [Buffer input: No]
[Use pic_order_cnt_lsb for H.264: No] [Print CC decoder traces: No]
[Target format: .srt] [Encoding: UTF-8] [Delay: 0] [Trim lines: No]
[Add font color data: Yes] [Add font typesetting: Yes]
[Convert case: No] [Video-edit join: No]
[Extraction start time: not set (from start)]
[Extraction end time: not set (to end)]
[Live stream: No] [Clock frequency: 90000]
[Teletext page: Autodetect]
[Start credits text: None]
[Quantisation-mode: CCExtractor's internal function]

-----------------------------------------------------------------
Opening file: out.ts
File seems to be a transport stream, enabling TS mode
Analyzing data in general mode
Changed fps using NAL to: 59.940060

Found large gap(318) in PTS! Trying to recover ...
  1%  |  00:00
Found large gap(310) in PTS! Trying to recover ...
  2%  |  00:00
Found large gap(306) in PTS! Trying to recover ...

Found large gap(304) in PTS! Trying to recover ...

Found large gap(308) in PTS! Trying to recover ...
  3%  |  00:00
Found large gap(314) in PTS! Trying to recover ...

Found large gap(312) in PTS! Trying to recover ...

Found large gap(316) in PTS! Trying to recover ...
XDS: CGMS: One generation of copies can be made
XDS: APS: No APS
XDS: Redistribution Control Descriptor: 0
XDS: ContentAdvisory: US TV Parental Guidelines. Age Rating: None
XDS:
100%  |  00:04
Number of NAL_type_7: 5
Number of VCL_HRD: 0
Number of NAL HRD: 0
Number of jump-in-frames: 0
Number of num_unexpected_sei_length: 0

Total frames time:        00:00:04:771  (286 frames at 59.94fps)

Min PTS:                                00:00:02:534
Max PTS:                                00:00:07:339
Length:                          00:00:04:805
Done, processing time = 0 seconds
Issues? Open a ticket here
https://github.com/CCExtractor/ccextractor/issues

# cat out.srt
1
00:00:01,618 --> 00:00:04,803
THAT STRIKE THREE CALLED,
EXCELLENT WORK.
 

Edited by athoik, 9 May 2019 - 22:52.

Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #18 samsamsam

  • Senior Member
  • 2,005 posts

+143
Excellent

Posted 10 May 2019 - 07:50

Hi @athoik

 

Thank you for this sample. I will take a look on this at the the coming weekend.

 

Regards,

Sam



Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #19 athoik

  • PLi® Core member
  • 7,825 posts

+286
Excellent

Posted 10 May 2019 - 19:03

There is a nice description for ATSC subtitles here:

SD analog and digital NTSC broadcast, tape, and DVDs: Closed captioning for SD analog television is a text-only data stream that’s encoded into line 21 of an NTSC video signal. This is one of the reasons for the series of blinking dashes and lines that runs along the edge of a video image when you put a monitor into underscan mode. SD digital video uses the CEA-608 standard of closed captioning, which can be encoded into an MPEG-2 stream.
Because closed captioning is encoded right into the video signal, it can be included and recorded on videotapes; broadcast over the air, via satellite or cable; included on DVDs; and even recorded using digital video recorders (DVRs) such as TIVO.

SD and HD digital television broadcast and tape: Although high definition television (HDTV) originally supported line 21–style closed captioning, the proliferation of new HD digital video formats necessitated a new approach.
To accommodate HD video encoded using a variety of methods, the EIA-708 closed captioning standard for ATSC digital television was developed.
This standard has since been superseded by CEA-708, which covers both SD and HD digital television. In this standard, closed captioning data is stored in the vertical ancillary (VANC) data of a digital video stream. Final Cut Pro and Compressor both support the embedding of CEA-608 closed captioning within the CEA-708 standard.


https://softron.zend...ut-applications

And it seems there is a more mature library called libklvanc here: https://github.com/s...68000/libklvanc

Now I need to compile this library and test interesting tools ;)
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: exteplayer3 - support for the embedded PGS (Presentation Graphic Stream) subtitle format #20 athoik

  • PLi® Core member
  • 7,825 posts

+286
Excellent

Posted 11 May 2019 - 21:28

Using PES reader and setting stream_id to 0x6 (private data) seems enough to get the data, that seem to contain the CEA-708 captions.

diff --git a/lib/dvb/Makefile.inc b/lib/dvb/Makefile.inc
index 30eecaf..19f5201 100644
--- a/lib/dvb/Makefile.inc
+++ b/lib/dvb/Makefile.inc
@@ -3,6 +3,7 @@ noinst_LIBRARIES += dvb/libenigma_dvb.a
 dvb_libenigma_dvb_a_SOURCES = \
        dvb/cablescan.cpp \
        dvb/cahandler.cpp \
+       dvb/closedcaption.cpp \
        dvb/crc32.cpp \
        dvb/db.cpp \
        dvb/decoder.cpp \
@@ -39,6 +40,7 @@ dvbinclude_HEADERS = \
        dvb/absdiff.h \
        dvb/cablescan.h \
        dvb/cahandler.h \
+       dvb/closedcaption.h \
        dvb/crc32.h \
        dvb/db.h \
        dvb/decoder.h \
diff --git a/lib/dvb/closedcaption.cpp b/lib/dvb/closedcaption.cpp
new file mode 100644
index 0000000..9c7d23a
--- /dev/null
+++ b/lib/dvb/closedcaption.cpp
@@ -0,0 +1,56 @@
+#include <lib/base/eerror.h>
+#include <lib/dvb/closedcaption.h>
+#include <lib/dvb/idemux.h>
+#include <lib/gdi/gpixmap.h>
+
+DEFINE_REF(eClosedCaptionParser);
+
+eClosedCaptionParser::eClosedCaptionParser(iDVBDemux *demux) : m_pid(-1)
+{
+       eDebug("[eClosedCaptionParser] Starting!");
+       setStreamID(0x06); /* private data */
+
+       if (demux->createPESReader(eApp, m_pes_reader))
+               eDebug("[eClosedCaptionParser] failed to create closed caption PES reader!");
+       else {
+               eDebug("[eClosedCaptionParser] created closed caption PES reader!");
+               m_pes_reader->connectRead(sigc::mem_fun(*this, &eClosedCaptionParser::processData), m_read_connection);
+       }
+}
+
+eClosedCaptionParser::~eClosedCaptionParser()
+{
+}
+
+void eClosedCaptionParser::processPESPacket(uint8_t *pkt, int len)
+{
+       unsigned char *p = pkt;
+
+       printf("[eClosedCaptionParser] PES packet len=%d\n", len);
+       for (unsigned int i = 0; i < len; i++)
+               printf("%02x%s", p[i], ((i + 1) % 16) ? " " : "\n");
+       printf("\n");
+#if 0
+       p += 4; len -= 4; /* start code, already be verified by pes parser */
+       p += 2; len -= 2; /* length, better use the argument */
+
+       p += 3; len -= 3; /* pes header */
+
+       p += 0x24; len -= 0x24; /* skip header */
+
+       p++; len--;
+#endif
+}
+
+int eClosedCaptionParser::start(int pid)
+{
+       eDebug("[eClosedCaptionParser] starting PES reader on pid=%04x", pid);
+       if (m_pes_reader && pid >= 0 && pid < 0x1fff)
+       {
+               m_pid = pid;
+               return m_pes_reader->start(pid);
+       }
+       else
+               return -1;
+}
+
diff --git a/lib/dvb/closedcaption.h b/lib/dvb/closedcaption.h
new file mode 100644
index 0000000..5733ce6
--- /dev/null
+++ b/lib/dvb/closedcaption.h
@@ -0,0 +1,27 @@
+#ifndef __lib_dvb_closedcaption_h
+#define __lib_dvb_closedcaption_h
+
+#include <lib/base/object.h>
+#include <lib/dvb/idvb.h>
+#include <lib/dvb/pesparse.h>
+#include <lib/dvb/pmt.h>
+#include <lib/gdi/gpixmap.h>
+#include <map>
+
+class eClosedCaptionParser: public iObject, public ePESParser, public sigc::trackable
+{
+       DECLARE_REF(eClosedCaptionParser);
+public:
+       eClosedCaptionParser(iDVBDemux *demux);
+       virtual ~eClosedCaptionParser();
+       int start(int pid);
+private:
+       int m_pid;
+       std::map<int, unsigned int> m_modifications;
+       void processPESPacket(uint8_t *pkt, int len);
+
+       ePtr<iDVBPESReader> m_pes_reader;
+       ePtr<eConnection> m_read_connection;
+};
+
+#endif
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp
index 9607937..cb6c598 100644
--- a/lib/service/servicedvb.cpp
+++ b/lib/service/servicedvb.cpp
@@ -2781,6 +2781,7 @@ void eDVBServicePlay::resetTimeshift(int start)
        m_teletext_parser = 0;
        m_rds_decoder = 0;
        m_subtitle_parser = 0;
+       m_closed_caption_parser = nullptr;
        m_new_subtitle_stream_connection = 0;
        m_new_subtitle_page_connection = 0;
        m_new_dvb_subtitle_page_connection = 0;
@@ -3008,6 +3009,7 @@ void eDVBServicePlay::updateDecoder(bool sendSeekableStateChanged)
                                }
                        }
                        m_teletext_parser->start(program.textPid);
+                       m_closed_caption_parser = new eClosedCaptionParser(m_decode_demux);
                }

                /* don't worry about non-existing services, nor pvr services */
@@ -3223,6 +3225,11 @@ RESULT eDVBServicePlay::enableSubtitles(iSubtitleUser *user, SubtitleTrack &trac
                if (m_dvb_service)
                        m_dvb_service->setCacheEntry(eDVBService::cSUBTITLE, ((pid&0xFFFF)<<16)|((composition_page_id&0xFF)<<8)|(ancillary_page_id&0xFF));
        }
+       else if (track.type == 2)
+       {
+               m_subtitle_widget = user;
+               m_closed_caption_parser->start(track.pid);
+       }
        else
                goto error_out;
        return 0;
@@ -3380,6 +3387,18 @@ RESULT eDVBServicePlay::getSubtitleList(std::vector<SubtitleTrack> &subtitlelist
                }
        }

+       int vpid = getInfo(sVideoPID);
+       if (vpid > -1)
+       {
+               struct SubtitleTrack track;
+               track.type = 2;
+               track.pid = vpid;
+               track.page_number = 0;
+               track.magazine_number = 0;
+               track.language_code = "cc1";
+               subtitlelist.push_back(track);
+       }
+
        return 0;
 }

diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h
index 6df516c..37c2ff2 100644
--- a/lib/service/servicedvb.h
+++ b/lib/service/servicedvb.h
@@ -8,6 +8,7 @@
 #include <lib/dvb/eit.h>
 #include <lib/dvb/subtitle.h>
 #include <lib/dvb/teletext.h>
+#include <lib/dvb/closedcaption.h>
 #include <lib/dvb/radiotext.h>

 class eStaticServiceDVBInformation;
@@ -299,6 +300,9 @@ protected:
        ePtr<eTimer> m_subtitle_sync_timer;
        void checkSubtitleTiming();

+               /* closed caption subtitles */
+       ePtr<eClosedCaptionParser> m_closed_caption_parser;
+
        ePtr<eTimer> m_nownext_timer;
        void updateEpgCacheNowNext();


Output looks like this:


[eClosedCaptionParser] PES packet len=263
00 00 01 06 01 01 04 80 00 00 00 01 06 04 29 b5
00 31 47 41 39 34 03 ca ff fd 80 80 fa 00 00 fa
00 00 fa 00 00 fa 00 00 fa 00 00 fa 00 00 fa 00
00 fa 00 00 fa 00 00 ff 04 09 b5 00 31 44 54 47
31 41 fa 04 09 b5 00 31 47 41 39 34 06 0f 80 00
00 00 01 01 a9 e7 b5 18 44 4a 5f 7c c2 6b cb 71
f7 72 79 db f4 ae 5e 88 dc f8 98 47 7f 6b ed b1
c7 99 e8 c1 3f bb 63 6e 5f 26 4f 42 dd 44 00 d8
ea 1d e6 fd 06 fb 74 9a 7b f8 39 21 1b 6b 14 d6
76 27 aa 90 4a 17 ee d1 ad 35 ad ad 75 e5 74 f4
6e 8f 31 8b 95 0c 65 45 3b 34 ba 4b c5 5d 8f 51
aa a6 38 0b 3c 05 1b 11 09 48 06 e0 ea 41 0b 5b
0b 7f c7 b1 1f d1 af 42 bb 7c e6 2e cc 62 f7 1b
d9 8f 71 e4 ce 10 72 61 3c b4 9e e0 99 9b a9 3e
6c f2 d4 9b ef 29 90 c4 0e 5b e8 92 43 dc 80 48
09 df 1b 4a a0 82 59 8e f3 e6 77 61 ab 51 e3 1f
9a db 44 88 2d 92 46
I guess not it's time to parse those data.

Thanks for helping!
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users