nkoriyama / aribb24

A library for ARIB STD-B24, decoding JIS 8 bit characters and parsing MPEG-TS stream.
GNU Lesser General Public License v3.0
60 stars 25 forks source link

Arib support to ffmpeg #10

Open janmacku opened 6 years ago

janmacku commented 6 years ago

Hello,

we are currently trying to add support to ffmpeg so that arib subtitles would be supported. The subtitles are currently marked as bin_data ([6][0][0][0] / 0x0006) on separate PID (separate pid from video / audio). On the transcoded stream with ffmpeg - it seems that since the ffmpeg is missing support for arib subtitles, it's transcoding the stream somehow wrongly.

Do you have any experience with ffmpeg and would you be willing to help to add support for it? In case of any cost, let us know.

Thank you

jeeb commented 5 years ago

FFmpeg master has support for:

as of today.

nu774 commented 5 years ago

jeeb, in the current ffmpeg, I noticed that duration of each sub keeps getting longer and longer (monotonically). As far as I can see, i_control_time in the arib_decoder_t keeps increasing without arib_initialize_decoder(), only where i_control_time is cleared to zero.

jakubvojacek commented 5 years ago

Helll @jeeb , thank you for the update.

not sure if this is the right place to ask but can you help me with the arib please? I installed the master ffmpeg (with --enable-libaribb24), I got video:

Input #0, mpegts, from 'test.ts':
  Duration: 00:05:00.70, start: 68062.412044, bitrate: 15361 kb/s
  Program 124 
    Metadata:
      service_name    : test
      service_provider: test
    Stream #0:0[0x111]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x112](por): Audio: aac_latm (HE-AAC) ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp
    Stream #0:2[0x113](eng): Audio: aac_latm (HE-AAC) ([17][0][0][0] / 0x0011), 48000 Hz, 5.1, fltp
    Stream #0:3[0x116]: Subtitle: arib_caption (Profile A) ([6][0][0][0] / 0x0006)
[libaribb24 @ 0x560d41b62600] arib parser was created
[libaribb24 @ 0x560d41b62600] arib decoder was created
[libaribb24 @ 0x560d41b62600] arib decoder destroyed
[libaribb24 @ 0x560d41b62600] arib parser was destroyed

the arib subtitles are perfectly recognized. When I try to just copy the file using

ffmpeg -y -i test.ts -map 0: -vcodec copy -acodec copy -scodec copy -f mpegts test_copy.ts

the copied file is created but the subtitle pid is no longer arib but unknown instead

Input #0, mpegts, from 'test_copy.ts':
  Duration: 00:05:00.70, start: 1.400000, bitrate: 16128 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x101](por): Audio: aac_latm (HE-AAC) ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp
    Stream #0:2[0x102](eng): Audio: aac_latm (HE-AAC) ([17][0][0][0] / 0x0011), 48000 Hz, 5.1, fltp
    Stream #0:3[0x103]: Data: bin_data ([6][0][0][0] / 0x0006)
[@1557391167]: Unsupported codec with id 100359 for input stream 3
trimethia commented 3 years ago

@jakubvojacek I am experiencing the same exact issue as you. Did you manage to solve it?

jeeb commented 3 years ago

This doesn't really belong here on the libaribb24 bug tracker, as it is FFmpeg related (demux|mux), but...

That requires implementing muxing, which I did not yet do, as I did not know it was accidentally working before due to the stream ending up as a data stream by default before. The data stream muxing logic then just happened to get mapped "correctly enough" as to get read by some parsers as ARIB captions (I will not say "correctly" as I'm pretty sure not all of the requirements specified in ARIB specs were met).

I only recently learned there was some software which actually based itself on this accidental behavior, so I am planning at some point to attempt to see the requirements for ARIB caption muxing and attempt to give it a poke in the libavformat MPEG-TS muxer.

trimethia commented 3 years ago

Thanks @jeeb. Just to confirm, until ffmpeg implements muxing of arib captions, it won't be possible to properly copy arib subtitles, right? Do you happen to have any estimates of when you would start looking into it? Thanks in advance.

jakubvojacek commented 3 years ago

Hello @jeeb

do you please have some ETA in mind regarding muxing aribs via ffmepg?

Any info highly appreciated

Thanks